Commit Graph

204 Commits (bfbf0edbb979603ce165a65a0f7101467647a3f2)

Author SHA1 Message Date
Yosuke Shimizu 651e4cae8a Add kex integration test for ed25519 server key 2026-04-16 15:14:42 +09:00
aidan garske 09144d0c7a Add more wolfSSH CI workflows 2026-03-03 21:22:39 -08:00
John Safranek 08ce58ce7c Forwarding Test
1. Add a test script and expect script for testing forwarding.
2. Update portfwd to have a ready file option.
3. Fix echoserver error string, needed NL.
2026-02-26 15:02:19 -08:00
John Safranek 5cd81c9f1f Agent Update
1. Fix a couple unused variable warnings.
2. In wolfSSH_AGENT_DefaultActions(), fix comparison to the result of
   snprintf() treating normal result as an error. Reset the return code
   for the error state of the socket() command. Better cleanup of agent
   startup failures.
2026-02-26 14:37:07 -08:00
John Safranek 78e38999a1 Fix Test Term Size
When running the build tests, the terminal size gets set to 0x0. When
then tests finish, things like vim start to misbehave until you change
your term window size.

1. Echoserver will not change the terminal size when in echo mode.
2. Do not update the modes when the echo server is not in echo mode.
3. Do not set the terminal update callback context when the echo server
   is not in echo mode.
4. Update the guards around the above three items to match the guards for
   the modes update function.
2026-01-13 11:33:03 -08:00
John Safranek 8951bd9209 Release v1.4.22
1. Update copyright date to 2026.
2025-12-29 16:53:33 -08:00
hanshenrik 44dc148dbd replace sys/errno.h with errno.h
Historically, some systems have used <sys/errno.h> in place of <errno.h>, but the C standard,
 all the way back to C89/Ansi C, specifies that the correct name is `errno.h` -
and most modern compilers create a sys/errno.h compatibility shim sys/errno.h -
but musl-gcc does not have this compatibility shim,
 reasoning that sys/errno.h is non-standard, and fails to compile:
```
$ CC=musl-gcc ./configure --enable-static --disable-shared --enable-scp --enable-sftp --enable-shell --with-wolfssl=wolfssl/install-musl
(...)
$ make
make -j17  all-am
make[1]: Entering directory '/home/hans/projects/wolfssh'
  CC       examples/client/common.o
  CC       examples/client/client.o
  CC       src/libwolfssh_la-ssh.lo
  CC       src/libwolfssh_la-internal.lo
  CC       src/libwolfssh_la-log.lo
  CC       src/libwolfssh_la-port.lo
  CC       src/libwolfssh_la-io.lo
  CC       src/libwolfssh_la-wolfscp.lo
  CC       src/libwolfssh_la-wolfsftp.lo
  CC       examples/echoserver/echoserver.o
  CC       src/libwolfssh_la-wolfterm.lo
  CC       examples/sftpclient/sftpclient.o
  CC       examples/scpclient/scpclient.o
In file included from examples/echoserver/echoserver.c:91:
/usr/include/x86_64-linux-musl/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp]
    1 | #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
      |  ^~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1452: examples/echoserver/echoserver.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/hans/projects/wolfssh'
make: *** [Makefile:1020: all] Error 2
```

so, unless we need to support pre-C89 (35+ year old C) compilers,
we can just replace sys/errno.h with errno.h.
2025-11-22 17:40:20 +01:00
John Safranek 50aa10d717
Merge pull request #793 from JacobBarthelmeh/rekey
sanity checks on message types during rekey
2025-10-06 13:54:03 -07:00
JacobBarthelmeh 2a11471bb7 refactor introducing more use of NoticeError 2025-09-16 13:30:25 -06:00
gojimmypi dccc62bafd
Rename wolfssh test certs 2025-09-03 11:10:53 -07:00
JacobBarthelmeh 8a8ee954d3 in want write case with example echoserver do not wait on select for data 2025-07-25 11:32:02 -06:00
JacobBarthelmeh a6e523886f fix for clang scan-build warning of variable not used 2025-07-25 11:32:02 -06:00
JacobBarthelmeh 01dd6ec3dc fixes for SFTP want read/write cases 2025-07-25 11:32:02 -06:00
JacobBarthelmeh 88d4eae96a remove keyboard auth callback and use generic auth callback 2025-07-25 11:31:02 -06:00
John Safranek c855d9c16e Simplify Test Build Flags
1. Modify all the test executable `CPPFLAGS` to only have
   `-DNO_MAIN_LOOP` and `AM_CPPFLAGS`. This removes a lot of duplicate
   setup of flags for each of the tests.
