Commit Graph

78 Commits (53862974299aad1c878fb8a33e1b7333d1392a4a)

Author SHA1 Message Date
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 d2a1c2ab1b Non-blocking fix
1. Added a non-blocking socket option to the client.
2. Added a non-blocking socket option to the server.
3. Added support for select to the test header.
4. Updated the usage strings so they are formatted the same.
2018-11-21 11:38:33 -08:00
John Safranek b97b237695 Static Analysis Fixes
Ran the clang static analysis and infer and fixed most of the reported
items. There were many that infer found that looked like false
positives.
2018-11-15 13:28:42 -08: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 8a13a829df scan-build fixes
1. Didn't initialize errFd before calling select() in wolffwd.
2. Wasn't checking the accepted appFd in wolffwd.
3. For the test_KDF() unit test, a call to ConvertHexToBin() could succeed and leave eKey NULL, and pass it to memcmp().
2018-09-13 17:19:39 -07:00
John Safranek dbd59aea4a TCP/IP Forwarding
1. Removed the "direction" flag from the wolffwd example. Only works in one direction at this point.
2. Added the GPL header to the wolffwd example source.
3. Removed the stray prints from the wolffwd example.
4. wolfFwd example fails out if any of the sockets report failure.
2018-09-12 15:30:18 -07:00
John Safranek cbeb2cf566 TCP/IP Forwarding
1. Fixed an issue with the FD_SET copy.
2. Fixed some memory issues discovered with Valgrind.
2018-09-04 15:17:14 -07:00
John Safranek dfbfe8d93f TCP/IP Forwarding
1. Removed an unused data type and unused functions.
2. Do a couple fixes for scan-build.
2018-08-31 14:26:56 -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 73bcd5c95a external test script 2018-07-02 17:07:51 -06: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
JacobBarthelmeh 0fc6f343b0
Merge pull request #72 from ejohnstown/static-fixes
fix a handful of clang static analysis warnings
2018-06-07 09:38:46 -06:00
John Safranek 8477c4acd6 fix a handful of clang static analysis warnings 2018-06-06 15:04:59 -07: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
Chris Conlon 8b6ac82158 update include.am files for scp 2018-05-31 13:45:54 -06:00
Chris Conlon 62d00eeaf9 update scp comments, cleanup 2018-05-31 13:45:54 -06:00
Chris Conlon 6a22968b87 enable compilation of example server by default 2018-05-31 13:45:54 -06:00
Chris Conlon f37c7224fb fix threading in example server 2018-05-31 13:45:53 -06:00
Chris Conlon c0cb237881 scanbuild: fix bufName dead assignment 2018-05-03 14:56:27 -06:00
Jacob Barthelmeh bb668fe743 use of buffer keys in examples with no filesystem 2018-03-30 10:45:24 -06:00
John Safranek 16b4a31cfb Test Suite
1. Add an automated test suite.
2. Refactor the existing test and example code to be better components for the test suite.
3. Rename some of the internal functions used by the examples and test suite.
4. Echoserver now only handles one connection at a time, has option to exit after single connection.
5. Echoserver can do the port zero trick for the test suite.
6. Some whitespace changes.
7. Added a `(void)` to a variable to hush an unused assignment warning.
2017-09-29 13:48:40 -07:00
John Safranek 65fb16ddc4 Client
1. Added support to the library for clients.
2. Added example client.
3. Added VS solutions for building client example.
4. Added ECC client keys. Renamed existing keys.
5. Since defunct server is copy of echoserver, updated it.
2017-09-25 14:45:03 -07:00
John Safranek 7e08469794 IDE DLL Builds
1. Moved some of the files around.
2. Updated the readme.
3. Added a property file with a set of user macros to point at wolfSSL include and build directories.
4. Updated all the project files to use the new user macros.
5. Add guard around including options.h in the echoserver.
2017-09-15 16:46:14 -07:00
John Safranek e471635373 IDE
1. Added DLL builds.
2. Cleaned up some of the build configuration.
3. Updated the README files for building.
4. Renamed the function ProcessBuffer() with a prefix due to a conflicting name with wolfSSL.
5. Added test.h to include.am.
6. Moved the user_settings.h for wolfSSL into the wolfcrypt directory.
7. Changed the echoserver so that it binds to INADDR_ANY.
2017-09-13 15:33:23 -07:00
John Safranek 1498bc5409 IDE Support
1. Added Windows Visual Studio build solution. Includes projects for:
 * wolfSSH static library
 * echoserver
 * unit-test
 * api-test
 * 32- and 64-bit debug and release builds for all
