Commit Graph

234 Commits (c402947e3e5eff8368ab1e458014b831fd39c779)

Author SHA1 Message Date
JacobBarthelmeh b889645008
Merge pull request #101 from ejohnstown/small-fixes
Small Fixes
2018-09-11 15:20:48 -06:00
John Safranek 94626a5a2c Small Fixes
1. fixed bug in DoKexDhGexGroup() where ret was initialized to an error
2. The peer channel ID set during the connect needs to be saved for use later.
2018-09-11 14:01:59 -07:00
Jacob Barthelmeh 89a4c1015e add default SCP state of no direction set 2018-09-11 14:33:06 -06:00
John Safranek cf8b597250 Match Fix
When matching ID lists during the KEX Init, the client needs to swap lists.
2018-09-07 15:10:03 -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
Jacob Barthelmeh 634de0dc89 sanity checks on arguments 2018-08-31 16:56:55 -06: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
Jacob Barthelmeh 962ee5a06b fix for possible overflow with sanity check 2018-08-13 10:39:15 -06:00
Jacob Barthelmeh 5cbfa5e43f rename from different drives and list drives 2018-07-31 14:39:46 -06:00
John Safranek 419efeb59c
Merge pull request #80 from JacobBarthelmeh/sftp-nuc
fix when reading directory
2018-07-16 10:28:25 -07:00
Jacob Barthelmeh 8601a73026 sanity check that handshake information can be used 2018-07-02 15:23:14 -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 c7b2dfbf1d sanity check on arguments with debug 2018-06-14 17:17:07 -06:00
John Safranek fbdff7f186 a few whitespace fixes 2018-06-14 14:30:40 -07: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
Chris Conlon 37e3250164 fix scanbuild warning in SendChannelRequest() 2018-06-12 10:51:17 -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 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
John Safranek 5e67f2f027 Logging Update
1. Added new error codes for being unable to match ciphers with peer.
2. Whitespace updates in the error header.
3. Added disable flag to leave out the default log callback so user can supply own custom callback.
2018-06-01 15:00:40 -07:00
JacobBarthelmeh 99a8f00061
Merge pull request #67 from ejohnstown/fix-fuzz
Fix Fuzz
2018-06-01 13:36:00 -06:00
John Safranek a399617780 Fuzz Test Fixes
1. Fix a possible underflow error when reading the F value from the KEX DH Reply message.
2018-06-01 11:05:13 -07:00
Chris Conlon a6e8c59b97 scp modifications from embedded port 2018-05-31 13:45:55 -06:00
Chris Conlon 871a3fa719 update scp error codes and strings 2018-05-31 13:45:54 -06:00
Chris Conlon 2151229eb4 switch SCP_USER_CALLBACKS to WOLFSSH_SCP_USER_CALLBACKS 2018-05-31 13:45:54 -06:00
Chris Conlon bfd0d925d9 add NO_FILESYSTEM checks for scp build 2018-05-31 13:45:54 -06:00
Chris Conlon 6cbfb0e26d add scp server support for copy from server to peer 2018-05-31 13:45:54 -06:00
Chris Conlon 5a42829087 add scp server support for receiving individual files and recursive
directories
2018-05-31 13:45:54 -06:00
Jacob Barthelmeh ff9d88f2ee update name for SHA 2018-05-30 11:29:12 -06:00
John Safranek 37eb1bc59d Fuzz Test Fixes
1. Add a maximum packet size value and verify the read packet size.
2018-05-24 13:10:49 -07:00
John Safranek a528f57840 Fuzz Test Fixes
1. Added some more size checks for the signature parsing in `KexDhReply()`.
2018-05-24 11:36:12 -07:00
John Safranek 945703b791 Fuzz Test Fixes
1. A bounds check in `KexDhReply()` for fSz could be tricked into using an incorrect value and trigger a crash. Rearranged the inequality so it can't be tricked.
2. A bounds check in `GetUint32()` for the size of the length value being used could cause crashes. Rearranged the inequality so it can't be tricked.
3. Modified other similar bounds checks.
4. In `KexDhReply()` check the sigSz after reading.
2018-05-24 10:50:53 -07:00
Jacob Barthelmeh 9312179ec8 revert increment of nameListIdx for RSA connection 2018-05-18 09:45:40 -06:00
JacobBarthelmeh c2a3de1332
Merge pull request #59 from ejohnstown/test-errcode
Error Code Unit Test
2018-05-10 15:06:10 -06:00
John Safranek e1f242f451
Merge pull request #54 from JacobBarthelmeh/fuzz
check for overflow case
2018-05-10 14:02:35 -07:00
John Safranek c77345fc6c Error Code Unit Test
1. Add a unit test to check all error codes have strings.
2. Add public function to return the error string for an error code.
3. Fill in the missing error strings.
4. Fix an error string (change a "verify" to "create").
2018-05-10 13:55:59 -07:00
John Safranek 988c45b042
Merge pull request #58 from cconlon/scanbuild
fixes for scan-build warnings
2018-05-10 13:52:41 -07:00
Chris Conlon fb8b9d5ee3 scanbuild: fix for value is never read 2018-05-03 15:22:51 -06:00
Chris Conlon f87adbd82c scanbuild: fix for possible null pointer dereferences 2018-05-03 15:19:39 -06:00
Chris Conlon d2b96e9335 scanbuild: fix begin var value never read warning 2018-05-03 15:10:32 -06:00
Chris Conlon 634a356993 scanbuild: fix for sigKeyBlock.useRsa evaluating to garbage 2018-05-03 14:51:53 -06:00
Chris Conlon 6ff33be668 remove hard tabs, gcc 7.2.0 complains 2018-05-03 14:32:30 -06:00
Jacob Barthelmeh b4e02d77b1 check for overflow case 2018-04-10 13:19:39 -06:00
Jacob Barthelmeh a8ddc51331 buffer size check with sig verify 2018-04-09 13:56:22 -06:00
Jacob Barthelmeh f8a8fd51fa additional sanity checks on buffers 2018-04-06 16:30:54 -06:00
Jacob Barthelmeh 7ef8b02e90 extra check on buffer size before AES-CBC encrypt/decrypt 2018-04-05 15:16:57 -06:00
Jacob Barthelmeh e3228ee300 return value for verify mac result 2018-04-05 15:16:48 -06:00
John Safranek ed37ae9fd0
Merge pull request #48 from JacobBarthelmeh/pic32
initial port to pic32
2018-04-05 13:59:39 -07:00
Jacob Barthelmeh ce1ced27dc additional sanity checks 2018-03-30 17:05:04 -06:00
Jacob Barthelmeh ae70eb7b44 initial port to pic32 2018-03-30 10:33:25 -06:00
Chris Conlon 48590f6896
Merge pull request #44 from ejohnstown/scp-submission
SCP Contribution
2018-03-29 15:11:20 -06:00
Jacob Barthelmeh 3b6b70adeb update SHA256 name 2018-03-27 14:42:06 -06:00
John Safranek b578aadc6d SCP Contribution 2018-03-26 11:09:21 -07:00
John Safranek bbbc14ea6b Bug Fixes
1. Fix an incorrect memory free when releasing a bad WOLFSSH object.
2. Pass correct context to the I/O Send Callback function.
2017-12-01 12:04:56 -08:00
dgarske 83db50f7b6 Merge pull request #40 from ejohnstown/testsuite
Test Suite
2017-10-04 15:10:36 -07:00
John Safranek 911a00ae2c Channel Close
1. Renumbered a few error codes.
2. Added an error code for stream reading when the channel is closed during the read action.
2017-09-29 16:11:04 -07: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 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 b86bb31cdd 1. Added in the code needed for AES-GCM.
2. Deleted the unused wolfSSH_worker() prototype.
2017-07-11 08:56:21 -07:00
John Safranek be57ef6b95 1. Bump the version numbers.
2. Remove some unused option strings and constants. They may be
   distracting.
