Commit Graph

342 Commits (aa7330f7fcacae2ce7f5af91ceac2a3c14b79d04)

Author SHA1 Message Date
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
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 5a8642673b free scp file buffer if existing or upon error when reading 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 62d00eeaf9 update scp comments, cleanup 2018-05-31 13:45:54 -06:00
Chris Conlon 912afe9210 scp scan-build fixes 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
Aaron Jense 04fe344d1d fixed possible WLOG typo 2018-05-24 13:08:38 -06: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 ed2f9c6cbe add port to test.h file 2018-04-05 13:21:23 -06: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 fe3f19190e Merge pull request #43 from ejohnstown/logging2
Logging
2017-10-04 15:10:52 -07:00
dgarske 83db50f7b6 Merge pull request #40 from ejohnstown/testsuite
Test Suite
2017-10-04 15:10:36 -07:00
John Safranek e2fc544eac Logging
Removed the `INLINE` tag from the accessor `wolfSSH_LogEnabled()`, it was causing trouble under Windows.
2017-10-04 14:14:00 -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 fe14efc62d Logging Update
1. Added a logging function that always works whether or not debugging is enabled.
2. Modified the WLOG macro to always be built in, but disables cleanly.
2017-09-29 14:15:38 -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 a48a13e6ba IDE
1. Added a user_settings.h file to be used with building wolfSSL.
2. Removed misc.c from the wolfSSH library project.
3. Added the WOLFSSL_USER_SETTINGS define to the wolfSSH library project.
4. Replaced vsnprintf() and localtime_r() with macros to use the correct functions for Win32 builds.
5. Replaced the misc.c warning with the VS style of doing it if building for Win32.
6. Defined USE_WINDOWS_API if _WIN32 is set.

Note: The wolfSSH library builds in 32-bit Debug mode. To do so, you need to add the directory holding the wolfSSL headers to the AdditionalIncludeDirectories list.
2017-08-31 11:02: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 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 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 718a4f4b40 cleanup accept state machine 2016-10-24 11:51:42 -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 919ed1f944 Optionally compile keygen.c. 2016-10-14 13:16:07 -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
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 2cf5ad63ac wolfCrypt
1. Add call to wolfCrypt_Init() to wolfSSH_Init().
2. Modify have_wolfssl.m4 to check for wolfCrypt, not wolfSSL.
2016-10-05 10:55:30 -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
John Safranek 2c3d78b4a6 Change misc.c error to warning and exclude the misc.c code from being compiled. Most people include all .c files and by default inlining is allowed, which in turn causes an #error in misc.c and it must be excluded. Since we know its already been properly included there is no reason to throw error here. Instead, show warning and exclude code in .c file.
Copied from wolfSSL pull request #521.
2016-08-09 10:44:33 -07:00
JacobBarthelmeh 1039cb9d43 Merge pull request #13 from ejohnstown/more-cleanup
More Cleanup
2016-07-22 10:31:34 -06:00
John Safranek c8da16cbe8 use the proper memcpy alias for wolfSSH 2016-07-22 09:30:02 -07:00
John Safranek 2e1744265b more return code checking 2016-07-21 20:07:29 -07:00
John Safranek f865ad2487 move the primitive data decoders, use them more 2016-07-20 19:57:54 -07:00
John Safranek 1a278fe713 update copyright dates and licensing to GPLv3 2016-07-19 13:44:02 -07:00
John Safranek bebe452d12 removed goto from processing the public key authentication 2016-07-19 11:03:37 -07:00
John Safranek 4041ecf408 Updated many functions with better error checking. 2016-07-18 21:21:42 -07:00
John Safranek 1e77d1595b 1. Sending data to a channel needs to use the peer channel ID.
2. Added a default peer channel ID for transmits.
3. Refactor the SendChannelData and SendChannelOpenConf functions.
2016-07-18 14:19:20 -07:00
John Safranek 79c8a503c4 1. Added some more return code checking and returning.
2. Look up channels in the channel list when processing
channel based messages rather than assuming the first
channel in the list.
2016-07-15 14:51:09 -07:00
John Safranek 1389df80bc initial multi-channel support 2016-07-14 22:46:06 -07:00
John Safranek 9ebcd5c44a fix trying to decrypt messages where the body fits in with the length block 2016-07-14 15:42:23 -07:00
John Safranek 525a8858c5 Add return code when the peer window is too small on a send. Echoserver wasn't properly checking the return code on the stream receive. 2016-07-14 14:47:30 -07:00
John Safranek a2c5e8e793 React to invalid username with a regular auth failure, nothing fancy. Fancy was causing a crash. 2016-07-14 13:53:23 -07:00
John Safranek d101f1d537 fix a few stray memory leaks 2016-07-14 12:58:37 -07:00
John Safranek 0994a1816d fix a couple initialization issues found in scan-build 2016-07-13 23:53:13 -07:00
John Safranek cf2cb5f67b deleted extra print statements 2016-07-13 15:11:33 -07:00
John Safranek 4dc3c56a88 fixing RSA public key user auth, failover to password 2016-07-13 15:11:33 -07:00
John Safranek a1e07e3161 1. Added extra debugging logs to the user authentication.
2. Reject invalid user names.
3. Fix the readme with regards to the public key log in testing.
2016-07-13 15:11:33 -07:00
John Safranek de477fcc14 remove stray peerMacSz printf 2016-06-22 14:48:26 -06:00
John Safranek 84b1fd3d0e added HMAC-SHA2-256 2016-06-22 11:26:18 -06:00
John Safranek 15023f54b6 verify the correct public key type and signature type during auth 2016-06-17 15:54:24 -07:00
John Safranek 89d92bb886 refactor userauth 2016-06-17 14:23:20 -07:00
John Safranek a275ac59f0 1. Flushed out the authentication callback.
2. Added public key authentication.
2016-06-17 14:23:20 -07:00
John Safranek a744dcc540 refactor DoPacket to pass the correct data pointer and data index update 2016-06-17 14:23:20 -07:00
John Safranek 911ac8c433 1. Adding parsing of publickey authentication data.
2. Changed logging of authentication requests.
3. Reply to "none" authentication types with a failure that
   has the supported auth type list.
