blob: 5d0dfcfc53000ad36d9ea9cc5832634c4d88ad55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifdef __cplusplus
extern "C" {
#endif
#include <hf_ssl_lib.h>
#include <libhfuzz/libhfuzz.h>
#include <inttypes.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
int LLVMFuzzerInitialize(int* argc, char*** argv) {
HFInit();
HFResetRand();
return 1;
}
int LLVMFuzzerTestOneInput(const uint8_t* buf, size_t len) {
EVP_PKEY* key = d2i_AutoPrivateKey(NULL, &buf, len);
if (key == NULL) {
fprintf(stderr, "%s", ERR_error_string(ERR_get_error(), NULL));
} else {
BIO* out = BIO_new_fp(stdout, BIO_NOCLOSE);
EVP_PKEY_print_private(out, key, 4, NULL);
BIO_free(out);
}
EVP_PKEY_free(key);
return 0;
}
#ifdef __cplusplus
}
#endif
|