72 Commits

Author SHA1 Message Date
Jonathan Bennett
ae5451dccc Doxygen headers for libfko files 2016-01-01 02:04:24 +00:00
Michael Rash
a85b081f79 copyright update 2015-12-23 14:34:51 -05:00
Michael Rash
285ec0ddcb [server] add AFL support for fuzzing SPA Rijndael decryption routine directly with --afl-pkt-file 2014-12-03 20:25:05 -05:00
Michael Rash
ffde9c3f1a [libfko] bug fix to check strdup() return value
Using the 'fiu-run' fault injection binary, a couple of cases were
turned up with libfko does not properly check the strdup() return value.
This commit fixes these issues, and here is an illustration of the stack
trace for one such issue:

  Core was generated by `../client/.libs/fwknop -A tcp/22 -a 127.0.0.2 -D
  127.0.0.1 --get-key local_spa.'.
  Program terminated with signal 11, Segmentation fault.
  #0  __strnlen_sse2 () at ../sysdeps/x86_64/multiarch/../strnlen.S:34
  34      ../sysdeps/x86_64/multiarch/../strnlen.S: No such file or directory.
  (gdb) where
  #0  __strnlen_sse2 () at ../sysdeps/x86_64/multiarch/../strnlen.S:34
  #1  0x00007effa38189bc in _rijndael_encrypt (enc_key_len=<optimized out>, enc_key=<optimized out>, ctx=0x7effa5945750) at fko_encryption.c:141
  #2  fko_encrypt_spa_data (ctx=0x7effa5945750, enc_key=<optimized out>, enc_key_len=<optimized out>) at fko_encryption.c:605
  #3  0x00007effa381a2d6 in fko_spa_data_final (ctx=0x7effa5945750, enc_key=enc_key@entry=0x7fff3ff4aa10 "fwknoptest", enc_key_len=<optimized out>, hmac_key=hmac_key@entry=0x7fff3ff4aaa0 "", hmac_key_len=0) at fko_funcs.c:489
  #4  0x00007effa405f2fb in main (argc=<optimized out>, argv=<optimized out>) at fwknop.c:449
2014-06-08 23:09:55 -04:00
Michael Rash
597a3d3953 [libfko] added fault injections for remaining ...set...() functions called by fko_new() 2014-05-24 15:12:07 -04:00
Michael Rash
ac6ffe2ec7 [server] Validate GPG sigs with libfko fko_gpg_signature_id_match() function 2014-04-09 23:56:03 -04:00
Michael Rash
41f12eba81 [libfko] Memory leak bug fix in GnuPG handling
Bug fix to correct a memory leak in GnuPG SPA packet handling within
the gpg_decrypt() function.  Here is the specific valgrind leak record
that enabled the bug to be found (note that the new valgrind
suppressions usage was critical for finding this bug among all other
libgpgme memory leaks):

==23983== 1,044 bytes in 1 blocks are definitely lost in loss record 7 of 8
==23983==    at 0x4C2C494: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23983==    by 0x4E41D3A: gpg_decrypt (fko_encryption.c:422)
==23983==    by 0x4E42520: fko_decrypt_spa_data (fko_encryption.c:626)
==23983==    by 0x1155B0: incoming_spa (incoming_spa.c:519)
==23983==    by 0x1180A7: process_packet (process_packet.c:211)
==23983==    by 0x506D857: ??? (in /usr/lib/x86_64-linux-gnu/libpcap.so.1.4.0)
==23983==    by 0x117865: pcap_capture (pcap_capture.c:270)
==23983==    by 0x10F937: main (fwknopd.c:353)
2014-03-27 16:52:13 -04:00
Michael Rash
5baf8a3fa9 replace malloc() with calloc() calls 2014-03-15 22:02:57 -04:00
Michael Rash
9e990c9be0 fix header non-ascii chars, and introduce test suite support for detecting this in source files 2014-03-14 09:14:35 -04:00
Michael Rash
bfdbb8f260 Updated authorship and copyright information
This commit updates all authorship and copyright information to include a
standard header that references the AUTHORS and CREDITS file. This standard
header was written by the Debian legal team at the request of Franck Joncourt.
2014-03-04 17:53:10 -05:00
Michael Rash
7bb5811651 [libfko] minor bug fix to not return GPG error codes from _rijndael_decrypt() 2014-02-02 20:32:02 -05:00
Michael Rash
227d0ab947 [libfko] ensure NULL is handled properly for all fko_get_* functions 2013-12-31 23:27:05 -05:00
Michael Rash
297d7d00fe [libfko] enc key NULL checks with fko-wrapper test support 2013-12-29 22:44:16 -05:00
Michael Rash
0c6911941b [libfko] reject negative length values
Integer lengths that are negative are never valid.  This commit also
extends the fuzzing capabilities of the test/fko-wrapper code to
validate libfko calls with negative length arguments, and one crash
scenario with a negative length for the encryption key was found (and
fixed) this way.
2013-12-29 21:05:04 -05:00
Michael Rash
be904769c4 [libfko] Bug fix to not decrypt with GnuGP without FKO_ENC_MODE_ASYMMETRIC
[libfko] Bug fix to not attempt SPA packet decryption with GnuPG without
an fko object with encryption_mode set to FKO_ENC_MODE_ASYMMETRIC.  This
bug was caught with valgrind validation against the perl FKO extension
together with the set of SPA fuzzing packets in
test/fuzzing/fuzzing_spa_packets.  Note that this bug cannot be
triggered via fwknopd because additional checks are made within fwknopd
itself to force FKO_ENC_MODE_ASYMMETRIC whenever an access.conf stanza
contains GPG key information.  This fix strengthens libfko itself to
independently require that the usage of fko objects without GPG key
information does not result in attempted GPG decryption operations.  Hence
this fix applies mostly to third party usage of libfko - i.e. stock
installations of fwknopd are not affected.  As always, it is recommended to
use HMAC authenticated encryption whenever possible even for GPG modes since
this also provides a work around even for libfko prior to this fix.
2013-11-26 08:35:16 -05:00
Hank Leininger
bc907e0b24
Add unique errors for every FKO_ERROR_INVALID_DATA. Needed this to
track down mystery errors (#98).
2013-08-05 22:21:10 -04:00
Michael Rash
e75c10c6e5 [libfko] use zero_free_rv - dead code bug fix found by CLANG static analyzer 2013-07-10 23:10:23 -04:00
Michael Rash
3756b831f5 simplified zero_free() calls in support of #93 2013-07-09 22:17:05 -04:00
Michael Rash
69760d49c5 [libfko] return proper GPG error code upon gpg_decrypt() failure 2013-07-09 21:18:45 -04:00
Michael Rash
24c4c5e208 continued zeroing out of sensitive data buffers in support of issue #93 2013-07-08 23:00:18 -04:00
Michael Rash
1e77f6ed53 continued changes to zero out sensitive information before exit (#93) 2013-07-07 22:32:30 -04:00
Franck Joncourt
c2e1a00154 s/GNU Public/GNU General Public/g 2013-06-30 22:21:22 +02:00
Michael Rash
54c26ede6e [libfko] defensive coding update to quiet minor CLANG static analyzer false positives 2013-06-19 23:38:37 -04:00
Michael Rash
382099e85a Updated copyright dates, removed NEWS file in favor of the ChangeLog 2013-06-02 14:07:01 -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
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
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
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
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
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
ce18de4f84 make libfko pointers constant where possible 2013-02-12 22:39:39 -05:00
Michael Rash
47ea800889 merged in fwknop-2.0.4 changes 2013-01-18 17:25:16 -05:00
Michael Rash
7afe5b28b7 minor update to use explicit FKO_SUCCESS value in if() result check 2012-11-08 21:03:45 -05:00
Michael Rash
ac38f8d993 [libfko] bug fix to check b64_decode() return value
Bug fix to check b64_decode() return value to ensure that
non-base64 encoded data is never used.  Even though other validation
routines checked decoded results, it is important to discard invalid
data as early as possible.  Note too that such invalid data would only
be provided to b64_decode() after proper decryption, so the client must
provide authentic SPA data.
2012-10-26 15:36:08 -04:00
Michael Rash
e4751d1c20 added icmp type/code blurb 2012-10-11 23:40:04 -04:00
Michael Rash
b05d229bb1 sprintf() -> snprintf() calls 2012-09-03 09:09:35 -04:00
Michael Rash
a9cbd60327 [libfko] first HMAC-SHA256 implementation (includes test suite support) 2012-07-29 21:34:08 -04:00
Michael Rash
c6cef8982a [libfko] validate incoming plaintext lengths 2012-07-27 23:25:32 -04:00
Michael Rash
482e6f974c added msg_hmac_len and removed additional strlen() calls 2012-07-27 21:29:26 -04:00
Michael Rash
10195cf29a [libfko] added encrypted_msg_len and replaced additional strlen() calls 2012-07-27 18:16:37 -04:00
Michael Rash
d561fdd4d7 added lib/fko_util.c with basic length checking functions 2012-07-26 18:01:36 -04:00
Michael Rash
bdb6cc0eb1 Added digest_len and raw_digest_len fields and replaced strlen() calls 2012-07-26 15:00:32 -04:00
Michael Rash
e733f4aa4f have encryption calls use encoded_msg_len 2012-07-26 12:21:24 -04:00