diff --git a/src/fuzzer/tls_13_handshake_layer.cpp b/src/fuzzer/tls_13_handshake_layer.cpp new file mode 100644 index 00000000000..060c785d594 --- /dev/null +++ b/src/fuzzer/tls_13_handshake_layer.cpp @@ -0,0 +1,40 @@ +/* +* (C) 2022 Jack Lloyd +* (C) 2002 René Meusel - neXenio GmbH +* +* Botan is released under the Simplified BSD License (see license.txt) +*/ + +#include "fuzzers.h" +#include +#include + + +namespace { + +Botan::TLS::Handshake_Layer prepare(const std::vector& data) + { + Botan::TLS::Handshake_Layer hl(Botan::TLS::Connection_Side::CLIENT); + hl.copy_data(data); + return hl; + } + +} // namespace; + + +void fuzz(const uint8_t in[], size_t len) + { + static Botan::TLS::Default_Policy policy; + + try + { + std::vector v(in, in + len); + auto hl1 = prepare(v); + Botan::TLS::Transcript_Hash_State ths("SHA-256"); + while (hl1.next_message(policy, ths).has_value()) {}; + + auto hl2 = prepare(v); + while (hl2.next_post_handshake_message(policy).has_value()) {}; + } + catch(Botan::Exception& e) {} + }