/src/botan/src/fuzzer/pkcs8.cpp
Line | Count | Source |
1 | | /* |
2 | | * (C) 2015,2016 Jack Lloyd |
3 | | * |
4 | | * Botan is released under the Simplified BSD License (see license.txt) |
5 | | */ |
6 | | |
7 | | #include "fuzzers.h" |
8 | | #include <botan/pk_keys.h> |
9 | | #include <botan/pkcs8.h> |
10 | | #include <botan/data_src.h> |
11 | | #include <botan/ec_group.h> |
12 | | |
13 | | void fuzz(const uint8_t in[], size_t len) |
14 | 23.2k | { |
15 | 23.2k | try |
16 | 23.2k | { |
17 | 23.2k | Botan::DataSource_Memory input(in, len); |
18 | 23.2k | std::unique_ptr<Botan::Private_Key> key = Botan::PKCS8::load_key(input); |
19 | 23.2k | } |
20 | 23.2k | catch(Botan::Exception& e) { } |
21 | | |
22 | | /* |
23 | | * This avoids OOMs in OSS-Fuzz caused by storing precomputations |
24 | | * for thousands of curves randomly generated by the fuzzer. |
25 | | */ |
26 | 23.2k | Botan::EC_Group::clear_registered_curve_data(); |
27 | 23.2k | } |