Commit Graph

361 Commits (e5042df0c17851b0aaf77b94ed6fdfc217489925)

Author SHA1 Message Date
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
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
JacobBarthelmeh 23a9333b2d add check for channel closed error 2024-06-10 15:54:42 -06:00
John Safranek 524b5c6052
Merge pull request #702 from JacobBarthelmeh/scp_example
adjust scp error return checking for closed channels
2024-06-05 15:30:15 -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
David Garske b6ccb07de4
Merge pull request #703 from anhu/ipv6_part2
improvements for ipv6
2024-06-03 16:22:16 -07:00
Anthony Hu 1697d603c0 Changes inspired by ejohnstown comments. 2024-06-03 14:40:52 -04:00
Anthony Hu 499a742097 improvements for ipv6 2024-05-31 17:32:20 -04:00
Juliusz Sosinowicz 6de1230e6b scpclient.c: correct call to wolfSSH_SetPublicKeyCheckCtx 2024-05-31 17:06:34 +02:00
JacobBarthelmeh c3aaa6e570 adjust scp error return checking for closed channels 2024-05-29 13:44:58 -06: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 2e1ca68652 Static Memory
1. Update the scpclient's use of the common key and cert function calls to
   pass NULL for the heap.
2024-04-26 10:21:29 -07: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 6d51cc8278
Release v1.4.17: Release Testing Fixes
1. C++ build required some additional typecasting.
2. C++ complained about using the `= { 0 }` initializer, switched to
   `WMEMSET()`.
2024-03-22 17:09:01 -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
JacobBarthelmeh 902cff345f
Merge pull request #667 from ejohnstown/sftp-fix
SFTP Fix
2024-03-19 00:21:38 +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 5d3f8776ed add macro guard on windows version for VT 2024-03-06 09:49:42 -07:00
JacobBarthelmeh e137865ab2 use windows terminal parsing for VT 2024-03-06 09:01:48 -07:00
JacobBarthelmeh bb9efdcb5c use WOLFSSL_RETURN_FROM_THREAD in example client 2024-03-05 08:02:06 +07:00
JacobBarthelmeh e617e20e7a example set key algos 2024-03-05 05:14:33 +07:00
JacobBarthelmeh 8b7a15f0fd check for channel closed on shutdown 2024-02-22 07:44:24 -08:00
John Safranek 815d22f729
Merge pull request #650 from miyazakh/no_rsa
fix WOLFSSH_NO_RSA
2024-01-31 13:20:53 -08:00
Hideki Miyazaki b256522f5b
fix WOLFSSH_NO_RSA 2024-01-27 13:03:10 +09:00
JacobBarthelmeh ab45a98d18 fix for building with QNX 2024-01-26 14:01:52 -07:00
JacobBarthelmeh 903bc98c34 update example client shell settings 2024-01-26 14:01:52 -07:00
JacobBarthelmeh 7d2b4c5e39 fix typo in macro guard 2024-01-22 15:10:53 -07:00
JacobBarthelmeh 0d480fa419 adjust shutdown for sending exit status cleanly 2024-01-19 09:18:41 -07:00
JacobBarthelmeh afe109acf8 client side handling of exit-status packet 2024-01-19 09:18:41 -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 25a4984e59
Remove Example Server
The example server was never used. All new behaviors were added to the
echoserver only. Now with wolfSSHd, the server example can finally be
removed.

1. Remove the example server from the build.
2. Remove the file notes.md.
3. Update the readme.
2023-12-28 12:28:16 -08:00
John Safranek 948b545ad8
Release v1.4.15: Release Testing Fixes
1. Fix an instance in the example sftpclient where the size of something
   is treated as an int and may have caused trouble, per the pedantic
   compiler settings.
2. Changed a check for snprintf where we checked the lengths of
   everything before calling snprintf. Turned it around where we check
   the return of snprintf and error if the process would have output too
   much.
2023-12-22 14:43:34 -08:00
John Safranek f35cab9e86 SFTP Zero Byte Files
1. When putting a file with SFTP, the client should check that the
   requested file is a regular file based on its attributes.
 2. Add the attributes to check in the permissions.
 3. Add server checking for non-regular files and not allowing them to
    be opened for reading or writing.
2023-12-06 14:04:27 -08:00
John Safranek 9d92672931 SFTP Zero Byte Files
1. When getting a file with SFTP, the client should check that the
   requested file is a regular file based on its attributes.
2. Add the attributes to check in the permissions.
3. Add a new error for a non-regular file.
2023-12-06 14:04:27 -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