]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/test-x509.c
2 * Testing tool for X.509v3 routines
3 * Copyright (c) 2006-2019, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "tls/x509v3.h"
16 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
)
18 struct x509_certificate
*cert
;
20 cert
= x509_certificate_parse(data
, size
);
21 x509_certificate_free(cert
);
24 #else /* TEST_LIBFUZZER */
25 int main(int argc
, char *argv
[])
30 struct x509_certificate
*cert
;
34 f
= fopen(argv
[1], "rb");
37 len
= fread(buf
, 1, sizeof(buf
), f
);
40 cert
= x509_certificate_parse(buf
, len
);
42 printf("Failed to parse X.509 certificate\n");
43 x509_certificate_free(cert
);
47 #endif /* TEST_LIBFUZZER */