|
Botan 3.14.1
Crypto and TLS for C&
|
#include <tls_record_layer_13.h>
Public Types | |
| using | ReadResult = variant_append_t<Record, BytesNeeded> |
Public Member Functions | |
| void | clear_read_buffer () override |
| void | copy_data (std::span< const uint8_t > data) override |
| void | disable_receiving_compat_mode () noexcept |
| void | disable_sending_compat_mode () noexcept |
| uint16_t | incoming_record_size_limit () const noexcept |
| ReadResult | next_record (Cipher_State *cipher_state=nullptr) override |
| uint16_t | outgoing_record_size_limit () const noexcept |
| void | prepare_record (const Policy &policy, Record_Type type, std::span< const uint8_t > payload, Cipher_State *cipher_state, secure_vector< uint8_t > &out) override |
| bool | receiving_compat_mode () const noexcept |
| uint16_t | record_payload_size_limit (const Policy &policy, Cipher_State *cipher_state=nullptr) const override |
| void | set_record_size_limits (uint16_t outgoing_limit, uint16_t incoming_limit) |
| TLS_Record_Layer (Connection_Side side) | |
Definition at line 149 of file tls_record_layer_13.h.
|
inherited |
Definition at line 44 of file tls_record_layer_13.h.
|
explicit |
Definition at line 85 of file tls_record_layer_13.cpp.
|
overridevirtual |
Clears any data currently stored in the read buffer. This is typically used for memory cleanup when the peer sent a CloseNotify alert.
Implements Botan::TLS::Record_Layer.
Definition at line 284 of file tls_record_layer_13.cpp.
|
overridevirtual |
Reads data that was received by the peer and stores it internally for further processing during the invocation of next_record().
| data_from_peer | The data to be parsed. |
Implements Botan::TLS::Record_Layer.
Definition at line 95 of file tls_record_layer_13.cpp.
References BOTAN_ASSERT_NOMSG, and BOTAN_DEBUG_ASSERT.
|
inlinenoexceptinherited |
Definition at line 133 of file tls_record_layer_13.h.
|
inlinenoexcept |
Definition at line 165 of file tls_record_layer_13.h.
|
inlinenoexceptinherited |
Definition at line 131 of file tls_record_layer_13.h.
Referenced by Botan::TLS::TLS_Record_Layer::next_record().
|
overridevirtual |
Parses one record off the internal buffer that is being filled using copy_data.
Return value contains either the number of bytes (size_t) needed to proceed with processing TLS records or a single plaintext TLS record content containing higher level protocol or application data.
| cipher_state | Optional pointer to a Cipher_State instance. If provided, the cipher_state should be ready to decrypt data. Pass nullptr to process plaintext data. |
Implements Botan::TLS::Record_Layer.
Definition at line 214 of file tls_record_layer_13.cpp.
References Botan::TLS::Alert, Botan::TLS::annotate_record_type(), Botan::TLS::ApplicationData, Botan::TLS::as_tls_cipher_state(), Botan::TLS::ChangeCipherSpec, Botan::generalize_to(), Botan::TLS::Record_Layer::incoming_record_size_limit(), and Botan::TLS::Record_Layer::receiving_compat_mode().
|
inlinenoexceptinherited |
Definition at line 129 of file tls_record_layer_13.h.
Referenced by Botan::TLS::TLS_Record_Layer::prepare_record(), and Botan::TLS::TLS_Record_Layer::record_payload_size_limit().
|
overridevirtual |
Prepares a record for transmission.
The payload passed into this function must fit into a single record,
| policy | The TLS policy for record size constraints |
| type | The type of the record to be prepared. |
| payload | The plaintext payload to be included in the record. |
| cipher_state | If not nullptr, the record will be encrypted using this cipher state. Pass nullptr to prepare a plaintext record. |
| out | The container the marshalled record is written to |
Implements Botan::TLS::Record_Layer.
Definition at line 112 of file tls_record_layer_13.cpp.
References Botan::append(), Botan::TLS::ApplicationData, Botan::TLS::as_tls_cipher_state(), BOTAN_ARG_CHECK, BOTAN_ASSERT_IMPLICATION, BOTAN_ASSERT_NOMSG, Botan::TLS::ChangeCipherSpec, Botan::checked_cast_to(), Botan::TLS::Record_Layer::outgoing_record_size_limit(), Botan::TLS::Policy::record_padding_bytes(), record_payload_size_limit(), and Botan::TLS::Record_TLS::serialize_header().
|
inlinenoexceptinherited |
Definition at line 135 of file tls_record_layer_13.h.
Referenced by Botan::TLS::TLS_Record_Layer::next_record().
|
overridevirtual |
Returns the maximum number of bytes that can be put into a record.
Both the specified and negotiated record size limit is taken into account. Depending on the cipher_state, the size of the record overhead (e.g. MAC, padding, record header, etc.) is also considered.
Implements Botan::TLS::Record_Layer.
Definition at line 192 of file tls_record_layer_13.cpp.
References BOTAN_UNUSED, Botan::TLS::MAX_PLAINTEXT_SIZE, and Botan::TLS::Record_Layer::outgoing_record_size_limit().
Referenced by prepare_record().
|
inherited |
Set the record size limits as negotiated by the "record_size_limit" extension (RFC 8449). The limits refer to the number of plaintext bytes to be encrypted/decrypted – INCLUDING the encrypted content type byte introduced with TLS 1.3. The record size limit is not applied to unprotected records. Incoming records that exceed the set limit will result in a fatal alert.
| outgoing_limit | the maximal number of plaintext bytes to be sent in a protected record |
| incoming_limit | the maximal number of plaintext bytes to be accepted in a received protected record |
Definition at line 68 of file tls_record_layer_13.cpp.
References BOTAN_ARG_CHECK, and Botan::TLS::MAX_PLAINTEXT_SIZE.
Referenced by clear_read_buffer(), and Botan::TLS::Channel_IO::set_record_size_limits().