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 fuzz(const uint8_t in[],size_t len)13void fuzz(const uint8_t in[], size_t len) 14 { 15 try 16 { 17 Botan::DataSource_Memory input(in, len); 18 std::unique_ptr<Botan::Private_Key> key = Botan::PKCS8::load_key(input); 19 } 20 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 Botan::EC_Group::clear_registered_curve_data(); 27 } 28