Commit Graph

182 Commits (c368efb8b27ae065626d31d2387cc87cc9a06289)

Author SHA1 Message Date
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 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
JacobBarthelmeh b8e6f595b4 show version of wolfSSL linked to 2024-09-27 14:36:42 -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
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
John Safranek 3024d28270
Merge pull request #695 from JacobBarthelmeh/541
Server side auth pending support
2024-06-05 15:27:36 -07: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 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 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
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 e617e20e7a example set key algos 2024-03-05 05:14:33 +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 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
JacobBarthelmeh bbc9f9e157 add more test debug prints and better rekeying handling 2023-09-29 15:05:39 -07:00
Fabio Alemagna 092c04fe30 All the filesystem-related W* macros accept a filesystem context pointer as first parameter, to make portability better. 2023-07-21 11:53:40 +02:00
JacobBarthelmeh b589883539 fix for building client on windows with shell support 2023-06-28 14:32:15 -06:00
John Safranek 639f896320
Merge pull request #519 from JacobBarthelmeh/scp
break between SSH accept and SCP operation
2023-06-01 20:54:43 -07:00
JacobBarthelmeh 3f2aa055ab break between SSH accept and SCP operation 2023-05-19 06:26:18 -07:00
John Safranek 851ac5525e
Variable Scope
1. Tighten up scope on variables in function SendKexDhReply.
2. Fix echoserver not handling the non-blocking would block state for
   SFTP.
2023-05-11 11:10:44 -07:00
John Safranek d00db44b2f
SFTP Update
1. In the API test for SFTP, change the amount of the file requested to
   the limit WOLFSSH_MAX_SFTP_RW.
2. The check for want read on the exit of the server worker should clear
   ret if it is want read.
2023-04-19 13:39:35 -07:00
John Safranek c97e8ea319
Rekey
With the previous change for speed and timing, rekeying started having
trouble in SFTP. Each file block travels as two messages, and the
rekeying starts, but the messages are sent and lost. The client would
terminate the connection.

1. Tweak the timeout in the echoserver's SFTP loop.
2. Better checking for rekeying.
3. Returning that rekeying is happening.
2023-04-11 19:50:55 -07:00
John Safranek 73946a36c6
Decoupling SFTP from SSH
wolfSSH has a reach too deep into the wolfSSH internals. SFTP should
be more like an application running on top of wolfSSH. We prefer to
keep it all in one application, so it will work well in an embedded
environment, but there needs more separation.

1. The sftp_worker loop in the echoserver should prioritize reading
   the socket and processing the SSH layer messages. Next it should
   ensure the transmit buffer for the SFTP channel is being written.
   Last it should check the receive buffer for the SFTP for new
   messages from the peer. wolfSSH_worker() will ensure data is read
   from the socket, and distributed to the appropriate channel
   receieve buffers, and will make sure the SSH bookkeeping is
   performed.
2. SendChannelData() should also bound the send data amount by the
   local maxPacketSz.
3. wolfSSH_SFTP_buffer_send() should send only one chunk of data, not
   looping until everything is gone. Need to send, but cannot flood
   the output.
4. Remove the call to wolfSSH_worker() from the buffer send.
5. The wolfSSH_SFTP_read() state machine should check the return
   status from the call to buffer send, and if it isn't an error,
   don't clear the state, allow for a want-write write again later.
6. Do not limit the file chunk size to send to WOLFSSH_MAX_SFTP_RW.
   This limit is provided during SFTP negotiation. If the peer
   requests that much data, send it.
6. Modify the select wrapper to have a very small microseconds value
   in addition to the requested seconds.
2023-04-10 15:57:25 -07:00
John Safranek 95bcc4541c
Release v1.4.13
1. Update the copyright year in all file header comments.
2. Update the STM32CUBE files to use the correct GPL headers.
2023-04-03 10:41:10 -07:00
John Safranek c59226c36b
Build Cleanup
1. Found a few cases where disabling RSA made some things either not
   build or run correctly.
