Commit Graph

146 Commits

Author SHA1 Message Date
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
Franck Joncourt
1a8520d659 Fixed gcc warning for the md5 driver.
md5.c: In function 'MD5Final':
md5.c:166:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
md5.c:167:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Debian Gnu/Linux on i386 build against 2.0.4 :

https://buildd.debian.org/status/fetch.php?pkg=fwknop&arch=i386&ver=2.0.4-1&stamp=1358610541
2013-01-26 22:23:18 +01:00
Michael Rash
1d35c33d52 [test suite] added --enable-openssl-checks
Added --enable-openssl-checks to send all SPA packets encrypted via libfko
through the OpenSSL library to ensure that the libfko usage of AES is always
compatible with OpenSSL.  This ensures that the fwknop usage of AES is properly
implemented as verified by the OpenSSL library, which is a frequently audited
high profile crypto engine.  If a vulnerability is discovered in OpenSSL and a
change is made, then the --enable-openssl-checks mode will allow the test suite
to discover this in a automated fashion for fwknop.
2013-01-25 21:44:24 -05:00
Michael Rash
fbbcae3a0d [libfko] Don't trundate > 16 byte Rijndael keys
Significant bug fix to honor the full encryption key length for
user-supplied Rijndael keys > 16 bytes long.  Previous to this bug fix,
only the first 16 bytes of a key were actually used in the encryption/
decryption process even if the supplied key was longer.  The result was
a weakening of expected security for users that had keys > 16 bytes,
although this is probably not too common.  Note that "passphrase" is
perhaps technically a better word for "user-supplied key" in this
context since Rijndael in CBC mode derives a real encryption/decryption
key from the passphrase through a series of applications of md5 against
the passphrase and a random salt.  This issue was reported by Michael T.
Dean.  Closes issue #18 on github.
2013-01-22 22:20:54 -05:00
Michael Rash
160a9e5565 perl FKO module HMAC compatibility 2013-01-20 14:27:27 -05:00
Michael Rash
47f20ea30c merged in the fixes_for_2.0.4 branch 2013-01-19 18:36:52 -05:00
Michael Rash
47ea800889 merged in fwknop-2.0.4 changes 2013-01-18 17:25:16 -05:00
Damien Stuart
10c19063df Fixed parallel build issue
Added explicit dependency directives to Makefile.am to address errors
when running a parallel build.
2012-12-23 10:28:30 -05:00
Damien Stuart
10f2d295be Have libfko link strlxxx objects directly instead of libfko_util. 2012-12-08 15:40:40 -05:00
Damien Stuart
39410044c5 Set new libfko version. Client: allow dot (.) in validate_username, and display version and exit without creating an fko context. 2012-12-07 11:38:31 -05:00
Michael Rash
88c66f647f Revert "added got_allow_ip() wrapper around have_allow_ip() to fix an exported symbol issue noticed by Franck"
This reverts commit e57cfa2e23.  This is done
because libfko now restricts the symbols it exports to only those functions
that should be visible when making use of the library - internal libfko
functions should not be exported.
2012-12-03 22:45:39 -05:00
Damien Stuart
7df9edc1db Merge branch 'master' of github.com:mrash/fwknop 2012-12-02 09:59:48 -05:00
Damien Stuart
bcea440b87 Limited exported symbols in libfko to only the public (fko_) functions. Moved strlcat/cpy to a separate libfko_util lib. 2012-12-02 09:56:57 -05:00
Michael Rash
e57cfa2e23 added got_allow_ip() wrapper around have_allow_ip() to fix an exported symbol issue noticed by Franck 2012-12-01 22:45:55 -05:00