Michael Rash aeb415d0e0 move fuzzing_spa_packets file to perl/FKO/t/ for fuzzing tests
This change moves the fuzzing_spa_packets file from the test/fuzzing/
directory into the perl FKO extension t/ directory and is now referenced
directly by the t/04_fuzzing.t test file.  The test suite itself also uses
this file for fuzzing tests as well, but having the FKO built-in tests
enables Test::Valgrind memory checks so it is useful to have this included
in the FKO sources.  (When the FKO module is submitted to CPAN, it should
not depend on non-local files, but it's ok for the test suite to reference
the ../perl/FKO/t/ directory.)
2013-11-26 21:44:53 -05:00
..
2012-10-28 23:31:09 -04:00

### Generating new fuzzing SPA packets:

- Apply a patch or set of patches to libfko to ignore error conditions and
  recompile.
- Run the test suite as follows to generate new fuzzing SPA packets:

    # ./test-fwknop.pl --enable-perl-module-pkt-gen

      [+] Starting the fwknop test suite...

          args: --enable-perl-module-pkt-gen

          Saved results from previous run to: output.last/

      [perl FKO module] [compile/install] to: ./FKO.......................pass (1)
      [perl FKO module] [FUZZING] generate invalid SPA pkts...............pass (2)

      [+] Wrote 169 fuzzing SPA packets to fuzzing/fuzzing_spa_packets.tmp...

- Review the packet data in the fuzzing_spa_packets.tmp file, and move to
  fuzzing/fuzzing_spa_packets if acceptable.
- Reverse the fuzzing patch mentioned above and recompile.
- Now send the packets through libfko as follows:

    # ./test-fwknop.pl --enable-perl-module-checks --include "perl FKO"

- If there is another patch to apply, then add a fuzzing tag so that the
  packets can easily be differentiated and appended to the official
  "fuzzing_spa_packets" file.  Note that adding the --fuzzing-class argument
  assumes that a patch has been applied to lib/fko_encode.c to manipulate SPA
  packet data after the various user-supplied data has been provided (and this
  data itself is valid - it is the encoding itself that the patch is supposed
  to mess with).  If the --fuzzing-class arg is left off, then the user fields
  are built using invalid data.

    # ./test-fwknop.pl --enable-perl-module-pkt-gen  --fuzzing-test-tag "encoded_non_digit_rand_val"  --fuzzing-class encoding

      [+] Starting the fwknop test suite...

          args: --enable-perl-module-pkt-gen --fuzzing-test-tag encoded_non_digit_rand_val --fuzzing-class encoding

          Saved results from previous run to: output.last/

      [perl FKO module] [compile/install] to: ./FKO.......................pass (1)
      [perl FKO module] [FUZZING] generate invalid encoded pkts...........pass (2)

      [+] Wrote 30 fuzzing SPA packets to fuzzing/fuzzing_spa_packets.tmp...