Commit Graph

2504 Commits (bfbf0edbb979603ce165a65a0f7101467647a3f2)

Author SHA1 Message Date
Yosuke Shimizu 087fba94bb Fix f_404 2026-03-27 08:24:23 +09:00
John Safranek 157cb01f4b
Merge pull request #901 from yosuke-wolfssl/Add_guard
Add preprocessor directive for MLKEM hybrid
2026-03-26 15:37:00 -07:00
Yosuke Shimizu d50d013d6c Add preprocessor directive for MLKEM hybrid 2026-03-26 09:52:06 +09:00
David Garske 7bbc20ff91
Merge pull request #897 from yosuke-wolfssl/f_863
Fix the output flags
2026-03-19 11:33:47 -07:00
David Garske 6325742f98
Merge pull request #896 from yosuke-wolfssl/fix_Fenrir858-859
Fix fenrir858-859
2026-03-19 11:19:10 -07:00
Yosuke Shimizu a98ab990b3 Fix the output flags 2026-03-19 15:56:17 +09:00
Yosuke Shimizu 7bb982a5bb Revert the evaluation timing not to hide the other error causes 2026-03-19 10:56:52 +09:00
yosuke-wolfssl 631a21983d
fix the missing pointer
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-03-19 10:38:28 +09:00
Yosuke Shimizu 8e5f314e52 Add Ed25519 key clean up 2026-03-19 10:19:47 +09:00
Yosuke Shimizu 64867cfb92 Add wc_HashFree() to release the resource 2026-03-19 09:54:58 +09:00
David Garske 5be43b641f
Merge pull request #895 from ejohnstown/SEM
macOS Semaphore Cleanup
2026-03-18 09:58:51 -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
David Garske ce28fc07d3
Merge pull request #890 from ejohnstown/rsa-sha512
Client rsa-sha2-512
2026-03-17 12:44:59 -07:00
David Garske 7bb193e209
Merge pull request #892 from ejohnstown/static-fixes
Static analysis fixes
2026-03-17 12:24:15 -07:00
John Safranek 331048d701 Unsigned variable compared < 0
When filling the screen with spaces, the code was subtracting two
unsigned numbers and checking if they were negative. Changed to use a
comparison and adjust the subtraction as appropriate, then did the rest
of the size expansion. If the second point is before the first, set the
fill length to 0.

Affected function: wolfSSH_ClearScreen.
Issue: F-48
2026-03-16 16:43:48 -07:00
John Safranek 6a3e97d12b PrepareUserAuthRequestEcc Missing Bounds Checks
For agent ECC public key parsing, replaced parsing the data by hand with
the GetSkip() and GetStringRef() functions which do bounds checking.

Affected function: PrepareUserAuthRequestEcc.
Issue: F-526
2026-03-16 16:43:38 -07:00
David Garske 87ab7ea693
Merge pull request #891 from ejohnstown/no-server-2
No Server Guard Update 2
2026-03-16 15:40:38 -07:00
John Safranek 6638c01bbb DoServiceRequest Missing Bounds Check
Replace the original message parsing functions with the GetString()
function, which does better bounds checking.

Affected functions: DoServiceRequest, DoServiceAccept.
Issue: F-524, F-525
2026-03-16 15:33:42 -07:00
John Safranek 9cb60cdadf DoUserAuthRequestPassword Missing Bounds Check
Replace the original message parsing functions with the GetStringRef()
function, which does better bounds checking.

Affected function: DoUserAuthRequestPassword.
Issue: F-411
2026-03-16 14:20:23 -07:00
John Safranek a8ad9f0197 DoIgnore Missing Payload Bounds Validation
The DoIgnore() function was not bounds checking the ignore message.
Changed it to use the GetSkip() function which does bounds checking and
skips the current blob. Updated GetSkip() to allow 0 length blobs to
skip.

Affected function: DoIgnore.
Issue: F-410
2026-03-16 14:20:23 -07:00
John Safranek 801ac0701d Non-constant-time password hash comparison
In wolfSSHd, the comparisons of the password hash and public keys were
using memcmp(). Changed to use ConstantCompare().

Affected functions: CheckPasswordHashUnix, CheckPublicKeyUnix.
Issue: F-53
2026-03-16 14:20:18 -07:00
John Safranek 02048f90f6 No Server Guard Update 2
1. Moved functions SFTP_CreatePacket(), wolfSSH_SFTP_SetDefaultPath(),
   and SFTP_FreeHandles() to related functions, and their build guards.
2. Updated one of the OS-specific SFTP_GetAttributes() utility functions
   as static.
3. Removed or moved some function prototypes.
4. Added a guard around function SFTP_FreeHandles() in the function
   wolfSSH_SFTP_free(). The guard around the function call now matches
   the guard around the prototype.

ZD #21261
2026-03-10 14:59:20 -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 010380666e
Merge pull request #887 from tjko/mlkem_fix
Fix compiling when WOLFSSH_NO_NISTP256_MLKEM768_SHA256 is defined.
2026-03-09 10:30:05 -07:00
John Safranek a6b6db8d2a KEX Fix
1. When disabling mlkem768nistp256-sha256, there's a crash when doing a
   mlkem768x25519-sha256 KEX. It tries to do a DH key exchange instead
   of x25519 with ML-KEM. Modified the check.
2. Fixed a guard where the build was treating not having
   mlkem768nistp256-sha256 like a FIPS build disallowing using ML-KEM
   when generating sesssion keys. It shouldn't make that check.
