|
Botan 3.14.1
Crypto and TLS for C&
|
#include <tls_record_13.h>
Public Member Functions | |
| size_t | append (std::span< const uint8_t > bytes) |
| bool | complete () const |
| Returns true if the record has collected all its bytes. | |
| std::span< uint8_t, TLS_HEADER_SIZE > | header () |
| std::span< const uint8_t, TLS_HEADER_SIZE > | header () const |
| bool | header_complete () const |
| Returns true if the record has collected all header bytes. | |
| Protocol_Version | legacy_version () const |
| size_t | missing_bytes_hint () const |
| Returns the number of bytes needed to complete at least the record. | |
| Record_TLS & | operator= (const Record_TLS &)=delete |
| Record_TLS & | operator= (Record_TLS &&)=default |
| std::span< const uint8_t > | payload () const |
| uint16_t | payload_length () const |
| Record_TLS ()=default | |
| Record_TLS (const Record_TLS &)=delete | |
| Record_TLS (Record_TLS &&)=default | |
| size_t | stored_bytes () const |
| Returns the total number of bytes in this record, including the header. | |
| secure_vector< uint8_t > | take_payload () |
| Record_Type | type () const |
| ~Record_TLS ()=default | |
Static Public Member Functions | |
| static std::array< uint8_t, TLS_HEADER_SIZE > | serialize_header (Record_Type type, Protocol_Version legacy_version, uint16_t payload_length) |
Represents a TLS record composed of a partially ossified header and payload. The record might be incomplete, i.e. not all bytes of the header or the payload have been received, yet. The record can be extended by appending more bytes to it.
Once fully re-assembled, the payload buffer can be extracted from this record for decryption. This avoids an additional copy of the payload bytes.
Definition at line 59 of file tls_record_13.h.
|
default |
Referenced by operator=(), operator=(), Record_TLS(), and Record_TLS().
|
delete |
References Record_TLS().
|
default |
References Record_TLS().
|
default |
References append(), legacy_version(), payload_length(), serialize_header(), and type().
| size_t Botan::TLS::Record_TLS::append | ( | std::span< const uint8_t > | bytes | ) |
Appends bytes to an incomplete record. Once the record is complete, additional invocations will throw. If bytes contains more bytes than needed to complete the record, only the required number of bytes will be consumed and the rest will be ignored. The caller is responsible for keeping track of the number of bytes consumed and for discarding the consumed bytes from the buffer.
Definition at line 47 of file tls_record_13.cpp.
References Botan::TLS::Alert, Botan::TLS::ApplicationData, BOTAN_STATE_CHECK, Botan::TLS::ChangeCipherSpec, complete(), Botan::BufferSlicer::copy_into(), Botan::TLS::Handshake, header_complete(), legacy_version(), Botan::TLS::MAX_CIPHERTEXT_SIZE_TLS13, Botan::TLS::MAX_PLAINTEXT_SIZE, payload_length(), Botan::BufferSlicer::remaining(), Botan::BufferSlicer::take(), and type().
Referenced by ~Record_TLS().
|
inline |
Returns true if the record has collected all its bytes.
Definition at line 91 of file tls_record_13.h.
References missing_bytes_hint().
Referenced by append(), payload(), and take_payload().
| std::span< uint8_t, TLS_HEADER_SIZE > Botan::TLS::Record_TLS::header | ( | ) |
Definition at line 180 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, and header_complete().
Referenced by Botan::TLS::TLS_Cipher_State::deprotect_record().
| std::span< const uint8_t, TLS_HEADER_SIZE > Botan::TLS::Record_TLS::header | ( | ) | const |
Definition at line 185 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, and header_complete().
|
inline |
Returns true if the record has collected all header bytes.
Definition at line 88 of file tls_record_13.h.
References Botan::TLS::TLS_HEADER_SIZE.
Referenced by append(), header(), header(), legacy_version(), missing_bytes_hint(), payload_length(), and type().
| Protocol_Version Botan::TLS::Record_TLS::legacy_version | ( | ) | const |
Definition at line 170 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, header_complete(), and Botan::load_be().
Referenced by append(), serialize_header(), and ~Record_TLS().
| size_t Botan::TLS::Record_TLS::missing_bytes_hint | ( | ) | const |
Returns the number of bytes needed to complete at least the record.
Definition at line 153 of file tls_record_13.cpp.
References header_complete(), payload_length(), and Botan::TLS::TLS_HEADER_SIZE.
Referenced by complete().
|
delete |
References Record_TLS().
|
default |
References Record_TLS().
| std::span< const uint8_t > Botan::TLS::Record_TLS::payload | ( | ) | const |
Definition at line 190 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, and complete().
Referenced by Botan::TLS::TLS_Cipher_State::deprotect_record().
| uint16_t Botan::TLS::Record_TLS::payload_length | ( | ) | const |
Definition at line 175 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, header_complete(), and Botan::load_be().
Referenced by append(), missing_bytes_hint(), serialize_header(), and ~Record_TLS().
|
static |
Definition at line 39 of file tls_record_13.cpp.
References Botan::concat(), legacy_version(), payload_length(), Botan::store_be(), Botan::to_underlying(), and type().
Referenced by Botan::TLS::TLS_Record_Layer::prepare_record(), Botan::TLS::TLS_Cipher_State::protect_record(), and ~Record_TLS().
|
inline |
Returns the total number of bytes in this record, including the header.
Definition at line 94 of file tls_record_13.h.
| secure_vector< uint8_t > Botan::TLS::Record_TLS::take_payload | ( | ) |
Definition at line 195 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, and complete().
Referenced by Botan::TLS::TLS_Cipher_State::deprotect_record().
| Record_Type Botan::TLS::Record_TLS::type | ( | ) | const |
Definition at line 165 of file tls_record_13.cpp.
References BOTAN_STATE_CHECK, and header_complete().
Referenced by append(), Botan::TLS::TLS_Cipher_State::deprotect_record(), serialize_header(), and ~Record_TLS().