|
Botan 3.14.1
Crypto and TLS for C&
|
#include <tls_channel_impl_12.h>
Public Member Functions | |
| virtual std::string | application_protocol () const =0 |
| Channel_Impl_12 (Channel_Impl_12 &&other)=delete | |
| Channel_Impl_12 (const Channel_Impl_12 &other)=delete | |
| Channel_Impl_12 (const std::shared_ptr< Callbacks > &callbacks, const std::shared_ptr< Session_Manager > &session_manager, const std::shared_ptr< RandomNumberGenerator > &rng, const std::shared_ptr< const Policy > &policy, bool is_server, TLS_Flavor flavor, size_t io_buf_sz=TLS::Channel::IO_BUF_DEFAULT_SIZE) | |
| void | close () |
| std::optional< std::string > | external_psk_identity () const override |
| size_t | from_peer (std::span< const uint8_t > data) override |
| bool | is_active () const override |
| bool | is_closed () const override |
| bool | is_closed_for_reading () const override |
| bool | is_closed_for_writing () const override |
| bool | is_handshake_complete () const override |
| SymmetricKey | key_material_export (std::string_view label, std::string_view context, size_t length) const override |
| virtual bool | new_session_ticket_supported () const |
| std::optional< std::chrono::milliseconds > | next_retransmission_timeout () const override |
| Channel_Impl_12 & | operator= (Channel_Impl_12 &&other)=delete |
| Channel_Impl_12 & | operator= (const Channel_Impl_12 &other)=delete |
| std::vector< X509_Certificate > | peer_cert_chain () const override |
| std::shared_ptr< const Public_Key > | peer_raw_public_key () const override |
| void | renegotiate (bool force_full_renegotiation=false) override |
| bool | secure_renegotiation_supported () const override |
| void | send_alert (const Alert &alert) override |
| void | send_fatal_alert (Alert::Type type) |
| virtual size_t | send_new_session_tickets (const size_t) |
| void | send_warning_alert (Alert::Type type) |
| bool | timeout_check () override |
| void | to_peer (std::span< const uint8_t > data) override |
| void | update_traffic_keys (bool request_peer_update=false) override |
| ~Channel_Impl_12 () override | |
Protected Types | |
| enum class | TimerGeneration : bool { Advance , Keep } |
Generic interface for TLSv.12 endpoint
Definition at line 40 of file tls_channel_impl_12.h.
|
strongprotected |
| Enumerator | |
|---|---|
| Advance | |
| Keep | |
Definition at line 167 of file tls_channel_impl_12.h.
|
explicit |
Set up a new TLS session
| callbacks | contains a set of callback function references required by the TLS endpoint. |
| session_manager | manages session state |
| rng | a random number generator |
| policy | specifies other connection policy information |
| is_server | whether this is a server session or not |
| flavor | specifies the TLS flavor (TLS or DTLS) |
| io_buf_sz | This many bytes of memory will be preallocated for the read and write buffers. Smaller values just mean reallocations and copies are more likely. |
Definition at line 92 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, callbacks(), flavor(), policy(), rng(), and session_manager().
Referenced by Channel_Impl_12(), Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), operator=(), operator=(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
delete |
References Channel_Impl_12().
|
delete |
References Channel_Impl_12().
|
overridedefault |
|
protected |
Definition at line 568 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, callbacks(), Botan::TLS::DTLS, Botan::map_remove_if(), negotiated_application_protocol(), and Botan::TLS::Callbacks::tls_session_activated().
|
inlineprotected |
Definition at line 154 of file tls_channel_impl_12.h.
Referenced by Botan::TLS::Client_Impl_12::application_protocol().
|
pure virtualinherited |
Return the protocol notification set for this connection, if any (ALPN). This value is not tied to the session and a later renegotiation of the same session can choose a new protocol.
Implemented in Botan::TLS::Client_Impl_12, Botan::TLS::Client_Impl_13, and Botan::TLS::Server_Impl_13.
|
inlineprotected |
Definition at line 203 of file tls_channel_impl_12.h.
Referenced by activate_session(), change_cipher_spec_reader(), Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::create(), Botan::TLS::Server_Impl_12::create(), create_handshake_state(), key_material_export(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
protected |
Definition at line 483 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT, callbacks(), Botan::TLS::Client, Botan::TLS::DTLS, Botan::TLS::Server, and Botan::TLS::Callbacks::tls_current_monotonic_clock_ms().
|
protected |
Definition at line 521 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT.
|
inlineinherited |
Send a close notification alert
Definition at line 90 of file tls_channel_impl.h.
References send_warning_alert().
|
protected |
Definition at line 246 of file tls_channel_impl_12.cpp.
References BOTAN_ARG_CHECK, callbacks(), Botan::TLS::Policy::dtls_default_mtu(), Botan::TLS::Policy::dtls_initial_timeout(), Botan::TLS::Policy::dtls_maximum_retransmissions(), Botan::TLS::Policy::dtls_maximum_timeout(), Botan::TLS::Protocol_Version::is_datagram_protocol(), new_handshake_state(), policy(), Botan::TLS::Callbacks::tls_current_monotonic_clock_ms(), and Botan::TLS::Protocol_Version::to_string().
Referenced by renegotiate().
|
inlineprotectedvirtual |
Definition at line 218 of file tls_channel_impl_12.h.
Referenced by from_peer().
|
inlineprotectedinherited |
Definition at line 314 of file tls_channel_impl.h.
Referenced by Botan::TLS::Channel_Impl_13::from_peer().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 236 of file tls_channel_impl_12.cpp.
|
inlineprotected |
Definition at line 205 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::create(), Botan::TLS::Server_Impl_12::create(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
overridevirtual |
Inject TLS traffic received from counterparty
Implements Botan::TLS::Channel_Impl.
Definition at line 615 of file tls_channel_impl_12.cpp.
References Botan::TLS::Alert, Botan::TLS::ApplicationData, BOTAN_ASSERT, BOTAN_ASSERT_IMPLICATION, Botan::TLS::ChangeCipherSpec, Botan::TLS::ClientHello, Botan::TLS::DTLS, dtls_epoch0_restart_enabled(), Botan::TLS::Record_Header::epoch(), Botan::TLS::Handshake, Botan::TLS::Invalid, Botan::TLS::Protocol_Version::major_version(), Botan::TLS::MAX_PLAINTEXT_SIZE, Botan::TLS::Record_Header::needed(), Botan::TLS::Channel_Impl::note_useless_record(), policy(), Botan::TLS::read_record(), Botan::TLS::Channel_Impl::reset_useless_records(), Botan::TLS::Channel_Impl::send_fatal_alert(), Botan::TLS::Record_Header::sequence(), Botan::TLS::Record_Header::type(), Botan::TLS::TLS_Exception::type(), and Botan::TLS::Record_Header::version().
|
protectedpure virtual |
Referenced by renegotiate().
|
protected |
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 552 of file tls_channel_impl_12.cpp.
References is_closed(), and is_handshake_complete().
Referenced by to_peer().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 564 of file tls_channel_impl_12.cpp.
Referenced by is_active(), is_closed_for_reading(), is_closed_for_writing(), and send_alert().
|
inlineoverridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 98 of file tls_channel_impl_12.h.
References is_closed().
|
inlineoverridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 100 of file tls_channel_impl_12.h.
References is_closed().
|
inlineprotectedinherited |
Indicates whether a downgrade to TLS 1.2 or lower is in progress
Definition at line 306 of file tls_channel_impl.h.
Referenced by Botan::TLS::Channel_Impl_13::from_peer(), Botan::TLS::Channel_Impl_13::key_material_export(), Botan::TLS::Channel_Impl_13::send_flight(), Botan::TLS::Channel_Impl_13::to_peer(), and Botan::TLS::Channel_Impl_13::update_traffic_keys().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 548 of file tls_channel_impl_12.cpp.
Referenced by is_active().
|
overridevirtual |
Key material export (RFC 5705)
| label | a disambiguating label string |
| context | a per-association context value |
| length | the length of the desired key in bytes |
Implements Botan::TLS::Channel_Impl.
Definition at line 1170 of file tls_channel_impl_12.cpp.
References Botan::as_span_of_bytes(), BOTAN_ASSERT_NOMSG, callbacks(), Botan::concat(), Botan::store_be(), and Botan::TLS::Callbacks::tls12_protocol_specific_kdf().
|
protected |
Ask the user to asynchronously and transparently invoke the time-based retransmission mechanism.
Definition at line 396 of file tls_channel_impl_12.cpp.
References Advance, Keep, and next_retransmission_timeout().
|
protectedpure virtual |
The application protocol of the handshake currently in progress, which becomes the protocol of the connection once that handshake activates
Referenced by activate_session().
|
protectedpure virtual |
Referenced by create_handshake_state().
|
inlinevirtualinherited |
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 156 of file tls_channel_impl.h.
|
overridevirtual |
Reimplemented from Botan::TLS::Channel_Impl.
Definition at line 556 of file tls_channel_impl_12.cpp.
References Botan::TLS::DTLS.
Referenced by maybe_arm_dtls_retransmission_timer().
|
protected |
Record the resumption handle this connection was established or resumed under, so that a fatal alert can invalidate it. The ServerHello session ID does not identify a ticket-backed session.
Definition at line 130 of file tls_channel_impl_12.cpp.
|
protectedinherited |
Called for each received record that was dropped without having any effect, eg an empty record or a warning alert. Throws if too many of these arrive without any useful record between.
Definition at line 14 of file tls_channel_impl.cpp.
References Botan::TLS::Policy::max_useless_records().
Referenced by Botan::TLS::Channel_Impl_12::from_peer().
|
delete |
References Channel_Impl_12().
|
delete |
References Channel_Impl_12().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 229 of file tls_channel_impl_12.cpp.
|
inlineoverridevirtual |
Note: Raw public key for authentication (RFC7250) is currently not implemented for TLS 1.2.
Implements Botan::TLS::Channel_Impl.
Definition at line 113 of file tls_channel_impl_12.h.
|
inlineprotected |
Definition at line 201 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::create(), Botan::TLS::Server_Impl_12::create(), create_handshake_state(), from_peer(), renegotiate(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
protectedpure virtual |
|
overridevirtual |
Attempt to renegotiate the session
| force_full_renegotiation | if true, require a full renegotiation, otherwise allow session resumption |
Implements Botan::TLS::Channel_Impl.
Definition at line 452 of file tls_channel_impl_12.cpp.
References Botan::TLS::Policy::allow_resumption_for_renegotiation(), create_handshake_state(), initiate_handshake(), policy(), and secure_renegotiation_supported().
|
protected |
Definition at line 172 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NOMSG, and Botan::TLS::DTLS.
|
inlineprotectedinherited |
Called for each received record that made progress
Definition at line 211 of file tls_channel_impl.h.
Referenced by Botan::TLS::Channel_Impl_12::from_peer().
|
inlineprotected |
Definition at line 197 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::create(), Botan::TLS::Server_Impl_12::create(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
protected |
Definition at line 1091 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, Botan::CT::is_equal(), Botan::TLS::Client_Hello_12::renegotiation_info(), Botan::TLS::Client_Hello_12::secure_renegotiation(), and secure_renegotiation_data_for_client_hello().
|
protected |
Definition at line 1111 of file tls_channel_impl_12.cpp.
References BOTAN_ASSERT_NONNULL, Botan::TLS::Ciphersuite::by_id(), Botan::TLS::Server_Hello::ciphersuite(), Botan::CT::is_equal(), Botan::TLS::Server_Hello_12::renegotiation_info(), Botan::TLS::Server_Hello_12::secure_renegotiation(), secure_renegotiation_data_for_server_hello(), and Botan::TLS::Server_Hello_12::supports_encrypt_then_mac().
|
protected |
Definition at line 1141 of file tls_channel_impl_12.cpp.
Referenced by secure_renegotiation_check().
|
protected |
Definition at line 1148 of file tls_channel_impl_12.cpp.
References Botan::concat().
Referenced by secure_renegotiation_check().
|
overridevirtual |
Implements Botan::TLS::Channel_Impl.
Definition at line 1156 of file tls_channel_impl_12.cpp.
Referenced by renegotiate().
|
overridevirtual |
Send a TLS alert message. If the alert is fatal, the internal state (keys, etc) will be reset.
| alert | the Alert to send |
Implements Botan::TLS::Channel_Impl.
Definition at line 1042 of file tls_channel_impl_12.cpp.
References Botan::TLS::Alert, is_closed(), Botan::TLS::Alert::is_fatal(), Botan::TLS::Alert::is_valid(), Botan::TLS::Alert::serialize(), and Botan::TLS::Alert::type().
|
inlineinherited |
Send a fatal alert
Definition at line 85 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by Botan::TLS::Channel_Impl_12::from_peer(), and Botan::TLS::Channel_Impl_13::from_peer().
|
inlinevirtualinherited |
Send tickets new session tickets to the peer. This is only supported on TLS 1.3 servers.
If the server's Session_Manager does not accept the generated Session objects, the server implementation won't be able to send new tickets. Additionally, anything but TLS 1.3 servers will return 0 (because they don't support sending such session tickets).
Reimplemented in Botan::TLS::Server_Impl_13.
Definition at line 169 of file tls_channel_impl.h.
|
inlineinherited |
Send a warning alert
Definition at line 80 of file tls_channel_impl.h.
References Botan::TLS::Alert, and send_alert().
Referenced by close().
|
inlineprotected |
Definition at line 199 of file tls_channel_impl_12.h.
Referenced by Channel_Impl_12(), Botan::TLS::Client_Impl_12::Client_Impl_12(), Botan::TLS::Client_Impl_12::create(), Botan::TLS::Server_Impl_12::create(), and Botan::TLS::Server_Impl_12::Server_Impl_12().
|
overridevirtual |
Perform a handshake timeout check. This does nothing unless this is a DTLS channel with a handshake in progress.
Implements Botan::TLS::Channel_Impl.
Definition at line 381 of file tls_channel_impl_12.cpp.
References Botan::TLS::DTLS.
|
overridevirtual |
Inject plaintext intended for counterparty Throws an exception if is_active() is false
Implements Botan::TLS::Channel_Impl.
Definition at line 1034 of file tls_channel_impl_12.cpp.
References Botan::TLS::ApplicationData, and is_active().
|
overridevirtual |
Attempt to update the session's traffic key material Note that this is possible with a TLS 1.3 channel, only.
| request_peer_update | if true, require a reciprocal key update |
Implements Botan::TLS::Channel_Impl.
Definition at line 479 of file tls_channel_impl_12.cpp.