4. Fixed bug where passing payload to the DoUserAuthRequest wasn't
   getting the correct payload length.
5. Reordered a couple utility functions.
2016-06-17 14:20:59 -07:00
dgarske 8e3e5a1bf5 Merge pull request #3 from ejohnstown/fixes1
Fixes1
2016-06-17 11:29:01 -07:00
John Safranek 49be153c61 verify the mac even if the decrypt fails 2016-04-15 10:25:04 -07:00
John Safranek bda5870fc5 more checking of return codes 2016-04-06 15:48:37 -07:00
John Safranek 597eb9e1ca when freeing ctx resources, use the correct heap 2016-04-06 10:46:14 -07:00
John Safranek 5eb8b8111a Use wolfssl/wolfcrypt instead of cyassl/ctaocrypt, add wc_ prefix to wolfcrypt function calls. 2016-04-05 15:42:38 -07:00
John Safranek 59590e28f3 scan-build fixes:
1. Disconnect string was unused in non-debug builds.
2. Check return code from decrypting the length block.
2016-04-04 09:32:49 -07:00
John Safranek 0386a3c50f move shared inline functions to misc file. add configure option to disable inline functions. 2016-04-01 14:40:22 -07:00
John Safranek 1566cf82a0 added parameter checks to GenerateKey and an option to print out the session secrets for debugging 2016-04-01 10:42:18 -07:00
John Safranek 564506c038 Make KDF publically accessable. Add KDF test using keys from two successful connections. 2016-03-31 12:10:44 -07:00
John Safranek 4982638781 add ForceZero() and ConstantCompare() to the code 2015-12-09 16:01:23 -08:00
John Safranek 793a19857f update copyright banner on sources 2015-12-08 13:45:20 -08:00
John Safranek 7a616ffbf5 fix warning about always true comparison 2015-12-08 12:51:43 -08:00
John Safranek f9fa42e244 1. added in the stream receive function
2. example uses the new receive function
2015-01-14 10:53:33 -08:00
John Safranek d83d9356d2 fixed reference to wrong variable in wolfSSH_stream_send() 2015-01-13 09:35:43 -08:00
John Safranek 21e73bdf88 added some function enter logging 2015-01-07 14:58:19 -08:00
John Safranek b548720a9a 1. added in the stream send function
2. example uses the new send function
3. added in window size update receipt
4. tweaked the accept state machine to actually finish
2015-01-07 13:49:01 -08:00
John Safranek 6975448d1b 1. Fix debug output for DoChannelOpen().
2. Added support for the Channel Request messge.
3. Added support for the Channel Data message.
4. Example server works like a very crude echo server.
2014-12-29 16:43:09 -08:00
John Safranek dab2b248d5 1. Update the accept state machine to account for all the recent
messages.
2. Add sending the open channel confirmation.
3. Starting to refine the logging.
2014-12-29 15:11:04 -08:00
John Safranek 4351b91ddf Starting adding the encrypted bytes tx/rx counters 2014-12-29 09:19:36 -08:00
John Safranek f60895000a Begin refactoring the packet parsing. 2014-12-26 11:28:30 -08:00
John Safranek 0455fe43dd 1. Commented out some of the distracting debugging output.
2. Accepts the none client authentication.
3. Starts to parse the channel open message.
4. Starting to handle channels.
2014-12-24 14:36:06 -08:00
John Safranek 38e51c45c8 1. Framing in the user authentication messages.
2. Removed some outdated/incorrect comments.
3. Removed some of the debugging output clutter.
4. Fixed bug when trying to add multiple messages to a single packet.
2014-12-19 10:59:45 -08:00
John Safranek 89e6d77e10 Updates to wolfSSH_accept()
1. Moved SendNewKeys() to SendKexDhReply() so both messages are sent
in the same packet.
2. Accept state machine checks return codes on Send functions.
3. Added a couple new states for some of the Send functions.
2014-12-18 16:01:32 -08:00
John Safranek d0c6768d5d fix bug with skipping received unimplemented messages 2014-12-18 15:17:07 -08:00
John Safranek 62d916d016 update buffer index when receiving the service request 2014-12-18 14:57:42 -08:00
John Safranek 4a0f5de683 removed some of the excess logging 2014-12-18 14:47:53 -08:00
John Safranek 9776e237fa SendServerVersion should have returned success not fail 2014-12-18 14:25:54 -08:00
John Safranek adcf881278 fix bug in DoPacket when simplifying payloadSz 2014-12-18 13:58:13 -08:00
John Safranek 10844bfc51 make sure code lines stay within 80 col standard 2014-12-17 15:54:33 -08:00
John Safranek b1e32737c2 Framing in the service request messages 2014-12-16 19:09:40 -08:00
John Safranek 6c49caf9ab Added packet encryption and adding MAC 2014-12-16 13:17:18 -08:00
John Safranek 2ae2d6dcdf 1. Fixed bug with GenerateKey() that didn't take into account secret padding.
2. Fixed bug in DoPacket() that didn't increment the peer's packet sequence.
3. Fixed bug in Decrypt() where the AesCbcDecrypt case dropped through into error.
4. Refactoring the accept state machine.
5. Separating client and server block and MAC sizes.
6. Added client MAC checking.
7. Fixed bug where algorithm picking preferred server order over client.
8. Fixed bug where the algorithm list matching was checking out of bounds.
2014-12-10 21:01:22 -08:00
John Safranek 71bcd94c5f 1. Starting to add in the Decryption and MAC Verification.
2. Fixed bug in getting the entire packet from the socket.
2014-12-08 21:59:21 -08:00
John Safranek 1c902a641e encode signature without CyaSSL's compatibility layer, using wolfCrypt only 2014-12-05 17:37:39 -08:00
John Safranek 156c3bd7a5 tweak to hide the disconnect reason string output 2014-12-05 14:51:20 -08:00
John Safranek bf0133c740 added decode/encode support for base messages 2014-12-05 12:17:27 -08:00
John Safranek 2d959d7bea 1. Generates the session keys.
2. Starting to tie into the bulk encryption and MAC.
2014-09-12 21:00:16 -07:00
John Safranek 917c6a84c4 Clean up build warnings under Linux 2014-08-14 11:46:23 -07:00
John Safranek c142bc305c fix the exchange hash signing issue 2014-09-03 22:48:50 -07:00
John Safranek 852016d8c5 finally calculates the hash correctly, but isn't signing correctly. :/ 2014-09-03 13:50:23 -07:00
John Safranek ad17306d96 correctly builds the packet, hash still wrong 2014-09-02 23:21:17 -07:00
John Safranek 8be65978bb 1. Added compile flag to show the shared master secret.
2. Fixed bug where the client DH e-value wasn't being used.
2014-09-02 11:52:08 -07:00
John Safranek 6be28d3437 fix buffer overflow when generating keys 2014-09-02 11:38:18 -07:00
John Safranek c82b4bb3d8 server sends KexDhReply 2014-09-01 19:11:38 -07:00
John Safranek 21db2e1036 almost have KexDhAgree completed 2014-08-31 23:56:27 -07:00
John Safranek a9ecef7352 90% of KEXDH done 2014-08-28 14:10:02 -07:00
John Safranek b72c16f8e9 Creates and sends the server KEXINIT msg 2014-08-26 15:43:59 -07:00
John Safranek cfb7b90b32 Fill in the server's KEX Init message payload 2014-08-25 09:58:54 -07:00
John Safranek 67bb1cdbdc 1. Adding the packet building and send functions.
2. Fix RNG initializer.
2014-08-23 23:07:12 -07:00
John Safranek 5fb59b3006 Rename function SendBuffer() as SendBuffered() to match wolfSSL. 2014-08-21 14:41:05 -07:00
John Safranek 106e349a23 fix wrapper macro usage 2014-08-21 10:55:46 -07:00
John Safranek d1d9c3da81 Added an RNG to the WOLFSSH object 2014-08-21 10:50:30 -07:00
John Safranek a430fc7e27 Update the MAC and Block size based on the algo IDs. 2014-08-20 16:56:16 -07:00
John Safranek 9bb2576136 Parse out the KEX algo lists. 2014-08-20 11:47:42 -07:00
John Safranek 1c0ff7b151 Decode the KEX Init bits from the peer. 2014-08-18 20:41:53 -07:00
John Safranek 7e2674c29a 1. Added test certificate and private key.
2. Added code to load single certificate and private key from buffers.
2014-08-15 14:20:42 -07:00
John Safranek f4b1908b17 Refactor the constants. 2014-08-15 11:37:00 -07:00
John Safranek e6bfa8c131 1. Removed the peerId from handshake record. It'll be added to the key
hash directly.
2. Framing in the private key and certificate loading functions.
2014-08-14 22:34:55 -07:00
John Safranek 0feaaab922 Moved the handshake data into its own structure so it can be freed when
the handshake completes.
2014-08-13 19:31:59 -07:00
John Safranek f07f623ad6 Modified the input and output buffers, made them members of the
session object, rather than pointers.
2014-08-12 17:21:13 -07:00
John Safranek 8cb5fea384 1. Added a description comment to each C and H file.
2. Updated the FSF address in the comments.
2014-08-11 16:19:11 -07:00
John Safranek bf052f42c9 Added an endpoint type, client or server, to the wolfSSH context
constructor. (For future use.)
2014-08-11 14:45:03 -07:00
John Safranek 490fd75fa9 1. Moved error number to string conversion to internal.c
2. Removed file error.c
3. Added error code accessor for WOLFSSH objects.
4. Added error string accesor for WOLFSSH objects.
5. Cleaned up the I/O callback prototypes.
2014-08-11 14:29:06 -07:00
John Safranek a96a764bc0 Moved functions to internal.c that belong there. 2014-08-11 14:03:00 -07:00
John Safranek e03a1011d2 1. Removed some unneeded functions and data types.
2. Added some new data for sequence numbering and for key exchange.
2014-08-11 11:53:45 -07:00
John Safranek b331ff9cba fixed buffer issue on receive 2014-07-31 11:28:14 -07:00
John Safranek 1d2e1af069 filling in code 2014-07-28 07:12:54 -07:00
John Safranek 1945b2dddd added the Buffer 2014-07-07 17:36:57 -07:00
John Safranek eb82d2bf28 Adding code 2014-07-01 17:27:47 -07:00
John Safranek 997013f210 Adding code 2014-07-01 17:27:29 -07:00
John Safranek 749cb6ff90 initial set of files 2014-06-24 14:48:08 -07:00