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:
Nayna Jain 2020-11-03 21:07:21 +00:00 committed by Nick Child
parent aa91d4ef0b
commit 106a0afc5a
4 changed files with 23 additions and 0 deletions

View file

@ -1,6 +1,7 @@
fuzz_client fuzz_client
fuzz_dtlsclient fuzz_dtlsclient
fuzz_dtlsserver fuzz_dtlsserver
fuzz_pkcs7
fuzz_privkey fuzz_privkey
fuzz_pubkey fuzz_pubkey
fuzz_server fuzz_server

View file

@ -12,6 +12,7 @@ set(executables_no_common_c
fuzz_x509crl fuzz_x509crl
fuzz_x509crt fuzz_x509crt
fuzz_x509csr fuzz_x509csr
fuzz_pkcs7
) )
set(executables_with_common_c set(executables_with_common_c

View 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;
}

View file

@ -0,0 +1,2 @@
[libfuzzer]
max_len = 65535