159 Commits

Author SHA1 Message Date
Michael Rash
d85c2e74ce [libfko] set ctx=NULL after fko_destroy(), add NULL check for encrypted msg pointer in fko_new_with_data() 2013-05-12 20:53:22 -04:00
Michael Rash
7b3c854a02 [libfko] added context initialized check to fko_decrypt_spa_data() 2013-05-12 20:49:00 -04:00
Michael Rash
6d0f970b34 [libfko] bug fix to apply ctx initialization check before attempting to use ctx->message_type in fko_set_spa_client_timeout() 2013-05-12 15:02:31 -04:00
Michael Rash
282b0198ec [libfko] changed 'state' context element to 'int' type to fix a 'extra high-order bits' bug found by Coverity 2013-05-09 22:43:05 -04:00
Michael Rash
72e4edbf6a [libfko] fixed remaining sizeof() usage bug in SHA256 code found by Coverity 2013-05-09 22:14:06 -04:00
Michael Rash
62edf09101 [libfko] fixed remaining buffer constraints in lib/hmac.c code found by Coverity 2013-05-09 22:13:25 -04:00
Michael Rash
9046acaf22 [libfko] memory leak fixes found by Coverity 2013-05-09 21:56:13 -04:00
Michael Rash
8c09d38941 various sizeof() usage and type bug fixes found by Coverity 2013-05-09 21:17:27 -04:00
Michael Rash
9f9bbcbcdd fixed several resource leak conditions found by Coverity 2013-05-09 17:15:58 -04:00
Michael Rash
3a1efd9321 [server] fixed several (non-exploitable) overflow conditions found by Coverity 2013-05-08 23:29:06 -04:00
Michael Rash
8d980ae686 remove dead code caught by Coverity 2013-05-07 23:02:49 -04:00
Damien Stuart
15d9c6197b Fixes to get hmac_support and 2.5 changes working for the Windows lib and client builds. 2013-05-05 13:20:20 -04:00
Michael Rash
f02cc0ddd2 Added HMAC support to GPG encryption modes, closes #58 2013-04-22 20:45:59 -04:00
Michael Rash
08c9cc0938 HMAC function rename for consistency
Make sure that HMAC function names conform to previously established get_*,
set_* naming convention.
2013-03-29 20:42:44 -04:00
Michael Rash
6ecf6514c9 Enforce Rijndael and HMAC key length maximum sizes
This commit fixes a couple of overflow conditions for Rijndael and HMAC keys
that are larger than anticipated maximums.  In the case of Rijndael, PKCS#5 1.5
is supported up to key sizes of 32 bytes or smaller (and maintains compatibility
with OpenSSL, and future versions will support PKCS#5 2.0 (PBKDF2) while allowing
for larger key sizes.  HMAC keys may be up to 128 bytes even for digest
algorithms such as SHA256 that have block sizes that are smaller than this.
2013-03-24 21:04:18 -04:00
Michael Rash
247edec004 minor hmac prototype update to add const qualifier 2013-03-17 22:48:29 -04:00
Michael Rash
c7b5611fa4 Merge remote-tracking branch 'fjoncourt/hmac_support' into hmac_support
Significant merge from Franck Joncourt to add the ability to save command line
args to ~/.fwknoprc stanzas.  This merge is in support of #4.

Conflicts:
	lib/fko_util.c
	lib/fko_util.h
2013-03-17 21:34:23 -04:00
Michael Rash
253ccb7cea added encryption type/mode and message type string representations for FKO context diplay output 2013-03-14 22:26:44 -04:00
Michael Rash
fe22423a44 [libfko] bug fix to maintain OpenSSL compatibility for HMAC keys longer than associated block size 2013-03-12 22:17:41 -04:00
Michael Rash
bf6cc6c605 --key-gen bug fix to allow --key-len and --hmac-key-len values to apply to generated key lengths 2013-03-11 23:02:07 -04:00
Michael Rash
343bd449d4 HMAC MD5 bug fix to ensure to set the MD5 block length to 64 2013-03-10 21:59:39 -04:00
Michael Rash
3598fc7d7d added missing hmac_md5() function to hmac.h 2013-03-10 18:56:19 -04:00
Michael Rash
c5b5cba729 Added HMAC MD5 support (need test suite validation still) 2013-03-10 16:30:06 -04:00
Michael Rash
6882ac57ec add HMAC-SHA1 support 2013-03-10 14:56:39 -04:00
Michael Rash
7821e83dfc Merge branch 'hmac_support' of github.com:mrash/fwknop into hmac_support
Conflicts:
	client/fwknop.c
	lib/fko_hmac.c
2013-03-10 14:32:07 -04:00
Michael Rash
22dde8eb35 SPA with HMAC SHA256 and SHA384 now works
This is a fairly significant commit that lays the groundwork for getting
selectable HMAC modes working for both the client and server.  One libfko API
change was required so that the hmac_type is passed into fko_new_with_data().
This allows the server to set the hmac_type via access.conf stanzas.  The
effort in this commit will be extended to allow HMAC MD5, SHA1, and SHA512
also function properly.
2013-03-10 14:26:05 -04:00
Damien Stuart
6fa3be393c Renamed fko_set_hmac_type to fko_set_spa_hmac_type. Incorporated libfko changes and additions to the fko python module code. 2013-03-10 13:21:24 -04:00
Michael Rash
6f45b2c3b1 added HMAC SHA384 and SHA512 support, bug fix to allow shorter HMAC key lengths than associated digest block size 2013-03-09 23:27:08 -05:00
Michael Rash
6741cfc22b convert HMAC functions to static where possible 2013-03-09 16:48:08 -05:00
Franck Joncourt
c5163fcc24 Added new parameters HMAC_DIGEST_TYPE to the save capability. 2013-03-09 12:39:05 +01:00
Franck Joncourt
c2ef7f224a Moved static functions from the client to the fko_util.c file. 2013-03-09 12:17:17 +01:00
Michael Rash
44d05a6916 interim commit for supporting multiple HMAC digest types (# 45) 2013-03-07 23:14:48 -05:00
Michael Rash
39ca73a245 [test suite] added OpenSSL HMAC verification (closes #39) 2013-03-05 23:29:46 -05:00
Michael Rash
1dc47f80d8 Fix byte order warning
This commit fixes a byte order warning for both sha1.c and md5.c like so:

sha1.c:127:6: warning: #warning Undetermined or unsupported Byte Order... We will try LITTLE_ENDIAN [-Wcpp]

Also removed a couple of header includes that appear not be needed.
2013-03-03 14:29:08 -05:00
Damien Stuart
f9e1ae4859 Merge my working branch 'hmac_support' into hmac_header_fixes 2013-03-02 17:22:50 -05:00
Damien Stuart
6ecf81b16e First round if refactoring to clean up header dependencies. 2013-03-02 17:03:20 -05:00
Michael Rash
ffcb77552b Remove lib/fko.h dependency on rijndael.h 2013-02-28 21:47:43 -05:00
Michael Rash
6c2b657bfe [libfko] free dynamically allocated resources for multiple libfko fcn calls 2013-02-21 22:44:33 -05:00
Michael Rash
2b54cb94f5 memory leak bug fix for fko_new() to allow multiple calls without requiring external fko_destroy() call 2013-02-21 08:36:29 -05:00
Michael Rash
cae795f6fd allow encryption routines to be called multiple times for the same context (deallocate memory from previous calls) 2013-02-20 22:55:26 -05:00
Michael Rash
a413c6cf94 Continue atoi() replacement with strtol() wrapper, closes issue #21
This commit completes the conversion to the strtol() wrapper function in order
to remove all atoi() calls.  In addition, variable max values are enforced
using more broadly defined RCHK_* values.
2013-02-19 23:11:01 -05:00
Michael Rash
3f05f81ac6 memory leak bug fix in fko_set_rand_value()
Bug fix for the following error caught by the test suite (in the [Rijndael SPA]
[client+server] random SPA port (tcp/22 ssh) test):

==24257== 17 bytes in 1 blocks are definitely lost in loss record 1 of 1
==24257==    at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24257==    by 0x4E38B9B: fko_set_rand_value (fko_rand_value.c:114)
==24257==    by 0x4E37FE0: fko_new (fko_funcs.c:75)
==24257==    by 0x10AE52: main (fwknop.c:113)
2013-02-18 19:54:50 -05:00
Michael Rash
1afc8db96a Added strtol_wrapper() libfko utility function for atoi() replacement (#21)
This commit replaces most atoi() calls (which don't report errors) with a strtol()
wrapper function for stronger string -> integer conversion validation.
2013-02-18 19:32:53 -05:00
Michael Rash
ce18de4f84 make libfko pointers constant where possible 2013-02-12 22:39:39 -05:00
Michael Rash
c31c924a45 minor spacing fix 2013-01-30 21:13:44 -05:00
Michael Rash
13018a5c42 Merge pull request #19 from fjoncourt/hmac_support
Fixed gcc warning for the md5 driver.
2013-01-30 18:04:50 -08:00
Michael Rash
f1793a61d6 Merge remote-tracking branch 'fjoncourt/hmac_support' into hmac_support
Applied fix from Franck Joncourt for the 'warning: dereferencing type-punned
pointer will break strict-aliasing rules [-Wstrict-aliasing]' error in the
MD5 digest code.
2013-01-29 21:52:15 -05:00
Franck Joncourt
fcf9f43c5b Fixed gcc warnings for the sha2 driver. 2013-01-28 21:47:57 +01:00
Michael Rash
e7eb02f82d Maintain backwards compatibility with old "zero padding" code
[libfko] Added the ability to maintain backwards compatibility with the
now deprecated "zero padding" strategy in AES mode that was a hold over
from the old perl fwknop implementation.  This enables the backwards
compatiblity tests to continue to pass in the test suite.
2013-01-27 13:18:29 -05:00
Michael Rash
98c16005da memset() AES buffers to zero 2013-01-27 10:53:07 -05:00