]>
git.ipfire.org Git - thirdparty/openssl.git/blob - fuzz/driver.c
2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.openssl.org/source/license.html
8 * or in the file LICENSE in the source distribution.
13 #include <openssl/opensslconf.h>
16 #ifndef OPENSSL_NO_FUZZ_LIBFUZZER
18 int LLVMFuzzerInitialize(int *argc
, char ***argv
);
19 int LLVMFuzzerTestOneInput(const uint8_t *buf
, size_t len
);
21 int LLVMFuzzerInitialize(int *argc
, char ***argv
)
23 return FuzzerInitialize(argc
, argv
);
26 int LLVMFuzzerTestOneInput(const uint8_t *buf
, size_t len
)
28 return FuzzerTestOneInput(buf
, len
);
31 #elif !defined(OPENSSL_NO_FUZZ_AFL)
33 #define BUF_SIZE 65536
35 int main(int argc
, char** argv
)
37 FuzzerInitialize(&argc
, &argv
);
39 while (__AFL_LOOP(10000)) {
40 uint8_t *buf
= malloc(BUF_SIZE
);
41 size_t size
= read(0, buf
, BUF_SIZE
);
43 FuzzerTestOneInput(buf
, size
);
53 #error "Unsupported fuzzer"