2017-07-06 16:24:18 -07:00
John Safranek 26642bfa2c Remove the TEST_GEX build option. The DHGEX key agreement is the
first desired algo for the server.
2017-06-12 12:24:57 -07:00
John Safranek da126bfa48 Refactor the KEX init code to delay the start of calculating the KEX
hash until the KEXINIT from the client is received.
2017-06-12 12:24:57 -07:00
John Safranek 97e27cb7be DH-GEX
Filled out the message handling for the DH-GEX additional messages. To use
the DH-GEX, one needs to add the flag TEST_GEX. It is still a WIP. The
handshake state machine needs a change and the start of the hash calculation
needs to wait until receiving the client's KEX INIT message and the hash
type for the handshake signature can be resolved.
2017-06-12 12:24:57 -07:00
John Safranek 1a81d66f78 Framing in DH-GEX. 2017-06-12 12:24:57 -07:00
John Safranek 4319cb069c Unified Hashing
1. Added support for the wc_Hash wrappers. Need to keep track of the
   hash being used.
2. Assumed SHA1 only, and modified everything to use the hash wrappers.
2017-06-12 12:24:57 -07:00
John Safranek fcf0e5c55d SHA-256 Hash Support
1. Expanded GenerateKey() to obey the hash type.
2. Added cases for SHA-256 to the KDF test.
2017-06-12 12:24:57 -07:00
John Safranek 3cb286b600 Fix bug where client initiated rekeying failed. 2017-06-12 11:58:39 -07:00
dgarske 687d13a349 Merge pull request #28 from ejohnstown/string-clean
Update a few debugging strings were copied and pasted.
2017-06-12 11:17:38 -07:00
dgarske 7eb1dad6ef Merge pull request #27 from ejohnstown/fix-getstring
Fix GetString
2017-06-12 11:17:17 -07:00
dgarske a0d40e0cd1 Merge pull request #26 from ejohnstown/banner-config
Update the banner
2017-06-12 11:16:11 -07:00
John Safranek 95a435055f Update a few debugging strings were copied and pasted. 2017-06-12 10:17:54 -07:00
John Safranek ff14fbaef8 In GetString() added a check for the size of the destination buffer. 2017-05-30 14:38:15 -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 3d79d4ffa3 Global Request Message
1. Added parsing of the Global Request message. Will log the request
   name string.
