Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 1 | #include <stdint.h> |
| 2 | #include "mbedtls/x509_csr.h" |
| 3 | |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame^] | 4 | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) |
| 5 | { |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 6 | #ifdef MBEDTLS_X509_CSR_PARSE_C |
| 7 | int ret; |
| 8 | mbedtls_x509_csr csr; |
| 9 | unsigned char buf[4096]; |
| 10 | |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame^] | 11 | mbedtls_x509_csr_init(&csr); |
| 12 | ret = mbedtls_x509_csr_parse(&csr, Data, Size); |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 13 | if (ret == 0) { |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame^] | 14 | ret = mbedtls_x509_csr_info((char *) buf, sizeof(buf) - 1, " ", &csr); |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 15 | } |
Gilles Peskine | 1b6c09a | 2023-01-11 14:52:35 +0100 | [diff] [blame^] | 16 | mbedtls_x509_csr_free(&csr); |
Philippe Antoine | 7233352 | 2018-05-03 16:40:24 +0200 | [diff] [blame] | 17 | #else |
| 18 | (void) Data; |
| 19 | (void) Size; |
| 20 | #endif |
| 21 | |
| 22 | return 0; |
| 23 | } |