blob: a5cb7ecdecc7a7c788e5df0b67446c4091da1903 [file] [log] [blame]
Philippe Antoine72333522018-05-03 16:40:24 +02001#include <stdint.h>
2#include "mbedtls/x509_crt.h"
3
Gilles Peskine1b6c09a2023-01-11 14:52:35 +01004int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
5{
Philippe Antoine72333522018-05-03 16:40:24 +02006#ifdef MBEDTLS_X509_CRT_PARSE_C
7 int ret;
8 mbedtls_x509_crt crt;
9 unsigned char buf[4096];
10
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010011 mbedtls_x509_crt_init(&crt);
12 ret = mbedtls_x509_crt_parse(&crt, Data, Size);
Philippe Antoine72333522018-05-03 16:40:24 +020013 if (ret == 0) {
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010014 ret = mbedtls_x509_crt_info((char *) buf, sizeof(buf) - 1, " ", &crt);
Philippe Antoine72333522018-05-03 16:40:24 +020015 }
Gilles Peskine1b6c09a2023-01-11 14:52:35 +010016 mbedtls_x509_crt_free(&crt);
Philippe Antoine72333522018-05-03 16:40:24 +020017#else
18 (void) Data;
19 (void) Size;
20#endif
21
22 return 0;
23}