2. Send global request failure response if reply is requested.
(This was an issue with a particular SSH client.)
2016-11-11 12:00:22 -08:00
John Safranek c2480eb46c Add function to send Channel Success and Failure to the client when
receiving Channel Request messages, when requested.
2016-10-25 14:14:05 -07:00
John Safranek 6af24baf38 Fixed a missed set of wolfCrypt functions whose return values weren't getting checked. 2016-10-24 15:24:04 -07:00
John Safranek b76f376381 scan-build fix. clear a whole buffer before filling it before checking
with ConstantCompare().
2016-10-24 15:08:58 -07:00
John Safranek c802b331bd Check all return codes on wolfCrypt functions. 2016-10-24 15:03:54 -07:00
John Safranek c183000b93 1. Manage case where Client KEX Init arrives in same recv() as the
client version string.
2. Shrink the receive buffer after reading the client version
   string.
3. Resize the buffer correctly when needed data is already in the input
   buffer and grab the remainder as expected.
2016-10-24 13:42:58 -07:00
John Safranek ccc1101612 Fix where the result of sending a channel close was getting replaced
with success.
2016-10-23 16:14:17 -07:00
John Safranek bc9eff91d6 1. Rename function ProcessReply(), conflicts when linking against
wolfSSL not using cryptonly mode.
2. Send server version before expecting client version.
2016-10-23 15:43:08 -07:00
John Safranek 5b07c8cb1d 1. Parse the Channel EOF message.
2. Parse the Channel Close message, and reply with a Channel Close.
2016-10-23 14:46:34 -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 41ec11e6ab Rekeying Update
1. Flushing out the keying state machine, taking it out of the accept
   state machine.
2. Changed the HandshakeInfo record to be something that can be
   recreated post-initial connection for rekeying.
3. Fixed the name of a previously unused size variable.
4. Moved some constants around.
2016-10-16 20:25:24 -07:00
John Safranek c564550999 Automatic Session Rekeying
1. Add stub rekey trigger function.
2. Add new default highwater callback that calls the rekey trigger
   function.
3. Rename the highwater level as "mark" rather than "count".
4. Add a flag to call the highwater callback once, cleared when the
   txCount is cleared when sending new keys message to peer.
5. Add new state machine for key exchange.
6. Start massaging the accept state machine for new KEX machine.
7. Update some default sizes, and replace magic numbers with named
   constants.
8. Scale back the accept state machine to add in the KEX state
   machine.
9. Capture the client version string and the server's KEX init message
   for rekeying.
10. Add compiler flag to allow "none" as a user auth method.
2016-10-16 15:16:24 -07:00
John Safranek b3ee5cd381 Send channel window adjust update when the receive buffer
has processed at least half of its available space. By
default, the receive window is 1MB, and the window size is
increased every 512kB.
2016-10-16 12:11:50 -07:00
John Safranek b6cda842e8 add function to notify peer of window size adjustment 2016-10-14 12:45:09 -07:00
John Safranek d9808cec31 tweak the peerWindowSz updating and logging 2016-10-14 12:45:09 -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
John Safranek 04e361a558 1. fix scan-build warning on ConstantCompare
2. fix visibility label typos
2016-10-07 10:04:04 -07:00
John Safranek 6561da9ce2 Updates to the data highwater marks for a callback. 2016-10-04 09:55:09 -07:00
John Safranek 7c8801409c Move the WOLFSSH and WOLFSSH_CTX initializer and free functions from
ssh.c to internal.c.
2016-10-04 09:55:09 -07:00
John Safranek 73e4e58795 1. Regroup the session keys into a separate structure.
2. Separate sets of keys for client and server.
3. Store generated keys in handshake info record.
4. Copy session keys over when sending and receiving the
   New Keys message.
2016-10-04 09:55:09 -07:00
John Safranek 30c4a32611 1. Add accessors for session data high water mark.
2. Check transmit and receive against high water mark and log.
2016-10-04 09:55:09 -07:00
JacobBarthelmeh 1039cb9d43 Merge pull request #13 from ejohnstown/more-cleanup
More Cleanup
2016-07-22 10:31:34 -06:00