pkcs7: provide fuzz harness
This allows for pkcs7 fuzz testing with OSS-Fuzz. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
This commit is contained in:
parent
aa91d4ef0b
commit
106a0afc5a
4 changed files with 23 additions and 0 deletions
1
programs/fuzz/.gitignore
vendored
1
programs/fuzz/.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
fuzz_client
|
||||
fuzz_dtlsclient
|
||||
fuzz_dtlsserver
|
||||
fuzz_pkcs7
|
||||
fuzz_privkey
|
||||
fuzz_pubkey
|
||||
fuzz_server
|
||||
|
|
|
@ -12,6 +12,7 @@ set(executables_no_common_c
|
|||
fuzz_x509crl
|
||||
fuzz_x509crt
|
||||
fuzz_x509csr
|
||||
fuzz_pkcs7
|
||||
)
|
||||
|
||||
set(executables_with_common_c
|
||||
|
|
19
programs/fuzz/fuzz_pkcs7.c
Normal file
19
programs/fuzz/fuzz_pkcs7.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include <stdint.h>
|
||||
#include "mbedtls/pkcs7.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
#ifdef MBEDTLS_PKCS7_C
|
||||
mbedtls_pkcs7 pkcs7;
|
||||
|
||||
mbedtls_pkcs7_init( &pkcs7 );
|
||||
|
||||
mbedtls_pkcs7_parse_der( &pkcs7, Data, Size );
|
||||
|
||||
mbedtls_pkcs7_free( &pkcs7 );
|
||||
#else
|
||||
(void) Data;
|
||||
(void) Size;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
2
programs/fuzz/fuzz_pkcs7.options
Normal file
2
programs/fuzz/fuzz_pkcs7.options
Normal file
|
@ -0,0 +1,2 @@
|
|||
[libfuzzer]
|
||||
max_len = 65535
|
Loading…
Reference in a new issue