Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.)
  • Loading branch information...
commit aeb415d0e0f91fc08e6b2d831b25e1ca9a1e5d08 1 parent a15be40
@mrash authored
View
2  Makefile.am
@@ -99,6 +99,7 @@ EXTRA_DIST = \
perl/FKO/MANIFEST \
perl/FKO/ppport.h \
perl/FKO/FKO.xs \
+ perl/FKO/t/fuzzing_spa_packets \
perl/FKO/t/04_fuzzing.t \
perl/FKO/t/03_errors.t \
perl/FKO/t/02_functions.t \
@@ -282,7 +283,6 @@ EXTRA_DIST = \
test/fuzzing/patches/invalid_long_proto_define_rijndael_trigger.patch \
test/fuzzing/patches/long_ip.patch \
test/fuzzing/patches/non_b64_user_char.patch \
- test/fuzzing/fuzzing_spa_packets \
test/tests/build_security.pl \
test/tests/preliminaries.pl \
test/tests/code_structure.pl \
View
2  perl/FKO/MANIFEST
@@ -9,6 +9,8 @@ t/00_init.t
t/01_constants.t
t/02_functions.t
t/03_errors.t
+t/04_fuzzing.t
+t/fuzzing_spa_packets
lib/FKO.pm
lib/FKO_Constants.pl
inc/Devel/CheckLib.pm
View
33 perl/FKO/t/04_fuzzing.t
@@ -13,7 +13,7 @@
#
use FKO;
-use Test::More tests => 593;
+use Test::More tests => 9693;
my $err;
@@ -354,6 +354,37 @@ $f2->destroy() if $f2;
$f1->destroy();
+my $fuzzing_pkts_file = 't/fuzzing_spa_packets';
+my %fuzzing_spa_packets = ();
+my $fuzzing_key = 'testtest';
+open F, "< $fuzzing_pkts_file" or die $!;
+while (<F>) {
+ if (/(?:Bogus|Invalid_encoding)\s(\S+)\:\s+(.*)\,\sSPA\spacket\:\s(\S+)/) {
+ push @{$fuzzing_spa_packets{$1}{$2}}, $3;
+ }
+}
+close F;
+
+for my $enc_mode (FKO::FKO_ENC_MODE_CBC, FKO::FKO_ENC_MODE_CBC_LEGACY_IV) {
+ for my $field (keys %fuzzing_spa_packets) {
+ for my $field_val (keys %{$fuzzing_spa_packets{$field}}) {
+ for my $encrypted_spa_pkt (@{$fuzzing_spa_packets{$field}{$field_val}}) {
+
+ $f3 = FKO->new();
+ ok($f3, 'Create f3 full fuzzing packets');
+
+ $f3->encryption_mode($enc_mode);
+ $f3->spa_data($encrypted_spa_pkt);
+
+ ok($f3->decrypt_spa_data($fuzzing_key) != FKO::FKO_SUCCESS,
+ "accepted fuzzing packet (enc mode: $enc_mode, $field: $field_val)");
+
+ $f3->destroy();
+ }
+ }
+ }
+}
+
##############################################################################
sub create
View
0  test/fuzzing/fuzzing_spa_packets → perl/FKO/t/fuzzing_spa_packets
File renamed without changes
View
2  test/test-fwknop.pl
@@ -266,7 +266,7 @@
our $key_gen_file = "$output_dir/key_gen";
our $verbose_str = "--verbose --verbose";
my $gdb_test_file = '';
-my $fuzzing_pkts_file = 'fuzzing/fuzzing_spa_packets';
+my $fuzzing_pkts_file = '../perl/FKO/t/fuzzing_spa_packets';
my $fuzzing_pkts_append = 0;
my $fuzzing_key = 'testtest';
my $fuzzing_num_pkts = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.