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.)
This commit is contained in:
Michael Rash
2013-11-26 21:44:53 -05:00
parent a15be4005e
commit aeb415d0e0
5 changed files with 36 additions and 3 deletions
+1 -1
View File
@@ -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 \
+2
View File
@@ -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
+32 -1
View File
@@ -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
+1 -1
View File
@@ -266,7 +266,7 @@ my $tarfile = 'test_fwknop.tar.gz';
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;