[libfko/test suite] add the FUZZING_INTERFACES macro
Add a new fko_set_encoded_data() function gated by #define
FUZZING_INTERFACES to allow encryption and authentication to be bypassed
for fuzzing purposes (and only fuzzing purposes). The fko-wrapper code
has been extended to process data in the
test/fko-wrapper/fuzz_spa_payloads file, which is created by the new
python fuzzer. Typical workflow is:
$ cd test/fko-wrapper
$ ../spa_fuzzer.py > fuzz_spa_payloads
$ make fuzzing
(as root):
./test-fwknop.pl --enable-profile-coverage --enable-fuzzing-interfaces --enable-all --include wrapper
[+] Starting the fwknop test suite...
args: --enable-profile-coverage --enable-fuzzing-interfaces --enable-all --include wrapper
Saved results from previous run to: output.last/
Valgrind mode enabled, will import previous coverage from:
output.last/valgrind-coverage/
[+] Total test buckets to execute: 2
[Rijndael] [fko-wrapper] multiple libfko calls (with valgrind)......pass (1)
[Rijndael] [fko-wrapper] multiple libfko calls......................pass (2)
[profile coverage] gcov profile coverage............................pass (3)
[valgrind output] [flagged functions] ..............................pass (4)
Run time: 5.85 minutes
[+] 0/0/0 OpenSSL tests passed/failed/executed
[+] 0/0/0 OpenSSL HMAC tests passed/failed/executed
[+] 4/0/4 test buckets passed/failed/executed
This commit is contained in:
@@ -244,6 +244,7 @@ fko_get_encoded_data(fko_ctx_t ctx, char **enc_msg)
|
||||
/* Set the fko SPA encoded data (this is a convenience
|
||||
* function mostly used for tests that involve fuzzing).
|
||||
*/
|
||||
#if FUZZING_INTERFACES
|
||||
int
|
||||
fko_set_encoded_data(fko_ctx_t ctx,
|
||||
const char * const encoded_msg, const int msg_len,
|
||||
@@ -274,7 +275,7 @@ fko_set_encoded_data(fko_ctx_t ctx,
|
||||
|
||||
if(require_digest)
|
||||
{
|
||||
fko_set_spa_digest_type(ctx, FKO_DIGEST_SHA256);
|
||||
fko_set_spa_digest_type(ctx, digest_type);
|
||||
if((res = fko_set_spa_digest(ctx)) != FKO_SUCCESS)
|
||||
{
|
||||
return res;
|
||||
@@ -310,5 +311,6 @@ fko_set_encoded_data(fko_ctx_t ctx,
|
||||
|
||||
return(FKO_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/***EOF***/
|
||||
|
||||
Reference in New Issue
Block a user