blob: 7d274a8bebc627481d6b52d8269a64968832d884 [file] [log] [blame]
Philippe Antoine72333522018-05-03 16:40:24 +02001#include <stdint.h>
2#include "mbedtls/x509_crt.h"
3
4int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
5#ifdef MBEDTLS_X509_CRT_PARSE_C
6 int ret;
7 mbedtls_x509_crt crt;
8 unsigned char buf[4096];
9
10 mbedtls_x509_crt_init( &crt );
11 ret = mbedtls_x509_crt_parse( &crt, Data, Size );
Hanno Becker54ac1852020-10-09 09:45:29 +010012#if !defined(MBEDTLS_X509_REMOVE_INFO)
Philippe Antoine72333522018-05-03 16:40:24 +020013 if (ret == 0) {
14 ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", &crt );
15 }
Hanno Becker54ac1852020-10-09 09:45:29 +010016#else
17 ((void) ret);
18#endif /* !MBEDTLS_X509_REMOVE_INFO */
Philippe Antoine72333522018-05-03 16:40:24 +020019 mbedtls_x509_crt_free( &crt );
20#else
21 (void) Data;
22 (void) Size;
23#endif
24
25 return 0;
26}