2. Made necessary tweaks including adding some wrapper functions so the code compiles for both Linux/macOS and Windows.
3. Fixed a bug in the KDF test where the output buffer wasn't updated when SHA-256 was added.
4. Added the fallthrough attribute for GCC7.
5. Replaced all uses of `uint8_t`, `uint16_t`, and `uint32_t` with the wolfCrypt provided `byte`, `word16`, and `word32`.
6. Split the new channel function into new and init.
7. Added some ECC keys for authentication testing.
8. Moved some functions and includes around.
9. Removed the keying state machine and replaced with a flag.
10. Added rekey trigger if the client sends *CTRL-F* to echoserver.
11. Moved the sequence number increase outside `CreateMac()`. Incremented if the packet was successfully created. This way the sequence number is incremented when using AES-GCM.
12. Removed the redundant function `SendText()`.
13. Renamed the `clientId` related functions and data members to `protoId` to keep things role agnostic.
14. Changed all references of `clientKey` and `serverKey` to `keys` and `peerKeys`.
15. Updated `GenerateKeys()` to generate `keys` and `peerKeys` appropriately based on the endpoint side.
16. Added the wolfSSL style _test.h_ file to group shared example functions in one place.
17. Changed the echoserver to be similar to wolfSSL's where the code may be included without the main function in another executable.

Note:
This commit is a squash of more than a dozen commits. IDE support was added to the client branch, but the client branch is on hold. There were many changes in the client branch that are needed going forward. The code at the head of the client branch was copied over to the IDE branch, and the client code either deleted or removed from the build.
2017-09-12 14:42:23 -07:00
John Safranek 1d594eba1f ECC (#35)
* Renamed the server key files to indicate they are rsa keys.
* Add ecc key files for the server.
* Move ProcessBuffer from ssh.c to internal.c.
* Remove #includes for headers from files that are not used.
* Added support for KEX algorithms: ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521
* Updated readme
* Added support for the public key algorithm ecdsa-sha2-nistp256.
* Added support for public key algorithms ecdsa-sha2-nistp384 and ecdsa-sha2-nistp521.
* The Key Algorithm list for the KEX picks a single value to offer based on the private key used.
* Added private keys on curves nistp384 and nistp521. The curve nistp256 is used as the default.
* Added the new ecc keys to include.am
2017-07-14 12:24:38 -07:00
John Safranek 686184d34d Update echoserver for an option to allow multiple connections
or single connections to ease memory testing.
2017-07-11 09:33:33 -07:00
John Safranek 408ce5653d 1. Echoserver to catch Ctrl-E to provide session statistics.
2. Add wolfSSH_GetStats() to return session statistics.
3. Echoserver server_worker threads get a context with their
   wolfSSH session, an ID number, and socket fd.
2017-06-12 16:23:00 -07:00
John Safranek bcbf807fa0 Modify echoserver to have a stats key in addition to the
cancel session key.
2017-06-12 16:22:29 -07:00
John Safranek a4285571f4 Update the banner
1. Add the banner to the WOLFSSH_CTX.
2. Moved the canned banner to be a debug option.
3. Default the banner to NULL of zero length.
4. Use the banner stored in the WOLFSSH_CTX.
5. Add an accessor to set the banner to a C string.
2017-05-30 14:25:41 -07:00
John Safranek 184b2218d4 Rekeying Update
1. Add the Trigger Rekeying function.
2. Fixing the keying state machine.
3. Modify echoserver for rekeying.
2016-10-21 13:40:35 -07:00
John Safranek da4b19524d RSA Private Key Generation Wrapper Function
1. Implemented the RSA key generation wrapper function.
2. Rearrange the unit test code.
3. Added RSA key generation wrapper function to unit test.
4. Removed certificate load from echoserver.
5. Not using certificates, removed the functions and storage.
6. Removed unused certificate files.
7. Renamed certs directory as keys.
8. Removed the example server from the build for now.
9. Created new server key with the RSA key generation function.
10. Add IDs for public keys for keygen use.
11. Whitespace cleanup.
2016-10-13 10:02:03 -07:00
JacobBarthelmeh 7952fdf035 Merge pull request #17 from ejohnstown/highwater
Transfer Highwater Mark, Session Key Refactoring
2016-10-05 17:07:10 -06:00
John Safranek 569890067a Added a transfer highwater callback to the echoserver that
prints that the highwater mark was hit and doubles the
highwater mark value. It is disabled by default. To use,
when configuring add the CPPFLAG "DEFAULT_HIGHWATER_MARK".
For example, `CPPFLAGS=-DDEFAULT_HIGHWATER_MARK=128`
2016-10-05 14:56:21 -07:00