Commit Graph

1288 Commits (b610dd75c4e8447c854fefd04593f3d3fe6ea265)

Author SHA1 Message Date
Yosuke Shimizu 7241f4e67c Add warning to make non-registered channelOpenCb visible 2026-04-24 10:25:34 -07:00
John Safranek 3a5aa65369 Small Test Reorganization
1. Collect all the test function wrappers in internal.c to one location
   at the end of the file.
2. Update API test to check other algos if RSA or ECDSA are disabled.
3. Added guarded tests TestClientBuffersIdempotent() for WOLFSSH_NO_RSA
   and WOLFSSH_NO_ECDSA_SHA2_NISTP256. If both are set, the test is
   skipped.
2026-04-24 09:43:56 -07:00
Yosuke Shimizu 96f3aa7c21 Fix DoRequestSuccess and DoRequestFailure, Add regress test 2026-04-23 10:10:34 -07:00
Yosuke Shimizu 0479a3a705 Add unit test for ChannelPutData 2026-04-23 09:19:42 -07:00
Joseph Chen 8e2e3c5327 Improve MQX filesystem compatibility 2026-04-22 13:45:32 -07:00
John Safranek 3df6bcfaf5 First Kex Packet Follows Test
Add a regression for checking the `first_kex_packet_follows` flag versus
the guesses for KEX algorithm and public key algorithm.
2026-04-22 10:51:01 -07:00
John Safranek 55d48e6b24 First packet follows check needs pubkey guess
When processing the KEX Init message, stash guesses for the peer's
KEX and public key algorithms. When reading first_packet_follows, if set
check the guesses and set the handshake info flag ignoreNextKexMsg. When
processing the KexDhInit message, check that flag.

Affected functions: DoKexInit, DoKexDhInit.
Issue: F-1686
2026-04-22 10:51:01 -07:00
Yosuke Shimizu e7226d0f29 Add unit test for wolfSSH_RsaVerify 2026-04-22 08:25:13 -07:00
Paul Adelsbach 90c0ee6a7c Add zeroization in wolfSSH_ProcessBuffer 2026-04-21 16:25:12 -07:00
Paul Adelsbach 3f03a851c5 Fix word16 truncation in internal.c 2026-04-21 16:24:01 -07:00
Paul Adelsbach aa974545a0 Fix uninit variable in KeyAgreeEcdh_server 2026-04-21 16:20:30 -07:00
Paul Adelsbach 1cb644d2d4 Fix Nucleus log variable 2026-04-21 16:19:18 -07:00
Yosuke Shimizu cd7a7f47c3 Fix DoChannelRequest and Add unit test for DoChannelRequest 2026-04-21 16:18:24 -07:00
Paul Adelsbach 0d283d2dd3 Add check for all zeros in CreateMpint 2026-04-21 16:03:08 -07:00
John Safranek 2d981ae87b
Merge pull request #930 from yosuke-wolfssl/f_2073
Add wc_Sha256Free after the final use
2026-04-21 15:55:22 -07:00
Yosuke Shimizu fe89681f9b Add unit test for DoUserAuthBanner 2026-04-20 17:05:05 +09:00
Yosuke Shimizu c3c51530e1 Fix DoUserAuthBanner() 2026-04-20 16:33:46 +09:00
Yosuke Shimizu 5bb1260466 Add wc_Sha256Free after the final use 2026-04-17 11:17:12 +09:00
JacobBarthelmeh 6013f122b4 check on return value of get digest size and remove old ret reset code 2026-04-16 17:27:59 -06:00
JacobBarthelmeh 8a945c7b35 fixes for c++ error on missing enum cast and warning on MlKemKey initialization 2026-04-16 16:31:43 -06:00
JacobBarthelmeh f4b7786b0b
Merge pull request #922 from ejohnstown/check-dhgroup
Validate server's group
2026-04-16 14:56:30 -06:00
John Safranek 16ddcd9764 Validate server's group
The client wasn't validating the DH group parameters in the KEX DH GEX
Group message. This adds a function to perform the validation of the
prime `p` to verify it is safe. (Prime and that ((p - 1) / 2) is
prime.) Also adds a test to a known unsafe prime and known safe prime
to verify the validate function.

