| Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 1 | #include <stdint.h> | 
|  | 2 | #include "mbedtls/x509_crt.h" | 
|  | 3 |  | 
|  | 4 | int 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 ); | 
|  | 12 | if (ret == 0) { | 
|  | 13 | ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", &crt ); | 
|  | 14 | } | 
|  | 15 | mbedtls_x509_crt_free( &crt ); | 
|  | 16 | #else | 
|  | 17 | (void) Data; | 
|  | 18 | (void) Size; | 
|  | 19 | #endif | 
|  | 20 |  | 
|  | 21 | return 0; | 
|  | 22 | } |