fuzz_x509crl.c 660 B

123456789101112131415161718192021222324252627282930
  1. #define MBEDTLS_ALLOW_PRIVATE_ACCESS
  2. #include <stdint.h>
  3. #include "mbedtls/x509_crl.h"
  4. int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
  5. {
  6. #ifdef MBEDTLS_X509_CRL_PARSE_C
  7. int ret;
  8. mbedtls_x509_crl crl;
  9. unsigned char buf[4096];
  10. mbedtls_x509_crl_init(&crl);
  11. ret = mbedtls_x509_crl_parse(&crl, Data, Size);
  12. #if !defined(MBEDTLS_X509_REMOVE_INFO)
  13. if (ret == 0) {
  14. ret = mbedtls_x509_crl_info((char *) buf, sizeof(buf) - 1, " ", &crl);
  15. }
  16. #else
  17. ((void) ret);
  18. ((void) buf);
  19. #endif /* !MBEDTLS_X509_REMOVE_INFO */
  20. mbedtls_x509_crl_free(&crl);
  21. #else
  22. (void) Data;
  23. (void) Size;
  24. #endif
  25. return 0;
  26. }