Affected function: DoKexDhGexGroup.
Issue: F-1688
2026-04-16 13:42:24 -07:00
JacobBarthelmeh bf85bab6fb
Merge pull request #918 from yosuke-wolfssl/f_2867
Fix DoGlobalRequestFwd() so that it rejects the port forwarding if no fwdCb is set.
2026-04-16 09:30:30 -06:00
Yosuke Shimizu fd82a4bcf5 Fix DoGlobalRequestFwd and Add the regress tests 2026-04-16 13:11:29 +09:00
JacobBarthelmeh 85cf3e7c25
Merge pull request #921 from ejohnstown/expect-newkeys
Fix server NEWKEYS message expectation
2026-04-15 16:59:13 -06:00
JacobBarthelmeh cdd6df0c38
Merge pull request #919 from yosuke-wolfssl/f_2871
Fix DoChannelOpen() and Add the regress test
2026-04-15 15:33:01 -06:00
JacobBarthelmeh f291d99e6f
Merge pull request #917 from yosuke-wolfssl/f_2471
Fix DoKexDhReply() to reject the server's pub key if no PublicKeyCheck callback is registered
2026-04-15 15:29:53 -06:00
JacobBarthelmeh 53ae73b14e
Merge pull request #920 from yosuke-wolfssl/f_2880
Fix DoChannelOpenConf
2026-04-15 15:25:19 -06:00
JacobBarthelmeh 346c5c11cc
Merge pull request #916 from yosuke-wolfssl/f_2861
Fix PostSignRequest
2026-04-15 14:59:02 -06:00
Yosuke Shimizu e72022acc0 Fix DoChannelOpenConf 2026-04-15 16:58:56 +09:00
Yosuke Shimizu 0317c40fc1 Fix DoChannelOpen() and Add regress test 2026-04-15 13:52:23 +09:00
Yosuke Shimizu c9b8d19ff1 Fix DoKexDhReply to reject the pubkey without the callback 2026-04-15 10:44:29 +09:00
Yosuke Shimizu c0f1a1f80b Fix PostSignRequest 2026-04-14 14:50:29 +09:00
Yosuke Shimizu aa4c9ff9a0 Add unit test for VerifyMac 2026-04-14 09:23:14 +09:00
John Safranek e9d288ec60 Server Does Not Set expectMsgId to MSGID_NEWKEYS
In the server code, the server is not setting the expectedMsgId to
MSGID_NEWKEYS before sending its new keys message. Update DoKexDhReply()
to set expectMsgId to MSGID_NEWKEYS.

Affected function: DoKeyDhReply.
Issue: F-1275
2026-04-13 15:05:48 -07:00
David Garske eb49029a7f
Merge pull request #910 from yosuke-wolfssl/f_2072
Fix SendUserAuthKeyboardResponse() and add regress tests
2026-04-13 10:38:57 -07:00
David Garske aaf3e5574e
Merge pull request #908 from LinuxJedi/f-fixes
Static code analysis fixes
2026-04-10 14:33:06 -07:00
Andrew Hutchings 841f050b61 Fix Nucleus hour 2026-04-10 11:15:09 +01:00
Yosuke Shimizu 6d81c9da1e Fix SendUserAuthKeyboardResponse and add regress test 2026-04-10 10:29:11 +09:00
David Garske 4ed01d3d5a
Merge pull request #905 from yosuke-wolfssl/f_1678
Fix the resources management
2026-04-08 14:29:53 -07:00
David Garske a0e501b1f9
Merge pull request #904 from yosuke-wolfssl/f_1272
Add a bounds check on ff_close, ff_pwrite and ff_pread
2026-04-08 14:29:25 -07:00
John Safranek 3075b72061
Merge pull request #902 from padelsbach/request-validation
Add validation for accept request and reply
2026-04-08 08:26:59 -07:00
Andrew Hutchings 64de7a210f Fix gating 2026-04-08 14:57:29 +01:00
Andrew Hutchings d4a6cf80f9 Add more tests 2026-04-08 14:42:30 +01:00
Andrew Hutchings 0c5d8d31ae Fix type mismatch and harness bug 2026-04-08 14:04:44 +01:00
Andrew Hutchings a6861d993a Validate the host key signature algorithm name in DoKexDhReply().
The client-side KEXDH_REPLY path was parsing the signature blob name and
skipping over it without checking that it matched the negotiated host key
algorithm. That allowed an RSA server to negotiate rsa-sha2-256 or
rsa-sha2-512 but send a signature blob labeled ssh-rsa instead.

Fix this by comparing the signature blob name against the expected
signature type derived from handshake->pubKeyId before verifying the
signature bytes.

Add regress coverage that drives an in-memory client/server handshake,
rewrites the server's first KEXDH_REPLY on the wire, and verifies the
client rejects rsa-sha2-256 and rsa-sha2-512 replies whose signature blob
name is downgraded to ssh-rsa.

F-2077
2026-04-08 13:33:42 +01:00
Andrew Hutchings 98e3b638c0 fix DoChannelOpen failure response and add regression test
Send SSH_MSG_CHANNEL_OPEN_FAILURE for unclassified channel open errors
instead of incorrectly falling back to SSH_MSG_REQUEST_FAILURE.

Normalize OPEN_OK error cases to an administrative-prohibited channel
open failure with a generic description, and add white-box regressions
covering callback rejection plus optional direct-tcpip and agent-null
paths.

F-2076
2026-04-08 13:11:35 +01:00
Andrew Hutchings 4ff4fac6c4 Fix DoDisconnect to signal connection termination
DoDisconnect was returning WS_SUCCESS after receiving
SSH_MSG_DISCONNECT, allowing the session to continue
processing packets. Per RFC 4253 §11.1, no further data
should be accepted after a disconnect message. Add new
WS_DISCONNECT error code and return it from DoDisconnect
so callers tear down the connection immediately.

F-605
2026-04-08 12:47:46 +01:00
Andrew Hutchings 16902b0d57 Fix Nucleus month handling
F-2071
2026-04-08 12:37:43 +01:00
Andrew Hutchings 1441cb89b8 Fix leak in linked-list
F-2070
2026-04-08 12:34:41 +01:00