Commit Graph

685 Commits (f589ea275d112ec287df2cfa3be1cb07c75ea0ca)

Author SHA1 Message Date
Anthony Hu 6c6b405f68 Bugfix: erroring out on copying empty file; don't read if file size is 0. 2022-03-24 15:36:55 -04:00
Anthony Hu 312b9d1d7a
Merge pull request #393 from ejohnstown/sftp-rxd 2022-03-21 17:55:15 -04:00
John Safranek 981b8e8b30
SFTP Channel Receive Fix
1. The echoserver's sftp_worker() was treating the WS_CHAN_RXD status as
   an error and failing out. Updated to clear the error status.
2. wolfSSH_SFTP_read() was also treating WS_CHAN_RXD status as an error
   and terminating the transfer. Update to treat like the other status.
2022-03-21 14:39:52 -07:00
John Safranek b1967829cd
Small Buffer wolfSCP
When using a small file buffer for SCP, there was a combination of file
size and channel window size where SCP would read the remainder of the
file, close it, send a small message because the peer's window was full,
then try reading the file again. The change keeps trying to send if the
file buffer still has data.
(ZD #13808)
2022-03-17 15:21:13 -07:00
John Safranek d7b453ba1f
Merge pull request #389 from kojo1/zd13769
Missing return value
2022-03-03 08:59:12 -08:00
Takashi Kojo cefde5f4d3 Missing return value 2022-03-03 10:21:12 +09:00
David Garske 6162cd1181 Fixes for building without RSA or ECC. 2022-02-28 12:48:22 -08:00
Hideki Miyazaki d080111157
fix handling sending data if the data size is greater than peer max packet size 2022-02-17 13:36:16 +09:00
John Safranek 4354edc945
Fix SCP Extended Data Print
The OSS-Fuzz detected a possible use of uninitialized data. Since it is
text output for the STDERR of the peer, make sure the string is actually
null terminated before fprintf to stderr.
2022-02-01 14:14:04 -08:00
John Safranek bd312c34f2
Old Compiler Warning Cleanup (GCC 4.0.2)
1. client.c: It was warning a recommendation to tag the function
   `readInput()` as non-return. Changed the err_sys() calls to
   `fprintf(stderr, ...)` and then return from the function.
2. internal.c: In functions `DoKexInit()` and
   `DoUserAuthRequestPublicKey()`, initialized a couple variables that
   could be used uninitialized.
3. wolfsftp.c: Fixed a variable that was shadowing a global label.
4. wolfsftp.c: In function `wolfSSH_SFTP_RecvFSTAT()`, initialized a
   variable that could be used uninitialized.
5. scpclient.c: The command line argument was read into a char value
   assuming it was signed, which is usually true. On the PowerPC this
   value is unsigned. Promoted it to int to match the other tools.
2022-01-27 10:36:51 -08:00
John Safranek ba42d6f732
Fix missing pread() and pwrite()
1. configure.ac: Check that the DECLs for `pread()` and `pwrite()` exist
   in unistd.h.
2. port.c: If `pread()` or `pwrite()` aren't available, use the local
   versions that are wrappers around `seek()` and `read()` and
   `write()`.
2022-01-27 10:36:42 -08:00
Takashi Kojo a8dee72390 macro guarde for WOLFSSH_NO_DH_GEX_SHA256 2021-12-15 10:25:36 +09:00
John Safranek e582d29f33
Remove redundant free
1. Free the handshake hash right after final.
2. Change GenerateKeys() to take a hashId as a parameter.
3. Clear the handshake hash ID right after freeing.
4. Free the handshake hash if the hash ID isn't NONE in
   HandshakeINfoFree.
2021-12-06 10:30:20 -08:00
John Safranek 15b62dd26b
Merge pull request #378 from JacobBarthelmeh/memory
small stack optimizations
2021-12-03 10:23:09 -08:00
Jacob Barthelmeh 7dd9d1fa2e fix check on RSA import size 2021-12-01 15:54:26 -07:00
Jacob Barthelmeh 6b4bd138af small stack optimizations 2021-11-19 16:14:30 -07:00
John Safranek 49bd5d6988
Add window updates to Channel reads and ChannelId reads. 2021-11-09 10:15:45 -08:00
John Safranek caedd5339c When scp receives a string in STDERR, print it out. 2021-11-04 14:45:34 -07:00
Jacob Barthelmeh ba99ddda68 run license update script 2021-11-04 13:11:53 -06:00
Jacob Barthelmeh db00600628 fixes for warnings from scan-build 2021-11-04 09:43:53 -06:00
Jacob Barthelmeh d3c80b8fe8 g++ build warning fixes 2021-11-04 00:59:21 -06:00
David Garske 19b3f3ee62
Merge pull request #371 from ejohnstown/size-fix
Size Calculation Fix
2021-10-28 10:30:45 -07:00
John Safranek 0402caa05c
Moved the calculation for a size into an if-clause where the pointer derefenced is known-good. 2021-10-11 14:06:33 -07:00
Jacob Barthelmeh eda158731d sftp fix for getting attribute header 2021-10-08 10:45:45 -06:00
John Safranek fde6ce4550
SSH Port Forwarding Redux
1. Fixed a leak from a commit earlier in this branch.
2. Freed the correct address name when a forwarded connection closes.
3. Only muck about with the childFd when using the shell.
4. Treat the error code WS_CHANNEL_CLOSED as status, not a failure.
2021-10-06 13:24:13 -07:00
John Safranek dd79a54541
Fix issue with shutting down a channel. It would try to do it twice and error out. 2021-10-05 19:38:18 -07:00
John Safranek 4435ed40fa
Move function CreateMpint() to internal.c. 2021-09-27 10:49:21 -07:00
John Safranek f369f4346c
Static Analysis Test Report Fixes
1. Moved SendKexDhReply()'s signature data to the heap. (413)
2. Moved SendUserAuthRequest()'s signature data to the heap. (414)
3. Moved DoKexDhReply()'s signature data to the heap. (415)
4. Moved DoUserAuthRequestRsa()'s RSA key to the heap. (416)
5. Moved wolfSSH_ProcessBuffer()'s key buffer to the heap. (422)
6. Moved wolfSSH_ReadKey_buffer()'s key bugger to the heap. (423)
7. In the echoserver, fixed a small-stack related allocation. It was
   using a DYNTYPE constant, but those aren't visible. Also, the
   wrong variable name was getting freed. (rebase)
2021-09-27 08:35:15 -07:00
John Safranek 73fe699f30
Static Analysis Test Report Fixes
1. For DoChannelExtendedData(), removed the switch on the extended data
   value type. It can only be one value, and it is checked when read from
   the message. Checking it again in the switch statement leaves dead code.
   (47)
2. In PreparePacket(), fix a possible dereference of NULL when checking
   the outputBuffer length. (68)
3. Change the utility function CreateMpint() to return an error.
   (69, 70, 71)
4. DoChannelOpenForward() updates idx in the error case, even if idx is
   is NULL, don't bother updating it. (72)
5. In GenerateKeys(), if ssh is NULL, it might still check to see if its
   aeadMode is set. Check the aeadMode only if everything is still OK.
   (73)
6. In BundlePacket(), aeadMode was getting checked when ssh was NULL.
   Check it if everything is still OK. (74)
7. PurgePacket() should check that the ssh passed to it isn't NULL.
   (78, 79, 81)
8. Replumbed BuildUserAuthRequestRsa() to protect against trying to use
   an signed error code as an unsigned value. (113)
9. In GenerateKey(), check that the returned digest size isn't 0 or a
   negative error value. (130, 132)
10. In DoUserAuthReqEcc(), check the ssh pointer before dereferencing it
   to get the key size for allocating the small stack key values. (252)
11. In DoUserAuthReqRsa(), check the ssh pointer before dereferencing it
   to get the key size for allocating the small stack key values. (253)
12. In DoChannelRequest(), initialize the arrays for the read name and
   value to a NULL string. It should log as blank for an error. (440)
13. In SendUserAuthRequest(), initialize the keySigId to ID_NONE. Later
   in CleanupUserAuthRequestPublicKey(), explicitly check the keySigId
   value for one of the four types: RSA or ECDSA. (442)
14. In SendKexDhReply(), changed the union's type field from isRsa to
   pubKeyId, and explicitly checked against RSA or ECDSA. (444, 445, 446)
15. DoReceive() had a for(;;) loop but no control commands internally.
   Removed the loop as redundant. (451)
2021-09-27 08:06:54 -07:00
John Safranek 6d606dff45
Port Forwarding Update
1. Fix issue with local port forwarding example.
2. Add remote port forwarding to the echoserver.
3. Updated the unsupported GlobalReq response.
2021-09-27 08:06:54 -07:00
Jacob Barthelmeh 7968cb479e make loading user created keys into the examples easier 2021-08-25 09:53:58 -06:00
John Safranek 359eb212f9
Merge pull request #357 from JacobBarthelmeh/testing
fix for typo and reduce stack size
2021-08-23 14:31:48 -07:00
John Safranek edb272e35e
ASAN SFTP Fixes
When decoding SFTP messages, fix the size checks so they don't wrap. (ZD12766)
2021-08-18 14:20:08 -07:00
Jacob Barthelmeh 094eff8933 reduce stack size of wolfSSH_ReadKey_buffer with smallstack 2021-08-03 20:39:19 +07:00
Jacob Barthelmeh 5555aa05f2 fix for RSA public key auth 2021-08-02 16:58:18 +07:00
John Safranek 48a0e667a4
Merge pull request #353 from JacobBarthelmeh/release
Release version 1.4.7
2021-07-23 09:40:05 -07:00
Jacob Barthelmeh a353cae4d8 initialize hash type 2021-07-23 14:29:43 +07:00
JacobBarthelmeh 40079edb57
Merge pull request #351 from ejohnstown/fixes
Fix for NO_FILESYSTEM and WOLFSSH_NO_AES_GCM and !HAVE_ECC
2021-07-23 13:50:02 +07:00
John Safranek 064cfce0d9
Fuzzing Fixes
1. Fixed a leak.
2. Fixed a branch on uninitialized.
(ZD 12640 and 12642)
2021-07-20 16:23:15 -07:00
John Safranek 326ae8725b
More disable flag fixes for ECDHE. 2021-07-20 11:38:55 -07:00
Eric Blankenhorn ccc590c3ae Fix from review 2021-07-20 11:22:06 -07:00
Eric Blankenhorn d02e6003f9 Fix for not HAVE_ECC 2021-07-20 11:22:06 -07:00
John Safranek d64c0c309a
DH Size Fix
When creating the handshake info, initialize the size of the e and x values to their sizes.
2021-07-15 10:00:02 -07:00
John Safranek ebd7031b66
More AES
Added 192 and 256 bit support for AES-CBC, AES-CTR, and AES-GCM.
2021-06-23 11:22:56 -07:00
Daniele Lacamera 338d3ba219 Added support for FatFs 2021-05-24 13:58:49 +02:00
John Safranek a6e4d46c75
Merge pull request #332 from kojo1/user-filesys
User filesystem option
2021-05-18 13:46:58 -07:00
JacobBarthelmeh a6fba1d9ae
Merge pull request #335 from danielinux/hwcrypto_fixes
Fix descriptor leaks for sha/aes
2021-05-11 18:05:28 +07:00
John Safranek 3d8d9654dd
Merge pull request #339 from JacobBarthelmeh/sftp
reset kSz for rekey fix
2021-05-07 14:45:24 -07:00
Jacob Barthelmeh 99d1af1017 reset kSz for rekey fix 2021-05-07 15:02:00 +07:00
Jacob Barthelmeh f3c98d4dfd fix for cleanup in error case 2021-05-07 14:10:52 +07:00