Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef shared_h__ |
8 | | #define shared_h__ |
9 | | |
10 | | #include <assert.h> |
11 | | #include <random> |
12 | | #include "cert.h" |
13 | | #include "nss.h" |
14 | | |
15 | | extern "C" size_t LLVMFuzzerMutate(uint8_t *Data, size_t Size, size_t MaxSize); |
16 | | extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size, |
17 | | size_t MaxSize, unsigned int Seed); |
18 | | |
19 | | class NSSDatabase { |
20 | | public: |
21 | 36.1k | NSSDatabase() { assert(NSS_NoDB_Init(nullptr) == SECSuccess); } |
22 | 36.1k | ~NSSDatabase() { assert(NSS_Shutdown() == SECSuccess); } |
23 | | }; |
24 | | |
25 | | typedef std::vector<decltype(LLVMFuzzerCustomMutator) *> Mutators; |
26 | | |
27 | | size_t CustomMutate(Mutators mutators, uint8_t *data, size_t size, |
28 | | size_t max_size, unsigned int seed); |
29 | | |
30 | | #endif // shared_h__ |