• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 5079590438

25 May 2023 12:28PM UTC coverage: 92.228% (+0.5%) from 91.723%
5079590438

Pull #3502

github

Pull Request #3502: Apply clang-format to the codebase

75589 of 81959 relevant lines covered (92.23%)

12139530.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/src/lib/tls/tls13/msg_key_update.cpp
1
/*
2
* Key Update message
3
* (C) 2022 Jack Lloyd
4
*     2022 René Meusel, Hannes Rantzsch - neXenio GmbH
5
*
6
* Botan is released under the Simplified BSD License (see license.txt)
7
*/
8

9
#include <botan/tls_messages.h>
10

11
#include <botan/tls_exceptn.h>
12

13
namespace Botan::TLS {
14

15
Key_Update::Key_Update(const bool request_peer_update) : m_update_requested(request_peer_update) {}
7✔
16

17
Key_Update::Key_Update(const std::vector<uint8_t>& buf) {
28✔
18
   if(buf.size() != 1) {
28✔
19
      throw TLS_Exception(Alert::DecodeError, "malformed key_update");
×
20
   }
21

22
   // RFC 8446 4.6.3
23
   //    If an implementation receives any other value [than 0 or 1], it MUST
24
   //    terminate the connection with an "illegal_parameter" alert.
25
   const uint8_t update_requested = buf.at(0);
28✔
26
   if(update_requested > 1) {
28✔
27
      throw TLS_Exception(Alert::IllegalParameter, "unexpected key_update parameter");
1✔
28
   }
29

30
   m_update_requested = update_requested == 1;
27✔
31
}
27✔
32

33
std::vector<uint8_t> Key_Update::serialize() const { return std::vector<uint8_t>(1, (m_update_requested ? 1 : 0)); }
14✔
34

35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc