Commit Graph

180 Commits (a52c3b120e01280afbc22e4a81bb023c9bd291bc)

Author SHA1 Message Date
Jacob Barthelmeh 5806d28dd2 check for null port value 2022-08-09 13:24:58 -06:00
JacobBarthelmeh dba42d3dc7 Non-blocking SFTP and SSH fixes, handle edge case with files having '.' in name, alter want write case to return consumed size 2022-08-08 13:43:34 -07:00
JacobBarthelmeh 7b8ce149d7 add look for libpam and adjust for QNX build 2022-07-21 13:31:22 -07:00
JacobBarthelmeh 3013eee8cb handle pending sent packets with SFTP and want write case with rekey 2022-07-14 09:17:43 -07:00
John Safranek 6bc47eef77 No User
1. In the echoserver, add a print to the case where a user doesn't exist
   in the system.
2022-05-25 14:21:50 -07:00
John Safranek b34f144814
Preprocessor Guards
1. Add preprocessor guards for RSA/ECC to agent and the example and test
applications.
2. Remove redundant copy of FwdStates from internal.h.
2022-04-05 11:02:23 -07:00
David Garske 509851e64e
Merge pull request #398 from ejohnstown/status
Echoserver SFTP status update
2022-03-25 14:45:56 -07:00
John Safranek b94349bbc5
Echoserver SFTP status update
1. In wolfsftp, treat all the status codes the same when trying to read.
2. In the echoserver, treat all the status codes the same in the
   sftp_worker.
2022-03-24 16:55:12 -07:00
David Garske 0f22329187 Fix for FIPS 140-3 on ECC private key use. Fix for IPv6 with scpclient. Wrong macro for fall through. Add support for flushing file IO using `WOLFSCP_FLUSH`. 2022-03-24 13:34:26 -07: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 796423bfac
Update tests and examples to include config.h
1. All the sources for the tests and examples did not have an include
   for config.h. This fixed some inconsistent builds with an older
   version of gcc.
2. Moved config.h from the src directory to the top level of the repo
   directory.
2022-01-26 15:06:07 -08: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
John Safranek 3c8b2a622a
In the echoserver, added a state check when a channel closes so it doesn't try to check a bad fd. 2021-10-07 15:09:02 -07:00
John Safranek a1f90568ab
Some cleanup for Windows build. 2021-10-06 18:08:04 -07: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 d66fb26158
Update the echoserver to look up addresses used. 2021-10-06 13:24:05 -07:00
John Safranek 061463e604
Changed calls to malloc, free, memcpy, etc. with uses of the wrappers WMALLOC, WFREE, WMEMCPY, etc. 2021-10-05 19:38:33 -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 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 b3e9321a3c
Fixed an echoserver leak with forwarding. 2021-09-27 08:06:54 -07:00
John Safranek 1a807f1da4
Move some buffers around in the echoserver so they are allocated once per thread. 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
JacobBarthelmeh df753b0b4b sanity check on the end of the buffer in example 2021-08-27 13:41:41 -06:00
Jacob Barthelmeh 7968cb479e make loading user created keys into the examples easier 2021-08-25 09:53:58 -06:00
Eric Blankenhorn 5931aefff5 Fix for NO_FILESYSTEM and WOLFSSH_NO_AES_GCM 2021-07-20 11:22:04 -07:00
John Safranek bbd3d76291
Add some option disables to the api test and the echoserver. 2021-02-02 11:45:21 -08:00
John Safranek 31912462a0
Hide SHA from Echoserver
1. Remove calls to wc_Sha256 Init, Update, and Final and remove the
   instances of the wc_Sha256 structure.
2. Remove the c32toa function, it isn't used at this point.
3. Add calls to wc_Sha256Hash().

This removes the Sha256 structure off the stack and replaces it with the
direct call to the single-shot hash routine. Flattening the size of the
hashed data and hashing it in was removed as redundant.
2020-12-10 08:42:37 -08:00
John Safranek 28f5d750c9
More Options
1. Fix the key offerings in the echoserver and client with ifdef guards.
2. Fix a couple guards that weren't copy-pasted correctly.
2020-10-15 08:48:02 -07:00
John Safranek 4d5ce88cc9
More Options
Wrapped more items with guards to disable them if not usable.
2020-10-13 17:42:02 -07:00
Takashi Kojo 69791e1ff2 moving WOLFSSH_TEST guard into test.h 2020-10-11 11:54:39 +09:00
Takashi Kojo 28b8e745b1 fix for MQX 2020-10-11 06:53:46 +09:00
Jacob Barthelmeh 000b8544c6 add peek when waiting for data 2020-09-30 13:22:07 -06:00
John Safranek 39f30e25a4
Optional RSA
1. If RSA is disabled in the wolfCrypt build, the RSA related code
   in wolfSSH shall be disabled.
2. Examples will force themselves to use ECC if RSA is disabled.
2020-09-04 15:28:25 -07:00
John Safranek 132a0a52f6
Clean up a couple issues where building the code with a C++ reported build errors.
1. Typecasting the return from malloc.
2. strncpy() checking.
2020-08-31 09:31:47 -07:00
John Safranek e052108d0c
Merge pull request #271 from JacobBarthelmeh/scp
add callback and example for no file system with SCP
2020-08-27 09:23:17 -07:00
John Safranek e5c90b31e1
Merge pull request #273 from JacobBarthelmeh/testing
graceful shutdown with scp interop
2020-08-26 10:28:23 -07:00
Jacob Barthelmeh 217a7d6520 add callback and example for no file system with SCP 2020-08-26 10:22:56 -06:00
Jacob Barthelmeh 03fac18efd graceful shutdown with scp interop 2020-08-19 10:55:45 -06:00
John Safranek bfa3d5717c
SSH-AGENT Touchup
1. Add function to request the channel ID for the last message received.
2. Changed the send channel functions to use the self channel ID rather
   than the peer's channel ID.
3. Modified client and echoserver to use the channel ID for the agent
   to send messages.
4. Modify client to receive the entire message from the agent before
   trying to relay it to the peer.
2020-07-30 14:00:28 -07:00
John Safranek 2be3f15106
Remove the select.h header from examples if autoconf cannot find it. 2020-07-22 15:25:51 -07:00
John Safranek 2bf3d5bd87
SSH-AGENT (peer review)
1. Cleanup redundant includes.
2. Add comments to the Read Key function pair.
3. Remove my name as an example user.
4. Change ECC sig build arrays to use macro for size rather than
   bare number.
5. Remove empty if state for agent.
6. Added a couple needed NULL checks on allocs for the agent.
7. If unable to create an agent object on connect, disable agent use.
2020-07-22 14:48:45 -07:00
John Safranek 1250e1f9d8
SSH-AGENT
1. Added the agent support to the configure.ac script.
2. Updated the gitignore file to ignore any stamp-h file.
3. Changed to use the parsing functions and to make the parsing functions
   local.
4. Updates to multichannel.
5. Add -lutil only if needed.
6. Add configure checks for some headers that change based on target OS.
7. Bump version.
8. Test doesn't have real account or real key so agent doesn't test well.
2020-07-15 09:29:49 -07:00
John Safranek a996d1e1c2
Clean up some scan-build complaints. 2020-07-09 09:33:30 -07:00
John Safranek bd4ebe1a1d
Add check of return value of chdir(). 2020-07-08 15:23:26 -07:00
John Safranek 9c4739e3b2
Shell Worker
1. Add the echoserver shell support as a configure option.
2. Added some header and function checks to configure.
3. Use the new header and function checks to select includes
   in the echoserver.
2020-07-08 13:40:00 -07:00
John Safranek 49bd9ad518
Shell Worker
1. Fixed issue with the testsuite failing when the shell is enabled.
2. Added option to echoserver to force the echo behavior instead of
the shell when shell is enabled.
2020-07-08 12:02:27 -07:00
John Safranek 18ec6d927c
Shell Worker
Add customer contributed code to the echoserver for handling spawning a shell.
2020-07-08 12:00:32 -07:00
John Safranek df74449ea1
Auth Type None
1. Added a compile time option to allow None as an authentication type, mainly
for testing.
2. Added a couple updates for VxWorks builds.
2020-05-28 15:15:38 -07:00
Jacob Barthelmeh 9b7700cd6b adjust stream exit in scp case 2020-02-14 17:52:25 -07:00
Jacob Barthelmeh 84785ffe39 exit channel in echoserver before sending disconnect 2020-02-11 14:41:14 -07:00
Jacob Barthelmeh f1d00102ba fix for no old name build 2020-01-23 08:54:21 -08:00
Chris Conlon 83f8372458 update copyright to 2020 2020-01-03 15:16:47 -08:00
John Safranek e68e6620ce Update and clarify the ECC options to the echoserver. (Added -E to the list.) 2019-12-05 13:18:16 -08:00
John Safranek 1cc53ef330 removed a dead assign from the echoserver 2019-10-29 14:51:55 -07:00
John Safranek 8d2900cbab
1. Reflowed some whitespace.
2. Removed a redundant function that was an artifact of the rebase.
3. Added a reset of the retry count.
2019-10-24 11:10:28 -07:00
Takashi Kojo 55c0352a76 sendDisconnect at password reject, example code in echoserver 2019-10-24 10:55:05 -07:00
John Safranek 744a67e53b
Echoserver Maintenance
1. When printing server worker errors, print out the error string on the
stored error code, not the return value.
2. If the error is a socket error, don't try to send a shutdown message
to the peer.
3. Update the echoserver to close the connection cleanly when the SFTP
peer exits.
4. Added a function to check a WOLFSSL_CHANNEL if it is in eof.
2019-10-10 10:57:39 -07:00
JacobBarthelmeh 4a246abc76
Merge pull request #197 from ejohnstown/maintenance
Maintenance
2019-09-19 22:36:48 -06:00
John Safranek f59ea6f1ac Maintenance
Fix a typo in a string.
2019-09-11 10:54:26 -07:00
Takashi Kojo 968c1dd30c MSGID_REQUEST_FAILURE to response MSGID_GLOBAL_REQUEST 2019-09-08 07:27:32 +09:00
John Safranek ff6c167aad
Merge pull request #175 from kojo1/PW_retry
Password retry out
2019-07-01 16:46:42 -07:00
Takashi Kojo 3e58768b7e WS_USER_AUTH_E for wolfSSH_get_error 2019-06-29 13:02:21 +09:00
Takashi Kojo 58a768df29 WOLFSSH_USERAUTH_REJECTED 2019-06-29 12:37:34 +09:00
Takashi Kojo 153fa4798b WS_PASSWORD_RETRYOUT 2019-06-29 12:11:51 +09:00
Takashi Kojo 650bdf40b4 Pasword retry out 2019-06-26 13:27:14 +09:00
John Safranek 62f309c8ae
Merge pull request #170 from kojo1/GlobalReq
Global request
2019-06-18 10:18:46 -07:00
John Safranek 56616d3416 Public key authentication
1. Cleanup some debug printouts.
2. Add option to the echoserver and wolfSFTP client to use ECC keys or RSA
keys for user authentication.
3. Add option to the echoserver to use ECC keys for peer authentication.

Note, the user authentication type is still hardcoded in the library as
password. To use public key, need to update the authId in
SendUserAuthFailure().
2019-06-06 11:59:35 -07:00
Takashi Kojo faa9764753 add Global Request callback 2019-06-06 07:10:44 +09:00
Takashi Kojo fd4b2a69ee Global Request Failed case in echoserver callback 2019-06-06 07:10:44 +09:00
Takashi Kojo 86cbb26868 Add send Global Request 2019-06-06 07:10:44 +09:00
Jacob Barthelmeh fbbd3aa552 fixes for infer test 2019-04-30 13:02:08 -06:00
Jacob Barthelmeh 9f66a16ed5 add wc_ecc_fp_free to test treads for ecc caching 2019-04-09 15:46:11 -06:00
John Safranek 9aaebbb146 Update the copyright to 2019 2019-04-08 10:24:08 -07:00
Jacob Barthelmeh 9c73700f25 add SFTP tests to testsuite 2019-02-04 12:22:31 -07:00
Jacob Barthelmeh b8ae2fab59 add non blocking testing and better support for non blocking edge cases 2019-01-24 15:48:34 -07:00
Jacob Barthelmeh 58186064de clean up closing directory with SFTP 2019-01-23 17:47:20 -07:00
Jacob Barthelmeh df6955866d add sftp test cases, fix build for C89, add flag print out to echoserver 2019-01-23 12:02:35 -07:00
Jacob Barthelmeh ee85cc552e add more support for want writes on server side 2019-01-23 10:37:21 -07:00
John Safranek d13607d889 1. Add a defaultSftpPath to the server, with an API function.
2. Add option to echoserver for the SFTP path.
3. Fix issues with the Get() and Put() state machines with respect to
file access. Windows builds to use Win32 API. Windows builds do not use
fseek().
4. RecvRealPath() to use the new default path option if available. It
does not call getcwd() for Windows builds.
2019-01-22 11:38:28 -08:00
Jacob Barthelmeh 61a41b5b7b remove possible double free and fix non blocking echoserver 2019-01-17 17:22:41 -07:00
Jacob Barthelmeh 19a4ce6403 initial sftp server non blocking 2019-01-16 18:03:36 -07:00
Jacob Barthelmeh 0f77f67bdf check for scp + no server and have print outs for servers 2019-01-11 09:48:58 -07:00
John Safranek 7e9981c6ec Updated the main API, echoserver, client, and server for the NO_WOLFSSH_SERVER and NO_WOLFSSH_CLIENT options. 2019-01-09 14:25:50 -08:00
John Safranek 42675723e2 Fixed some issues with NO_WOLFSSH_SERVER builds. wolfSSH proper still
has the server code, but the wolfSFTP code excludes the server side.
2019-01-09 13:14:25 -08:00
John Safranek 2e92d9c1ee Add check if building echoserver to test.h so the static functions aren't included when building not-inline. 2018-12-14 13:58:47 -08:00
Jacob Barthelmeh fc92e85853 use int type for getting example args 2018-12-11 17:01:56 -07:00
John Safranek bbf818c587 also added test-locking group. tweaked misc.c, misc.h so they played nice with NO_INLINE 2018-09-20 16:19:25 -07:00
John Safranek cf959db741 Grouping test header functions into test-client, test-server, or
test-threading blocks. Adding flags to the examples and testsuite to
enable various test functions.
2018-09-20 16:10:13 -07:00
John Safranek a42075d823 TCP/IP Forwarding
1. Removed some unused macros in the configure.ac script.
2. Added option for enabling TCP/IP Forwarding.
3. Coalesced the option enable checks to one location in the configure script.
4. Removed redundant compile flags from the wolfSSH automake include.
5. Added a check of the BUILD_SCP option to leave out the wolfcsp file as needed.
6. Removed the redundant debug flags from the ax_harden macro since we add them at the configure level.
7. Modified the ax_harden macro to add the flags to AM_CFLAGS rather than CFLAGS.
8. Removed redundant AM_CFLAGS from the include.am that are adding them to their build's CFLAGS.
9. Replaced the have-wolfssl macro with AC_CHECK_LIB.
10. When adding per-target CPPFLAGS, add the AM_CPPFLAGS back in.
11. remove redundant call to wolfSSH_Init() from echoserver
12. Add runtime configuration of the session window size and max packet size.
13. Parse the TCP/IP direct connect flavor of the Channel Open message.
14. Save and release the host and origin addresses.
15. Added an example forwarding tool.
16. Move and rename the FIND_SELF and FIND_PEER constants.
17. Add planned functions ChannelSend, ChannelRead, ChannelExit, worker.
18. Add new function ChannelNext, which returns the next channel in the list.
19. Changed SendBuffered() from static to local so it could be used by the worker.
20. Separated creating a channel and sending an channel open request.
21. Added status code for pending open channel and for received data.
2018-08-31 11:21:42 -07:00
John Safranek f08628af2b Scan Build Fixes
1. In the echoserver, free the thread context before exiting app on error.
2. In the unit test, when checking the KDF, initialize the sizes to zero
and the pointers to NULL after freeing them.
2018-08-15 12:38:20 -07:00
John Safranek 8a010c168e
Merge pull request #81 from JacobBarthelmeh/testing
additional sftp and scp tests
2018-07-16 10:49:42 -07:00
Jacob Barthelmeh 2c4bca35e0 sftp test script added 2018-07-02 12:03:48 -06:00
Jacob Barthelmeh e47427c484 fix when reading directory
change from NO_WOLFSSL_DIR to NO_WOLFSSH_DIR