2. Delete the echoserver's `CFLAGS`. It is just setting the `CFLAGS` for
   its compile to `AM_CFLAGS` and `AM_CPPFLAGS` which are included by
   default.
3. Add the macro WS_MAYBE_UNUSED that may be the unused attribute.
4. If INLINE isn't set to some form of inline, set it to
   WS_MAYBE_UNUSED.
5. Remove redundant ThreadStartNoJoin() macros from the testing header.
2025-07-17 15:30:24 -07:00
JacobBarthelmeh 1422697e43 add check for want write in example echoserver to handle new test case 2025-05-20 16:55:42 -06:00
JacobBarthelmeh 71cda6d16c add test case for want write return from highwater callback 2025-05-20 15:18:27 -06:00
Andrew Hutchings c368efb8b2 Make Keyboard Interactive a compile time option
Now an off-by-default compile-time option. This saves resources and
confusion if you are not expecting it.

ZD #19704
2025-04-22 13:12:42 +01:00
Anthony Hu 03afce7236 Forgive a socket error 2025-04-03 19:19:36 -04:00
aidan garske a52c3b120e Used W port.h file operations for keyblob and added username argument so can append any username needed. 2025-04-02 10:33:27 -07:00
aidan garske 69e266178f Used port.h macros 2025-04-01 21:58:49 -07:00
aidan garske 77c8db6cc2 Rebase for tpm public key authentication with wolfssh 2025-04-01 16:44:55 -07:00
Andrew Hutchings f73a76e064 Add DH Group 16 and HMAC-SHA2-512
This adds the `diffie-hellman-group16-sha512` key exchange and
`hmac-sha2-512` mac support.

Echoserver can now take `-x` for key exchange and `-m` for mac setting,
 and `-c` for cipher so that this can be used in the test suite.
2025-02-12 07:06:51 +00:00
Andrew Hutchings a4733ecd95 RFC-4256 Keyboard-Interactive authentication
This implements Keyboard-Interactive authentication.

Adds an additional callback set by `wolfSSH_KeyboarAuthPrompts()` which
will set a callback in the server to ask the application to provide the
prompt details for the client.
2025-02-11 14:19:52 +00:00
JacobBarthelmeh b8e6f595b4 show version of wolfSSL linked to 2024-09-27 14:36:42 -06:00
John Safranek dc2065719f Release v1.4.18: Release Testing Fixes
1. Fix echoserver's load_file function. Could potentially dereference
   null if a file size is passed in, but using a null buf to get the
   file's size only.
2024-07-18 14:44:03 -07:00
John Safranek c1e5af49dc Echoserver Refresh
1. Add the code from wolfsshd that initially sets up the terminal
   settings to the echoserver.
2. Add the WOLFSSH_TERM flag to the build of the echoserver.
2024-06-20 15:38:37 -07:00
John Safranek 3024d28270
Merge pull request #695 from JacobBarthelmeh/541
Server side auth pending support
2024-06-05 15:27:36 -07:00
JacobBarthelmeh dc66602e12 add example auth pending 2024-05-17 16:11:30 -06:00
JacobBarthelmeh ebfd175bf1 add example and account for curve25519 / kyber1 2024-05-17 14:51:46 -06:00
John Safranek d6d67c889c Static Memory
1. In the echoserver, change the names of the defines for the
   static memory values.
2. Modify the client common functions for keys and certs to take a heap
   value for their allocations.
3. Update the client's use of the common key and cert function calls to
   pass NULL for the heap.
4. Add a static memory description for the sftp client code.
2024-04-26 10:21:29 -07:00
John Safranek 559f24b476 Static Memory
1. Change the static buffer for the echoserver and the memory
   descriptions to be static values.
2. Fixed a double-free on the memory statistics.
2024-04-26 10:21:29 -07:00
John Safranek 6a65f16083 Static Memory
1. Modify the echoserver to use a static memory pool when using the flag
   WOLFSSH_STATIC_MEMORY. Uses NULL otherwise. The WOLFSSH_CTX is
   created with the pool and subsequent allocations for the WOLFSSH
   server use the same pool.
2. Add a configuration for the memory pool. Only works with SFTP
   enabled.
3. Add the memory pool use statistics to the echoserver.
2024-04-26 10:21:29 -07:00
John Safranek 1736a4cabf
Update Copyright Date
1. Bring all copyright dates up to 2024.
2. Fix a few files with incorrect licensing.
2024-03-22 12:17:09 -07:00
John Safranek 76e8d66289
SFTP Fix
1. Remove the continue from the SFTP worker loop when there's a timeout
   on the select and when there's a want_read from the wolfSSH_worker.
2. When the select has receive data ready, check it. Don't make it
   conditional on want read as well.

