fuzz_x509crt.c 512 B

12345678910111213141516171819202122
  1. #include <stdint.h>
  2. #include "mbedtls/x509_crt.h"
  3. int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
  4. #ifdef MBEDTLS_X509_CRT_PARSE_C
  5. int ret;
  6. mbedtls_x509_crt crt;
  7. unsigned char buf[4096];
  8. mbedtls_x509_crt_init( &crt );
  9. ret = mbedtls_x509_crt_parse( &crt, Data, Size );
  10. if (ret == 0) {
  11. ret = mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", &crt );
  12. }
  13. mbedtls_x509_crt_free( &crt );
  14. #else
  15. (void) Data;
  16. (void) Size;
  17. #endif
  18. return 0;
  19. }