Coverage Report

Created: 2023-02-13 06:21

/src/botan/src/fuzzer/tls_13_handshake_layer.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
* (C) 2022 Jack Lloyd
3
* (C) 2022 René Meusel - neXenio GmbH
4
* (C) 2022 Lukas Zeller - neXenio GmbH
5
*
6
* Botan is released under the Simplified BSD License (see license.txt)
7
*/
8
9
#include "fuzzers.h"
10
#include <botan/internal/tls_handshake_layer_13.h>
11
#include <botan/internal/tls_transcript_hash_13.h>
12
13
14
namespace {
15
16
Botan::TLS::Handshake_Layer prepare(const Botan::secure_vector<uint8_t>& data)
17
6.39k
   {
18
6.39k
   Botan::TLS::Handshake_Layer hl(Botan::TLS::Connection_Side::Client);
19
6.39k
   hl.copy_data(data);
20
6.39k
   return hl;
21
6.39k
   }
22
23
}  // namespace;
24
25
26
void fuzz(const uint8_t in[], size_t len)
27
4.97k
   {
28
4.97k
   static Botan::TLS::Default_Policy policy;
29
30
4.97k
   try
31
4.97k
      {
32
4.97k
      Botan::secure_vector<uint8_t> v(in, in + len);
33
4.97k
      auto hl1 = prepare(v);
34
4.97k
      Botan::TLS::Transcript_Hash_State ths("SHA-256");
35
34.7k
      while (hl1.next_message(policy, ths).has_value()) {};
36
37
4.97k
      auto hl2 = prepare(v);
38
4.97k
      while (hl2.next_post_handshake_message(policy).has_value()) {};
39
4.97k
      }
40
4.97k
   catch(Botan::Exception& e) {}
41
4.97k
   }