3. Added a test case to the KEM test.
2026-03-09 10:29:13 -07:00
John Safranek ddd93343d0 No Server Guard Update
1. Adds --disable-server and --disable-client configure flags. Allows for
   compile-time exclusion of server or client code.
2. Add check to internal.h for both NO_WOLFSSH_SERVER and
   NO_WOLFSSH_CLIENT being set and errors.
3. In ports.h, add check for not-NO_WOLFSSH_CLIENT so SFTP/SCP
   filesystrem types are also available in client-only builds.
4. Update the NO_WOLFSSH_SERVER and NO_WOLFSSH_DIR guards around
   wolfsftp.c. Update wolfSSH_SFTP_free() to skip directory cleanup
   when server code is disabled.

ZD #21261
2026-03-09 10:29:00 -07:00
John Safranek b048f18d8c
Merge pull request #885 from padelsbach/padelsbach/finding-401-402-403
Fix multibyte passwords, file mode and attrib reporting
2026-03-09 10:27:56 -07:00
JacobBarthelmeh 1e1140aa5a
Merge pull request #883 from ejohnstown/static-fixes
Static analysis fixes
2026-03-06 10:09:29 -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
Timo Kokkonen 697ee6c79a Remove guard checks. 2026-03-05 16:39:41 -08:00
JacobBarthelmeh 045012c163 adjust when the windows-sftp github actions test is triggered 2026-03-05 13:27:08 -07:00
John Safranek e923235cb9 Uninitialized `mode` Variable in FatFS `ff_open`
Removed the variable. The flags passed to ff_open() are appropriate for
ff_open(). Just check that read or write is set.

Affected function: ff_open.
Issue: F-213
2026-03-05 10:45:51 -08:00
John Safranek 3cfec8b3d2 Missing ForceZero on plaintext password copy
When a copy of the user's password is freed, it wasn't getting force
zeroed. It might still exist in the heap after getting freed.  Added
a call to `ForceZero()`.

Affected function: CheckPasswordUnix.
Issue: F-56
2026-03-05 10:45:37 -08:00
John Safranek 86636797ee Missing break between switch cases
Addded a break to the 'J' case of a switch statement that handles
terminal display clearing for Windows. It was flowing into case 'K'
without an explicit fallthrough tag.

Affected function: wolfSSH_DoControlSeq.
Issue: F-49
2026-03-05 10:45:16 -08:00
John Safranek f424d7a7fb Unchecked `wc_InitRsaKey` Return Value
Check the return value of `wc_InitRsaKey()`. It will initialize the
structure provided the pointer is non-null. Since the key is on the
stack, the later call to `wc_FreeRsaKey()` will succeed as well.
Modified the check for the encoded signature size inside the block where
it is set; that check also updates the return value.

Affected function: SignHashRsa.
Issue: F-212
2026-03-05 10:45:01 -08:00
John Safranek b0e424e05d Missing `wc_ecc_init()` Before ECC Key Import
1. Call `wc_ecc_init()` on an ECC key before importing it.
2. Incidental: `PostLock()` and `PostUnlock()` needed their agent pointers
   tagged as unused.

Affected functions: SignHashEcc. PostLock and PostUnlock.
Issue: F-211
2026-03-05 10:44:49 -08:00
John Safranek 2da09427cd Operator Precedence Bug
Added parens around an assignment to a variable before it is compared to
an expected value.

Affected function: SetupUserTokenWin.
Issue: F-210
2026-03-05 10:43:56 -08:00
David Garske 9efdb7e820
Merge pull request #884 from aidangarske/add-ci-workflows
Add more CI workflows for wolfSSH
2026-03-04 17:07:48 -08:00
Paul Adelsbach 0458d83137 Fix multibyte passwords, file mode and attrib reporting 2026-03-04 15:29:36 -08:00
aidan garske 09144d0c7a Add more wolfSSH CI workflows 2026-03-03 21:22:39 -08:00
JacobBarthelmeh 567efa5a04
Merge pull request #874 from ejohnstown/rxd-fix
RxD Fix
2026-03-03 14:48:44 -07:00
JacobBarthelmeh 30ea988943 add Windows wolfsshd <-> wolfsftp test with large transfers 2026-02-27 16:23:27 -07:00
JacobBarthelmeh 83a3990d0d add aditional large SFTP transfer test when the SFTP read/write buffer is increased in size 2026-02-27 16:22:55 -07: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 2c6c0c7754 RxD Fix
1. When wolfSSH_worker() receives channel data, it should set the
   channelId for the data. It was not happening. Change the check for
   WS_SUCCESS to also check for WS_CHAN_RXD.
2026-02-26 15:06:17 -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
JacobBarthelmeh a2e6556a1a
Merge pull request #881 from ejohnstown/static-fixes
Static analysis fixes
2026-02-25 17:05:13 -07:00
John Safranek 961810b993 Fix wrong bitwise operator for testing attribute
Was using OR to check if a bit was set in the read-only file attribute.
This was always succeeding. Needed to change to an AND to see if it is
set.

Affected function: GetFileStats.
2026-02-24 16:43:18 -08:00
John Safranek d6e1b04316 Check correct pointer for null
After creating a new SSH context, the pointer returned wasn't checked;
the pointer to the pointer was checked. Changed to the correct pointer.

Affected function: SetupCTX.
2026-02-24 16:43:18 -08:00