The goal is that when there isn't data waiting on the socket, check and
process the data in the SFTP channel's buffer, always.
2024-03-13 15:08:07 -07:00
JacobBarthelmeh e617e20e7a example set key algos 2024-03-05 05:14:33 +07:00
John Safranek ec1248f14d
SFTP Test Maintenance
1. Modified SignalTcpReady() to test.h. Matched its prototype to the
   other functions for TcpReady.
2. Add a timeout in WaitTcpReady() specifically for Zephyr builds.
3. Misc few cleanups.
2024-01-03 13:24:10 -08:00
John Safranek 66dc60853c
Echoserver Select Timeouts
A couple changes to keep the echoserver from spin-locking.

1. The SFTP worker should wait for data if the channel window is full.
   If the client isn't sending a window adjust, it might be because of a
   human time scale issue. New timeout is 60 seconds.
2. When the echoserver is waiting for something from the user and the
   select times out, wait a second instead.
2023-10-31 10:21:44 -07:00
Juliusz Sosinowicz 37412ff50f Init zephyr support
- SSH
- SFTP
- SCP
2023-10-02 20:38:21 +02:00
JacobBarthelmeh bbc9f9e157 add more test debug prints and better rekeying handling 2023-09-29 15:05:39 -07:00
Fabio Alemagna 092c04fe30 All the filesystem-related W* macros accept a filesystem context pointer as first parameter, to make portability better. 2023-07-21 11:53:40 +02:00
JacobBarthelmeh b589883539 fix for building client on windows with shell support 2023-06-28 14:32:15 -06:00
John Safranek 639f896320
Merge pull request #519 from JacobBarthelmeh/scp
break between SSH accept and SCP operation
2023-06-01 20:54:43 -07:00
JacobBarthelmeh 3f2aa055ab break between SSH accept and SCP operation 2023-05-19 06:26:18 -07:00
John Safranek 851ac5525e
Variable Scope
1. Tighten up scope on variables in function SendKexDhReply.
2. Fix echoserver not handling the non-blocking would block state for
   SFTP.
2023-05-11 11:10:44 -07:00
John Safranek d00db44b2f
SFTP Update
1. In the API test for SFTP, change the amount of the file requested to
   the limit WOLFSSH_MAX_SFTP_RW.
2. The check for want read on the exit of the server worker should clear
   ret if it is want read.
2023-04-19 13:39:35 -07:00
John Safranek c97e8ea319
Rekey
With the previous change for speed and timing, rekeying started having
trouble in SFTP. Each file block travels as two messages, and the
rekeying starts, but the messages are sent and lost. The client would
terminate the connection.

1. Tweak the timeout in the echoserver's SFTP loop.
2. Better checking for rekeying.
3. Returning that rekeying is happening.
2023-04-11 19:50:55 -07:00
John Safranek 73946a36c6
Decoupling SFTP from SSH
wolfSSH has a reach too deep into the wolfSSH internals. SFTP should
be more like an application running on top of wolfSSH. We prefer to
keep it all in one application, so it will work well in an embedded
environment, but there needs more separation.

1. The sftp_worker loop in the echoserver should prioritize reading
   the socket and processing the SSH layer messages. Next it should
   ensure the transmit buffer for the SFTP channel is being written.
   Last it should check the receive buffer for the SFTP for new
   messages from the peer. wolfSSH_worker() will ensure data is read
   from the socket, and distributed to the appropriate channel
   receieve buffers, and will make sure the SSH bookkeeping is
   performed.
2. SendChannelData() should also bound the send data amount by the
   local maxPacketSz.
3. wolfSSH_SFTP_buffer_send() should send only one chunk of data, not
   looping until everything is gone. Need to send, but cannot flood
   the output.
4. Remove the call to wolfSSH_worker() from the buffer send.
5. The wolfSSH_SFTP_read() state machine should check the return
   status from the call to buffer send, and if it isn't an error,
   don't clear the state, allow for a want-write write again later.
6. Do not limit the file chunk size to send to WOLFSSH_MAX_SFTP_RW.
   This limit is provided during SFTP negotiation. If the peer
   requests that much data, send it.
6. Modify the select wrapper to have a very small microseconds value
   in addition to the requested seconds.
2023-04-10 15:57:25 -07:00
John Safranek 95bcc4541c
Release v1.4.13
1. Update the copyright year in all file header comments.
2. Update the STM32CUBE files to use the correct GPL headers.
2023-04-03 10:41:10 -07:00
John Safranek c59226c36b
Build Cleanup
1. Found a few cases where disabling RSA made some things either not
   build or run correctly.
2. Hushed a few unused variables in gated-disabled situations.
3. Moved a temp variable closer to where it is used.
2023-02-03 17:18:26 -08:00