void fuzz(const uint8_t in[], size_t len) { // Ressol is mostly used for ECC point decompression so best to test smaller sizes static const size_t p_bits = 256; static const BigInt p = random_prime(fuzzer_rng(), p_bits); static const Modular_Reducer mod_p(p); if(len > p_bits / 8) return; try { const BigInt a = BigInt::decode(in, len); BigInt a_sqrt = Botan::ressol(a, p); if(a_sqrt > 0) { const BigInt a_redc = mod_p.reduce(a); const BigInt z = mod_p.square(a_sqrt); if(z != a_redc) { std::cout << "A = " << a << "\n"; std::cout << "P = " << p << "\n"; std::cout << "R = " << a_sqrt << "\n"; std::cout << "Z = " << z << "\n"; abort(); } } } catch(Botan::Exception& e) {} return; }
void fuzz(const uint8_t in[], size_t len) { try { DataSource_Memory input(in, len); std::unique_ptr<Private_Key> key(PKCS8::load_key(input, fuzzer_rng())); } catch(Botan::Exception& e) { } }
void fuzz(const uint8_t in[], size_t len) { if(len == 0) return; auto dev_null = [](const uint8_t[], size_t) {}; auto ignore_alerts = [](Botan::TLS::Alert, const uint8_t[], size_t) {}; auto ignore_hs = [](const Botan::TLS::Session&) { return true; }; Botan::TLS::Session_Manager_Noop session_manager; Botan::TLS::Policy policy; Botan::TLS::Server_Information info("server.name", 443); Fuzzer_TLS_Server_Creds creds; auto next_proto_fn = [](const std::vector<std::string>& protos) -> std::string { if(protos.size() > 1) return protos[0]; else return "fuzzed"; }; const bool is_datagram = (len % 2 == 0); Botan::TLS::Server server(dev_null, dev_null, ignore_alerts, ignore_hs, session_manager, creds, policy, fuzzer_rng(), next_proto_fn, is_datagram); try { server.received_data(in, len); } catch(std::exception& e) { } }
void fuzz(const uint8_t in[], size_t len) { if(len == 0) return; auto dev_null = [](const byte[], size_t) {}; auto ignore_alerts = [](TLS::Alert, const byte[], size_t) {}; auto ignore_hs = [](const TLS::Session&) { abort(); return true; }; TLS::Session_Manager_Noop session_manager; TLS::Policy policy; TLS::Protocol_Version client_offer = TLS::Protocol_Version::TLS_V12; TLS::Server_Information info("server.name", 443); Fuzzer_TLS_Client_Creds creds; TLS::Client client(dev_null, dev_null, ignore_alerts, ignore_hs, session_manager, creds, policy, fuzzer_rng(), info, client_offer); try { client.received_data(in, len); } catch(std::exception& e) { } }