255 Commits

Author SHA1 Message Date
Michael Rash
79f0cb8986 [libfko] added defensive NULL check for is_valid_ipv4_addr() 2013-12-04 23:11:11 -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
Michael Rash
78f696b2f7 [libfko] implemented shared utility function for ipv4 address checking
This commit implements a single shared utility function for checking the
validaty of an IPv4 address, and both libfko and the fwknopd server use it
now.  The client will be updated as well.
2013-11-20 17:13:55 -05:00
Michael Rash
c019a43808 [libfko] bug fix caught by new code structure error str test to add string for FKO_ERROR_INVALID_DATA_DECODE_EXTRA_TOOBIG 2013-11-16 23:23:32 -05:00
Michael Rash
196fef65b6 [libfko] move is_base64 check to libfko
This commit replaces the separately implemented client/server
is_base64() check with a single libfko function, and libfko itself now
uses it as well before prepending Rijndael or GnuPG base64 encoded
prefixes.
2013-11-16 19:20:08 -05:00
Michael Rash
6d78c49ef9 [libfko] minor update to print 'None' for the HMAC type when an HMAC is not used instead of just diplaying '()' 2013-11-14 23:13:33 -05:00
Michael Rash
23ef1d4e59 [libfko] Candidate build fix for Mac OS X 10.9 (closes #108)
Nikolay Kolev reported a build issue on Mac OS X 10.9 (Mavericks) where fwknop
copies of strlcpy() and strlcat() functions were conflicting with those that ship
with OS X 10.9.

The solution was to add a configure.ac check for strlcat() and strlcpy() and
wrap "#if !HAVE_..." checks around those functions.

A portion of the build errors looked like this:

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in lib
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..   -I ../common   -g -O2 -Wall -Wformat -Wformat-security -fstack-protector-all -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -MT base64.lo -MD -MP -MF .deps/base64.Tpo -c -o base64.lo base64.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I ../common -g -O2 -Wall -Wformat -Wformat-security -fstack-protector-all -fstack-protector -D_FORTIFY_SOURCE=2 -MT base64.lo -MD -MP -MF .deps/base64.Tpo -c base64.c  -fno-common -DPIC -o .libs/base64.o
In file included from base64.c:34:
In file included from ./fko_common.h:149:
./fko_util.h:56:9: error: expected parameter declarator
size_t  strlcat(char *dst, const char *src, size_t siz);
        ^
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
  __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
                                           ^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
 #define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                             ^
2013-11-12 21:36:14 -05:00
Michael Rash
0d80f72c00 Revert "[test suite] minor Test::Valgrind name typo fix"
This reverts commit 642024041534d79c897a21b2e19ef3e1ed7b2a61.
2013-10-22 20:36:30 -04:00
Michael Rash
6420240415 [test suite] minor Test::Valgrind name typo fix 2013-10-22 16:18:46 -04:00
Franck Joncourt
5693b0536a Fixed *Value stored is never read* warning found by clang. 2013-08-27 20:45:17 +02:00
Michael Rash
e8fe29bbe1 Merge branch 'master' of github.com:mrash/fwknop 2013-08-11 22:09:22 -04:00
Michael Rash
c0c8048ee1 Added fko context dumper change to ChangeLog, updated test suite to account for single line printing of final SPA data 2013-08-11 22:07:02 -04:00
Damien Stuart
12916f21ef Moved new invalid data error definitions above the GPGME_ERR_START marker. 2013-08-11 22:02:50 -04:00
Franck Joncourt
f8ae3b8da3 Merge remote-tracking branch 'upstream/master' into fko_dump 2013-08-10 14:32:34 +02:00
Franck Joncourt
b590932fb6 * Removed goto statements. We do not do any further processings
when we reach the error label.
2013-08-10 14:30:40 +02: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
Franck Joncourt
7296d3f3bf * Interim commit to add a dump function to dump the FKO context shared
by both the server and client. mrash/fwknop#95
2013-08-05 23:28:07 +02:00
Michael Rash
11fa1f2f0d [libfko] set version-info to 2:0:0 per Damien and Franck's recommendations 2013-07-19 20:33:38 -04:00
Michael Rash
f7a821d082 minor ChangeLog text tweaks and one typo fix 2013-07-17 23:34:37 -04:00
Damien S. Stuart
4b0f0802ee Tweaks to unbreak the windows build: Renamed FD_SET macro to FD_SET_ALT to avoid conflict with the well-known FD_SET macro. Made the client read password from file descriptor a non-supported function on Windows. 2013-07-17 22:46:24 -04:00
Michael Rash
f391b1391d [libfko] apply zero_buf() to stack allocated Rijndael context for encrypt/decrypt 2013-07-12 23:21:38 -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
6c24b1c858 [libfko] always call free() from zero_free() on all non-NULL buf pointers 2013-07-10 23:09:41 -04:00
Michael Rash
a42bfd38c2 [libfko] bug fix to set digest length upon SPA packet decode
This bug was caught with the fko_wrapper.c multi-call tester running under
valgrind.
2013-07-10 23:07:43 -04:00
Michael Rash
3756b831f5 simplified zero_free() calls in support of #93 2013-07-09 22:17:05 -04:00
Michael Rash
189a183e18 allow zero length to return FKO_SUCCESS from zero_buf() call 2013-07-09 21:40:23 -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
5915ee72a9 [libfko] add ctx initialized check to fko_gpg_errstr() 2013-07-09 21:18:06 -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
9d7feb52f6 Merge remote-tracking branch 'upstream/master' 2013-06-30 22:22:34 +02:00
Franck Joncourt
c2e1a00154 s/GNU Public/GNU General Public/g 2013-06-30 22:21:22 +02:00
Michael Rash
37b624ac8b bump version to 2.5, minor fwknopd -S exit status update
This commit bumps the fwknop version to 2.5 and sets the libfko version to 2.0 to
signal incompatibility with older libfko versions.  Backwards compatibility is
maintained in SPA packet construction, but function prototypes in libfko-2.0 are
no longer compatible with older versions.

This commit also returns non-zero exit status under 'fwknopd --status' if there
is no existing fwknopd process.  This is better than always exiting with a zero
status regardless of whether fwknopd is already running or not, and adds a level
of scriptability to --status usage.  This change was suggested by George Herlin.
2013-06-27 21:21:10 -04: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
ea0ecc8cbe [libfko] BYTEORDER macro update to 4321 or 1234 if all other methods fail 2013-06-12 23:09:55 -04:00
Michael Rash
ffeb285f7b [libfko] handle endian detection on PPC (and other) systems
Blair Zajac contributed a patch to handle endian detection on PPC systems
and issue a compile time error if it cannot be determined.  This commit affects
the BYTEORDER macro.
2013-06-10 22:28:00 -04:00
Michael Rash
5c7f5f1b0b [libfko] use local strndup() if autoconf HAVE_STRNDUP not defined
Blair Zajac reported that strndup() is not available on some PPC systems, so
this commit switches to use the local lib/fko_util.c implementation similarly
to what is done for Windows systems.
2013-06-10 21:45:31 -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
54872acfc3 Convert strncmp() calls to constant_runtime_cmp() at various places
This commit is a follow up to Ryman's report (#85) of a potential timing attack
that could be leveraged against fwknop when strncmp() is used to compare HMAC
digests.  All strncmp() calls that do similar things have been replaced with a
new constant_runtime_cmp() function that mitigates this problem.
2013-06-01 21:55:45 -04:00
Michael Rash
6706c53902 [libfko] HMAC comparison timing bug fix
Ryman reported a timing attack bug in the HMAC comparison operation (#85) and
suggested a fix derived from YaSSL:
http://www.mail-archive.com/debian-bugs-rc@lists.debian.org/msg320402.html
2013-06-01 09:09:17 -04:00
Michael Rash
52462e7dba Use {0} initializer for all stack allocated char arrays
Lots of places in the code were already using {0} to initialize stack char
arrays, but memset() was being used as well.  This commit removes all
unnecessary memset() calls against char arrays that are already initialized
via {0} (which sets all members to zero for such arrays).
2013-05-21 22:00:15 -04:00
Michael Rash
45244114f8 [client] --key-gen bug fix to print keys to stdout 2013-05-17 21:03:16 -04:00
Franck Joncourt
bb90a8bf75 Fixed gcc warnings on openbsd. - mrash/fwknop#60 2013-05-14 22:08:44 +02:00
Franck Joncourt
9dbb62ae1e Merge remote-tracking branch 'upstream/master' 2013-05-13 16:30:27 +02:00
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
Franck Joncourt
31d94d50b1 Added tests to validate the encryption mode for the client.
Renamed the CBC legacy VI encryption mode by legacy as mentionned in the man page.
2013-05-12 17:35:19 +02:00
Franck Joncourt
160c21d6b6 Rewrite enc_mode_inttostr() and enc_mode_strtoint().
Make sure both functions works the same way and refer to the same
encryption mode string.

Updated the fwknop usage message to display the encryption mode.
2013-05-12 16:52:52 +02: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