• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define MBEDTLS_ALLOW_PRIVATE_ACCESS
2 
3 #include <stdint.h>
4 #include "mbedtls/x509_crt.h"
5 
LLVMFuzzerTestOneInput(const uint8_t * Data,size_t Size)6 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
7 {
8 #ifdef MBEDTLS_X509_CRT_PARSE_C
9     int ret;
10     mbedtls_x509_crt crt;
11     unsigned char buf[4096];
12 
13     mbedtls_x509_crt_init(&crt);
14     ret = mbedtls_x509_crt_parse(&crt, Data, Size);
15 #if !defined(MBEDTLS_X509_REMOVE_INFO)
16     if (ret == 0) {
17         ret = mbedtls_x509_crt_info((char *) buf, sizeof(buf) - 1, " ", &crt);
18     }
19 #else
20     ((void) ret);
21     ((void) buf);
22 #endif /* !MBEDTLS_X509_REMOVE_INFO */
23     mbedtls_x509_crt_free(&crt);
24 #else
25     (void) Data;
26     (void) Size;
27 #endif
28 
29     return 0;
30 }
31