Commit Graph
287 Commits
Author SHA1 Message Date
Jonathan Bennett bc55f0f21f Add count_characters and a CUnit test series for it. 2015-12-31 04:14:58 +00:00
Jonathan Bennett 56be13b3f6 Add dns resolution for nat access 2015-12-31 04:13:46 +00:00
Jonathan Bennett 2edbc04bc7 properly handle longer HMAC keys for hmac_sha384 and hmac_sha512 2015-12-30 20:32:52 +00:00
Jonathan Bennett 32a37f7e1f Add CUnit tests for various crypto functions 2015-12-30 20:32:52 +00:00
Jonathan Bennett d9f9cb8ad5 Add SHA3 and HMAC-SHA3 support 2015-12-30 20:32:52 +00:00
Jonathan Bennett b661dee583 Initial Doxygen config file and work on documenting libfko functions 2015-12-29 17:39:52 -06:00
Michael Rash a85b081f79 copyright update 2015-12-23 14:34:51 -05:00
Michael Rash e2925c1f85 [libfko] bump version to 2.0.4 to account for fko_set_username() crash fix 2015-12-22 03:29:07 -08:00
Michael Rash 988075b52b [server] bug fix to honor client timeout SPA messages in --nat-local mode, fixes #173 2015-12-04 19:36:51 -08:00
Michael Rash 21149faf89 [libfko] fko_set_username() crash bug fix.
Bug fix for a crash in libfko that could be triggered in fko_set_username()
when a username that is 64 chars or longer is specified. This crash
cannot be triggered in fwknopd even if an SPA packet contains such a
username however due to additional protections in the SPA decoding
routines. Further, this bug does not apply to the main fwknop client
either because the maximal username size is truncated down below 64
bytes. Hence, this bug only applies to client-side software that is
directly using libfko calling the fko_set_username() function.
2015-12-04 19:01:26 -08:00
Michael Rash c67008b6a8 minor fault injection tag rework for fko_set_rand_value() and fko_set_username() 2015-11-30 12:28:59 -08:00
Damien Stuart 02049cb473 Added AM_CONDITIONAL to check if OS is Darwin (Apple) and not use the --whole-archive option if it is. 2015-11-02 23:02:22 -05:00
Damien Stuart 0ef8ba5259 Added use of --whole-archive for linking libfko_util.a to libfko.so. This takes care of the unresolved symbols (from libfko_util) when linking libfko.so. 2015-11-02 21:41:26 -05:00
Damien Stuart a4309ad768 Added clean up for .gcno and .gcda files (left went c-unit-tests are enabled. 2015-09-05 15:20:22 -04:00
Damien Stuart 2e60687dcf Merge branch 'master' into dstuart_refactor_autoconf 2015-08-29 12:46:24 -04:00
Damien Stuart 2ea2aea0ba Tweaks for unit test support 2015-05-03 09:46:37 -04:00
Michael Rash 1dc4a47357 [libfko] minor update to make process_sigs() static 2015-03-26 22:04:20 -04:00
Michael Rash 56e2e5ca2f [test suite] restore digest length calculation for AFL fuzzing, fixes #148 2015-03-20 16:44:06 -04:00
Damien Stuart 5c8fc63b89 Missed tweak on the Makefile.am file in lib. 2015-02-17 14:58:08 -05:00
Damien Stuart e4fae829bc Refactor of Makefile.am files to fix issues caused by referencing source files in other directories - which broke make dist and make distclean targets. 2015-02-17 14:37:20 -05:00
Damien Stuart b152d15970 Refactored how the cunit tests are processed so "make dist" does not fail and builds with c-unit-tests enabled work on systems with firewalld (added fw_util_firewalld.c for server tests). 2015-02-14 12:29:30 -05:00
Franck Joncourt 1c81aef39d Fixed file permissions 2014-12-31 09:51:08 +01:00
Franck Joncourt 29a5a9804d * Added libfko unit tests 2014-12-30 20:49:14 +01:00
Franck Joncourt 620d31364e * Removed duplicated entry in Makefile.am for libfko
* Added c unit tests for fko (draft)
* Updated c unit test README file.
2014-12-29 18:47:17 +01:00
Franck Joncourt 750fd97bda Allow to build without c unit test 2014-12-29 11:45:30 +01:00
Franck Joncourt 5c3a709014 Merge branch 'c_unit_testing' of https://github.com/fjoncourt/fwknop into c_unit_testing
Conflicts:
	client/config_init.c
	common/cunit_common.h
	lib/cunit_common.c
	server/access.c
2014-12-28 23:24:15 +01:00
Franck Joncourt b7ecb3334a Merge upstream changes to our changes 2014-12-28 15:00:24 +01: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 aaa44656bc [server] add support for American Fuzzy Lop (ALF) fuzzing 2014-11-13 20:55:04 -05:00
Michael Rash 837f7780fe [libfko] validate MAX_PORT integer value for SPA messages 2014-10-25 08:42:14 -04:00
Franck Joncourt 260cd5481b Use of init and cleanup functions for the test suite. 2014-09-07 20:33:39 +02:00
Franck Joncourt bd0035af1e Fixed tab vs spaces 2014-09-07 15:40:03 +02:00
Franck Joncourt 688f08c2a0 Both the fwknop client and server have their own test suites tied to fwknop_utests
and fwknopd_utests binaries.

When profil coverage is enbaled, lcov filee are parsed by test-fwknop.pl and added
to the main profil coverage report in the output directory.

Running make from the main directory build the c-unit test suites if enabled.
2014-09-07 15:15:22 +02:00
Michael Rash 71b97b6cad bumped libfko version to 2.0.3 2014-07-28 21:46:32 -04:00
Michael Rash 4878607254 [libfko] removed fko_new_strdup() fault injection tag since fko_destroy() isn't called 2014-06-16 17:11:52 -04:00
Michael Rash 34f7ebd082 [test suite] added strtol_wrapper() fault injection tags 2014-06-15 09:41:43 -04:00
Michael Rash 42a20616b4 [libfko] additional fault injection additions with test suite support 2014-06-14 21:27:18 -04:00
Michael Rash c00a3e7b26 [test suite] additional fault injection tests 2014-06-12 20:29:54 -04:00
Michael Rash 06ce514111 [test suite] add several fault injection tests 2014-06-12 00:02:18 -04:00
Michael Rash 410624a858 [libfko] free() temp buffer right after strdup() call, add libfiu fault injection tags 2014-06-12 00:00:40 -04: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 82b05b9530 [libfko] fko_new() bug fix to not leak memory under fko_set_... error conditions
This commit changes how fko_new() deals with FKO context initialization
to not set ctx->initval back to zero (uninitialized) imediately after
calling each fko_set_... function and before checking the fko_set_... return
value.  The reason for this change is that fko_destroy() checks for
context initialization via ctx->initval before calling free() against
any heap allocated context member. So, if fko_set_... returns an error,
fko_destroy() (previous to this commit) would have no opportunity to
free such members.

This bug was found with fault injection testing provided by libfiu
together with valgrind. Specifically the following test suite command
exposes the problem (from the test/ directory):

./test-fwknop.pl --enable-complete --include "fault injection.*libfko"

In the resulting output/2.test file valgrind reports the following:

==27941== LEAK SUMMARY:
==27941==    definitely lost: 264 bytes in 1 blocks
==27941==    indirectly lost: 28 bytes in 3 blocks
==27941==      possibly lost: 0 bytes in 0 blocks
==27941==    still reachable: 1,099 bytes in 12 blocks
==27941==         suppressed: 0 bytes in 0 blocks

After this commit is applied, this changes to:

==7137== LEAK SUMMARY:
==7137==    definitely lost: 0 bytes in 0 blocks
==7137==    indirectly lost: 0 bytes in 0 blocks
==7137==      possibly lost: 0 bytes in 0 blocks
==7137==    still reachable: 1,099 bytes in 12 blocks
==7137==         suppressed: 0 bytes in 0 blocks

Note that 'definitely lost' in valgrind output means there is a real
memory leak that needs to be fixed whereas 'still reachable' is most
likely not a real problem according to:

http://valgrind.org/docs/manual/faq.html#faq.deflost
2014-06-06 21:28:28 -04:00
Michael Rash 6d1d66fe03 add --fault-injection-tag support to the client/server/libfko
This is a significant commit to add the ability to leverage libfko fault
injections from both the fwknop client and server command lines via a
new option '--fault-injection-tag <tag name>'.  This option is used by
the test suite with the tests/fault_injection.pl tests.
2014-06-05 23:05:49 -04:00
Michael Rash ddaf0134d6 use fiu.h instead of fiu-local.h 2014-05-26 15:54:12 -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 5f227cfa48 [libfko] added fault injections for fko_set_username() 2014-05-24 14:47:10 -04:00
Michael Rash 17f325eceb [libfko] added fault injections for fko_set_rand_value() 2014-05-24 14:01:49 -04:00
Michael Rash 35ad832392 [libfko] started on libfiu fault injection code 2014-05-24 10:14:28 -04:00
Michael Rash 40e14fc400 Merge branch 'spa_encoding_fuzzing' 2014-04-28 23:00:16 -04:00
Michael Rash 7442002a89 [libfko] bumped version to 2.0.2 2014-04-28 21:08:27 -04:00