-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TLS 1.3] Fuzz Target for Handshake Message Parsing #2977
Closed
+40
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <botan/internal/tls_handshake_layer_13.h> | ||
#include <botan/internal/tls_transcript_hash_13.h> | ||
|
||
|
||
namespace { | ||
|
||
Botan::TLS::Handshake_Layer prepare(const std::vector<uint8_t>& 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<uint8_t> 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) {} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reneme I'm unable to push the following change (403) to the vector's type:
Can you approve the suggestion so the build can hopefully pass? Alternately I can open a separate PR, but that feels overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to open a new PR anyway, the fuzzer now works as intended: #3013
I suggest closing this PR (I apparently can't do this myself) in favor of the other one, because (a) the other one is ready to merge (b) I can rebase the other PR if something else changes in the meantime.