2. Hushed a few unused variables in gated-disabled situations.
3. Moved a temp variable closer to where it is used.
2023-02-03 17:18:26 -08:00
John Safranek f75a60909a
Echoserver Driver
1. More tweaks for the threading guards.
2. Move a local declaration whose scope changed.
2022-11-01 15:26:22 -07:00
John Safranek e5a1c38d86
Echoserver Driver
1. Leave out the setup of the tcp_ready record when not using threading.
2. Don't change the echoserver directory when building for Integrity.
3. Change WEXIT to be a return(0) when building for Integrity.
4. The echoserver shouldn't call exit directly, it should save the
   return_code server args and then return to the caller.
5. When using forwarding, don't exit if the address is IPv6, return an
   error.
6. When exiting, close the listen file descriptor.
7. Reset myoptind to 0 before processing the options list.
2022-10-31 14:44:57 -07:00
John Safranek f0270d8920
Echoserver Driver
1. For Integrity builds, err_sys should only printf.
2. For Integrity builds, WEXIT should be a return.
3. In the echoserver, add explicit WEXITs for the err_sys statements.
2022-10-28 10:42:43 -07:00
John Safranek f25e5465e1
Echoserver Driver
1. Moved the contents of main to a new function, wolfSSH_Echoserver().
2. main just calls the wolfSSH_Echoserver().
2022-10-27 11:26:04 -07:00
John Safranek f88c3d6d3a
Dead Code Removal
1. In the echoserver's user authentication function, the summary check was
   refactored and the old code wasn't removed. A more strict compiler
   noticed the code was never executed.
2. Moved the ret check variable to the section of the function where it
   is used.
2022-10-21 15:54:34 -07:00
John Safranek e983ae0ad9
Multiple Server Keys
1. Allow user to add multiple server keys to the CTX up to a limit.
2. Clear the list of server's keys when releasing the CTX.
3. Update the API test case.
4. Server key algo list based on keys loaded.
5. Server uses key requested by client.
6. Change echoserver to load ECC and RSA key, -E option to select order.
7. Added a function to identify keys, and another to identify certs.
8. Added a function to add keys or certs to the list of keys and certs.
9. Fix return value for MAC Algo C2S match fail to the correct value.
2022-10-07 15:35:35 -07:00
John Safranek b816ac5fe8
SFTP List
Updated from peer review comments.
2022-09-20 11:53:56 -07:00
John Safranek a48926b0dd
SFTP List
1. Update wolfSSH_SFTPNAME_readdir() to have a special case getting
   the drive letters at root in Windows.
2. The Win32 APIs can use forward slashes, but cannot have one at the
   beginning of the path before the drive letter. Add a trim function
   to remove the leading slash in the SFTP paths.
3. Update echoserver to always set the default SFTP path to either the
   provided command line option or to the CWD for the echoserver run.
4.  Get the RealPath for the default path
5. Tweak wolfSSH_RealPath() to handle some Windows cases.
6. Added more test cases.
2022-09-16 14:17:31 -07:00
JacobBarthelmeh e40e852bc2 handle certificate chains 2022-08-24 06:35:40 -07:00
JacobBarthelmeh 69e1cde58f update macro guard in echoserver 2022-08-24 06:35:40 -07:00
JacobBarthelmeh 71d7f9c8cc more return code checking 2022-08-24 06:35:40 -07:00
JacobBarthelmeh 8fa67a041b add argument to client for loading certificate 2022-08-24 06:35:40 -07:00
JacobBarthelmeh c507c77431 add UUID and FASC-N 2022-08-24 06:35:40 -07:00
John Safranek 13e525478c X.509 Certificate Support
1. Quality of Life improvements to echoserver: command line user config
2. adding policy checking
2022-08-24 06:35:40 -07:00
John Safranek a8fa38d7f8 OCSP Lookups
1. Changed to use the new set of certs.
2. Do an actual cert check and report errors.
3. Do an actual OCSP lookup and report errors.
2022-08-24 06:35:40 -07:00
John Safranek 1405eeae62 X.509 Certificate Support
1. Fix build error when building without certificates.
2. Add the root CA option to the echoserver usage.
3. Update the readme file to include the new certificate option.
4. Added command line option to load a CA cert into the echoserver.
2022-08-24 06:35:40 -07:00
JacobBarthelmeh 20ace73349 fix new scan-build warning 2022-08-22 18:09:07 -06:00