add chmod feature

changes for sftp port

file attributes and SFTP version

no exit on echoserver and revert scp
2018-06-29 09:19:40 -06:00
Jacob Barthelmeh 522d93add3 scp nucleus port
fix for uninitialised value

fix compile time warnings

scp only build and handle file size of 0

macro guard on sftp build

adjust directory pointer on desktop build

close connection still on fail and update derefrence of dir with nucleus

ssh only build for nucleus
2018-06-13 16:23:08 -06:00
Jacob Barthelmeh 6d434d0030 initial port to Nucleus
update example on Nucleus

add code sourcery IDE project

fix naming of IDE project files

clean up opendir for fail case

fix for build warnings

add fstat and fixes for nucleus port

update FALL_THROUGH case

add null terminator and more memory free's

fix for scan build warnings

fix warning of no return value

better bounds checking

better path cleaning

fix return values in header file

clean path before access

remove trailing delimiter from clean path
2018-06-13 09:44:54 -06:00
Jacob Barthelmeh dfdb2b1335 change return value for SFTP connection and clean up after rebase 2018-06-01 17:22:06 -06:00
Jacob Barthelmeh 2b934bd941 update error values and fix [l]stat status packet 2018-06-01 17:20:54 -06:00
Jacob Barthelmeh 0194784e6d use XSTRNCMP and remove debug code used during devel 2018-06-01 17:20:54 -06:00
Jacob Barthelmeh b467a3073c able to establish SFTP connection and start of adding commands (still in devel, has debug print statements)
refactor sending SFTP packets

try to make internal function names more clear, add comments, and update sftp example

add parsing names and most of attributes

add SFTP debug tag

add mkdir with SFTP

start of framework for get

add get command and keep track of working directory

base case of put command

basic sftp rename command

basic sftp rm command

initial basic rmdir command added

initial basic reget/reput commands

clean up absolute path to working directory

move location of sftp client app and more testing

add more comments and make code more readable

cast on values and add exit

adjust macro names and test make dist

adjust gitignore and macro names

gcc-7 build

revert nameListIdx increment to find ssh-rsa

more comments

fix for possible use uninitialized warning

initial SFTP accept

send status packet and start of realpath

server side mkdir

initial process of stat and lstat packets

initial processing of rmdir packet

basics for server handling SFTP get command

initial commit for server handling basic put command

initial handling of receiving remove packet

initial server handling of rename packet

initial implementation of handling directory packets

better checking on return values

set correct return value on successful read

additional sanity checks on user inputs

make send and read packet API name more clear

cast for warning building with clang
2018-06-01 17:20:54 -06:00