• 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 #ifdef MBEDTLS_X509_CRT_PARSE_C
8     int ret;
9     mbedtls_x509_crt crt;
10     unsigned char buf[4096];
11 
12     mbedtls_x509_crt_init( &crt );
13     ret = mbedtls_x509_crt_parse( &crt, Data, Size );
14 #if !defined(MBEDTLS_X509_REMOVE_INFO)
15     if (ret == 0) {
16         ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", &crt );
17     }
18 #else
19     ((void) ret);
20     ((void) buf);
21 #endif /* !MBEDTLS_X509_REMOVE_INFO */
22     mbedtls_x509_crt_free( &crt );
23 #else
24     (void) Data;
25     (void) Size;
26 #endif
27 
28     return 0;
29 }
30