/src/mbedtls/programs/fuzz/fuzz_x509crl.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include <stdint.h> |
2 | | #include "mbedtls/x509_crl.h" |
3 | | #include "common.h" |
4 | | |
5 | | int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) |
6 | 13.2k | { |
7 | 13.2k | #ifdef MBEDTLS_X509_CRL_PARSE_C |
8 | 13.2k | int ret; |
9 | 13.2k | mbedtls_x509_crl crl; |
10 | 13.2k | unsigned char buf[4096]; |
11 | | |
12 | 13.2k | mbedtls_x509_crl_init(&crl); |
13 | | #if defined(MBEDTLS_USE_PSA_CRYPTO) |
14 | | psa_status_t status = psa_crypto_init(); |
15 | 6 | if (status != PSA_SUCCESS) { |
16 | 6 | goto exit; |
17 | 6 | } |
18 | 0 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ |
19 | 0 | ret = mbedtls_x509_crl_parse(&crl, Data, Size); |
20 | 0 | #if !defined(MBEDTLS_X509_REMOVE_INFO) |
21 | 13.2k | if (ret == 0) { |
22 | 1.19k | ret = mbedtls_x509_crl_info((char *) buf, sizeof(buf) - 1, " ", &crl); |
23 | 1.19k | } |
24 | | #else |
25 | | ((void) ret); |
26 | | ((void) buf); |
27 | | #endif /* !MBEDTLS_X509_REMOVE_INFO */ |
28 | |
|
29 | | #if defined(MBEDTLS_USE_PSA_CRYPTO) |
30 | 6 | exit: |
31 | 6 | mbedtls_psa_crypto_free(); |
32 | 6 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ |
33 | 6 | mbedtls_x509_crl_free(&crl); |
34 | | #else |
35 | | (void) Data; |
36 | | (void) Size; |
37 | | #endif |
38 | | |
39 | 6 | return 0; |
40 | 0 | } Line | Count | Source | 6 | 13.2k | { | 7 | 13.2k | #ifdef MBEDTLS_X509_CRL_PARSE_C | 8 | 13.2k | int ret; | 9 | 13.2k | mbedtls_x509_crl crl; | 10 | 13.2k | unsigned char buf[4096]; | 11 | | | 12 | 13.2k | mbedtls_x509_crl_init(&crl); | 13 | | #if defined(MBEDTLS_USE_PSA_CRYPTO) | 14 | | psa_status_t status = psa_crypto_init(); | 15 | | if (status != PSA_SUCCESS) { | 16 | | goto exit; | 17 | | } | 18 | | #endif /* MBEDTLS_USE_PSA_CRYPTO */ | 19 | 13.2k | ret = mbedtls_x509_crl_parse(&crl, Data, Size); | 20 | 13.2k | #if !defined(MBEDTLS_X509_REMOVE_INFO) | 21 | 13.2k | if (ret == 0) { | 22 | 1.19k | ret = mbedtls_x509_crl_info((char *) buf, sizeof(buf) - 1, " ", &crl); | 23 | 1.19k | } | 24 | | #else | 25 | | ((void) ret); | 26 | | ((void) buf); | 27 | | #endif /* !MBEDTLS_X509_REMOVE_INFO */ | 28 | | | 29 | | #if defined(MBEDTLS_USE_PSA_CRYPTO) | 30 | | exit: | 31 | | mbedtls_psa_crypto_free(); | 32 | | #endif /* MBEDTLS_USE_PSA_CRYPTO */ | 33 | 13.2k | mbedtls_x509_crl_free(&crl); | 34 | | #else | 35 | | (void) Data; | 36 | | (void) Size; | 37 | | #endif | 38 | | | 39 | 13.2k | return 0; | 40 | 13.2k | } |
Line | Count | Source | 6 | 6 | { | 7 | 6 | #ifdef MBEDTLS_X509_CRL_PARSE_C | 8 | 6 | int ret; | 9 | 6 | mbedtls_x509_crl crl; | 10 | 6 | unsigned char buf[4096]; | 11 | | | 12 | 6 | mbedtls_x509_crl_init(&crl); | 13 | 6 | #if defined(MBEDTLS_USE_PSA_CRYPTO) | 14 | 6 | psa_status_t status = psa_crypto_init(); | 15 | 6 | if (status != PSA_SUCCESS) { | 16 | 6 | goto exit; | 17 | 6 | } | 18 | 0 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ | 19 | 0 | ret = mbedtls_x509_crl_parse(&crl, Data, Size); | 20 | 0 | #if !defined(MBEDTLS_X509_REMOVE_INFO) | 21 | 0 | if (ret == 0) { | 22 | 0 | ret = mbedtls_x509_crl_info((char *) buf, sizeof(buf) - 1, " ", &crl); | 23 | 0 | } | 24 | | #else | 25 | | ((void) ret); | 26 | | ((void) buf); | 27 | | #endif /* !MBEDTLS_X509_REMOVE_INFO */ | 28 | |
| 29 | 0 | #if defined(MBEDTLS_USE_PSA_CRYPTO) | 30 | 6 | exit: | 31 | 6 | mbedtls_psa_crypto_free(); | 32 | 6 | #endif /* MBEDTLS_USE_PSA_CRYPTO */ | 33 | 6 | mbedtls_x509_crl_free(&crl); | 34 | | #else | 35 | | (void) Data; | 36 | | (void) Size; | 37 | | #endif | 38 | | | 39 | 6 | return 0; | 40 | 0 | } |
|