Commit Graph

399 Commits (bfbf0edbb979603ce165a65a0f7101467647a3f2)

Author SHA1 Message Date
John Safranek bfbf0edbb9 7-bit Clean ASCII
Clean up the main set of files to be 7-bit clean ASCII. There were many
single and double-quotes and n-dashes.
2026-04-22 10:27:06 -07:00
Yosuke Shimizu 651e4cae8a Add kex integration test for ed25519 server key 2026-04-16 15:14:42 +09:00
Paul Adelsbach 453371f953 Add lcd and lls commands 2026-04-10 12:51:58 -07:00
Paul Adelsbach e74fd71473 Fix underflow in sftp example with empty args 2026-04-09 11:54:58 -07:00
John Safranek 2f1231d185 macOS Semaphore Cleanup
macOS uses GCD for threading and semaphores, but they aren't quite like
POSIX semaphores. macOS allows the use of named POSIX semaphores.

1. Convert the semaphores to named POSIX semaphores.
2. Simplify all calls for semaphores into single function calls of the
   wrapper API.
3. Update both examples/client/client.c and apps/wolfssh/wolfssh.c.
4. Update both to deregister the WINCH signal.
2026-03-17 19:26:32 -07:00
John Safranek f85ec920e3 Client rsa-sha2-512
1. Separate the key type and signature type when handling user
   authentication. ssh-rsa is a key type used with rsa-sha2-256 and
   rsa-sha2-512 signatures, along with ssh-rsa signatures.
2. Allow rsa-sha2-512 to be used.
3. Fix bug where setting the key algorithm on the client command line
   was setting the list to NULL.
4. Fix bug where adding rsa-sha2-512 to the list of canned algorithms
   was terminating the list, rather that adding it.

Issue: ZD-21247
2026-03-09 10:56:37 -07:00
John Safranek be69a46db0
Merge pull request #882 from JacobBarthelmeh/sftp
More robust SFTP send/read handling
2026-03-06 07:35:58 -08:00
aidan garske 09144d0c7a Add more wolfSSH CI workflows 2026-03-03 21:22:39 -08:00
JacobBarthelmeh 0539f004d3 use NoticeError throughout wolfsftp.c and account for rekey with more sftp client commands 2026-02-27 16:21:46 -07: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
JacobBarthelmeh 59a9227913 example max() conflicts with toolchains max() function 2025-10-17 17:00:03 -06: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 4862400a37 fix spelling issues and SFTP send state 2025-10-06 00:42:05 -06:00
JacobBarthelmeh 813ec263cc fix for scan-build report of unused return value 2025-09-16 13:52:12 -06: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 d74c942c84 refactor SFTP to use NoticeError 2025-08-26 10:53:38 -06:00
JacobBarthelmeh af45bc3719 update example client for rekey and sanity check on window update after read attempt 2025-08-26 10:50:14 -06: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 559de0bb3d better handling of rekeying with SFTP 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 903bbc7fb2 Coverity: Argument cannot be negative
1. Due to not checking the result of fseek(), it is possible to try to
   malloc() -1 bytes of storage. Checking the return from fseek() and
   erring if negative.
2. Changing the check between the result of fseek() and fread() to match
   signedness. Adding some casting, as at that point the fseek() result
   is always positive.

Fixes CIDs:
  573009 572928 572868
2025-07-21 09:36:35 -07:00
John Safranek f24c3c262c Coverity: Dereference before null check
1. When cleaning the path, check that the path pointer is not null
   before using it.
2. Move the strlen of path.
3. Remove the second check of path, and just loop over it.

Fixed CID: 572847
2025-07-21 09:17:21 -07: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
John Safranek 0f650789de Soft Disable AES-CBC
1. By default, soft disable AES-CBC. It isn't offered as a default
   encrypt algorithm, but may be set at runtime.
2. Add guard where AES-CBC can be added back as a default.
3. Add option to example client to run it with a custom encrypt
   algorithm list.
4. In the client, add macro to add items to the arg lists while checking
   the number of items in the list.
2025-05-16 11:41:52 -05: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 08759f1943 Add FATFS Linux example
This allows a file on the Linux filesystem to be used as a FATFS file.

It also fixes a bug in `port.h` when opening file on a FATFS filesystem.
2025-02-27 12:18:05 +00:00
devin-ai-integration[bot] 76e8b9f4ea
Update SFTP status callback to output once per second (#779)
* Update myStatusCb to output once per second

Modified the myStatusCb function in sftpclient.c to only output status
updates once per second by tracking the last output time and comparing
it with the current time. This reduces the frequency of status updates
while maintaining all existing functionality.

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Reset status output timer when starting new file transfer

When starting a new file transfer, reset the lastOutputTime to ensure
the first status update for the new file is shown immediately.

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Fix Zephyr build by guarding lastOutputTime with WOLFSSH_NO_TIMESTAMP

The lastOutputTime variable is only used when timestamps are enabled,
so it should be guarded by the same macro to avoid unused variable
warnings in builds where timestamps are disabled.

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Move elapsedTime declaration to function scope

Per wolfSSL coding standards, declare all variables at function scope.
Added comment explaining that modern compilers optimize variable access
regardless of declaration placement.

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Fix timeout check to use elapsed time instead of current time

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Use elapsed time in timeout error message for consistency

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Move elapsedTime inside WOLFSSH_NO_TIMESTAMP guard

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

* Move currentTime outside WOLFSSH_NO_TIMESTAMP guard

Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: andrew@wolfssl.com <andrew@wolfssl.com>
2025-02-26 16:54:21 -07:00
Andrew Hutchings a9c7ebc36d Fix SCP server side
SCP on the server side would get an EAGAIN around the 128KB mark, which
would trigger an error. That error in-turn would cause two attempts to
close the file, which would segfault.

Also fix inverted error return status on scpclient.
2025-02-19 11:13:42 +00: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
Andrew Hutchings d108c69c5d Add cppcheck test to GitHub actions
Found and fixed:

* Fix typos in Renesas demo
* Fix uninitialized variable reads
* Fix redundant condition
* Fix argument checks
* Fix some null ptr dereferences
* Fix ambiguous statement
2025-02-05 19:49:01 +00:00
JacobBarthelmeh 71301530a1 SCP client continue on to free struct's after failure 2024-11-08 11:18:29 -07:00
JacobBarthelmeh 9e68977945 test setting different wolfssl version for test 2024-10-11 16:23:20 -06:00
JacobBarthelmeh b8e6f595b4 show version of wolfSSL linked to 2024-09-27 14:36:42 -06:00
JacobBarthelmeh 781aa27582 touch up after rebase 2024-08-05 13:31:47 -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
JacobBarthelmeh 816b314819 case of non-console ouptut handle 2024-06-24 13:52:17 -06:00