Botan 3.0.0-alpha0
Crypto and TLS for C&
|
Namespaces | |
namespace | detail |
namespace | Internal |
Typedefs | |
using | BytesNeeded = size_t |
using | Client_Handshake_State_13 = Handshake_State_13< Connection_Side::CLIENT, Client_Handshake_13_Message, Server_Handshake_13_Message > |
typedef Policy | Default_Policy |
typedef std::function< std::shared_ptr< Connection_Cipher_State >(uint16_t)> | get_cipherstate_fn |
using | Named_Group = Group_Params |
using | Server_Handshake_State_13 = Handshake_State_13< Connection_Side::SERVER, Server_Handshake_13_Message, Client_Handshake_13_Message > |
using | Transcript_Hash = std::vector< uint8_t > |
Functions | |
template<typename Alloc > | |
void | append_tls_length_value (std::vector< uint8_t, Alloc > &buf, const std::string &str, size_t tag_size) |
template<typename T , typename Alloc , typename Alloc2 > | |
void | append_tls_length_value (std::vector< uint8_t, Alloc > &buf, const std::vector< T, Alloc2 > &vals, size_t tag_size) |
template<typename T , typename Alloc > | |
void | append_tls_length_value (std::vector< uint8_t, Alloc > &buf, const T *vals, size_t vals_size, size_t tag_size) |
Auth_Method | auth_method_from_string (const std::string &str) |
std::string | auth_method_to_string (Auth_Method method) |
const BotanAlertCategory & | botan_alert_category () noexcept |
const StreamCategory & | botan_stream_category () |
uint16_t | check_tls_cbc_padding (const uint8_t record[], size_t record_len) |
Group_Params | group_param_from_string (const std::string &group_name) |
bool | group_param_is_dh (Group_Params group) |
std::string | group_param_to_string (Group_Params group) |
const char * | handshake_type_to_string (Handshake_Type type) |
std::string | kdf_algo_to_string (KDF_Algo algo) |
Kex_Algo | kex_method_from_string (const std::string &str) |
std::string | kex_method_to_string (Kex_Algo method) |
bool | key_exchange_is_psk (Kex_Algo m) |
boost::system::error_code | make_error_code (Botan::TLS::Alert::Type c) |
boost::system::error_code | make_error_code (Botan::TLS::StreamError e) |
std::vector< uint8_t > | make_hello_random (RandomNumberGenerator &rng, Callbacks &cb, const Policy &policy) |
bool | operator!= (const Server_Information &a, const Server_Information &b) |
bool | operator< (const Server_Information &a, const Server_Information &b) |
bool | operator== (const Server_Information &a, const Server_Information &b) |
Record_Header | read_record (bool is_datagram, secure_vector< uint8_t > &readbuf, const uint8_t input[], size_t input_len, size_t &consumed, secure_vector< uint8_t > &recbuf, Connection_Sequence_Numbers *sequence_numbers, const get_cipherstate_fn &get_cipherstate, bool allow_epoch0_restart) |
void | write_record (secure_vector< uint8_t > &output, uint8_t record_type, Protocol_Version version, uint64_t record_sequence, const uint8_t *message, size_t message_len, Connection_Cipher_State &cs, RandomNumberGenerator &rng) |
void | write_unencrypted_record (secure_vector< uint8_t > &output, uint8_t record_type, Protocol_Version version, uint64_t record_sequence, const uint8_t *message, size_t message_len) |
Cipher_State state machine adapted from RFC 8446 7.1.
0 | v PSK -> HKDF-Extract = Early Secret | +-----> Derive-Secret(., "ext binder" | "res binder", "") | = binder_key STATE PSK BINDER
This state is reached by constructing the Cipher_State using init_with_psk(). The state can then be further advanced using advance_with_client_hello() once the initial Client Hello is fully generated. | +--—> Derive-Secret(., "c e traffic", ClientHello) | = client_early_traffic_secret | +--—> Derive-Secret(., "e exp master", ClientHello) | = early_exporter_master_secret v Derive-Secret(., "derived", "") |
using Botan::TLS::BytesNeeded = typedef size_t |
Definition at line 37 of file tls_record_layer_13.h.
using Botan::TLS::Client_Handshake_State_13 = typedef Handshake_State_13<Connection_Side::CLIENT, Client_Handshake_13_Message, Server_Handshake_13_Message> |
Definition at line 135 of file tls_handshake_state_13.h.
typedef Policy Botan::TLS::Default_Policy |
Definition at line 402 of file tls_policy.h.
typedef std::function<std::shared_ptr<Connection_Cipher_State>(uint16_t)> Botan::TLS::get_cipherstate_fn |
Definition at line 163 of file tls_record.h.
typedef Group_Params Botan::TLS::Named_Group |
Definition at line 486 of file tls_extensions.h.
using Botan::TLS::Server_Handshake_State_13 = typedef Handshake_State_13<Connection_Side::SERVER, Server_Handshake_13_Message, Client_Handshake_13_Message> |
Definition at line 139 of file tls_handshake_state_13.h.
using Botan::TLS::Transcript_Hash = typedef std::vector<uint8_t> |
Definition at line 93 of file tls_magic.h.
anonymous enum |
Enumerator | |
---|---|
TLS_EMPTY_RENEGOTIATION_INFO_SCSV |
Definition at line 35 of file msg_client_hello.cpp.
|
strong |
Enumerator | |
---|---|
RSA | |
ECDSA | |
UNDEFINED | |
IMPLICIT |
Definition at line 66 of file tls_algos.h.
|
strong |
Definition at line 22 of file tls_algos.h.
|
strong |
Enumerator | |
---|---|
NONE | |
SECP256R1 | |
SECP384R1 | |
SECP521R1 | |
BRAINPOOL256R1 | |
BRAINPOOL384R1 | |
BRAINPOOL512R1 | |
X25519 | |
FFDHE_2048 | |
FFDHE_3072 | |
FFDHE_4096 | |
FFDHE_6144 | |
FFDHE_8192 |
Definition at line 83 of file tls_algos.h.
Definition at line 52 of file tls_extensions.h.
Definition at line 63 of file tls_magic.h.
|
strong |
Enumerator | |
---|---|
SHA_1 | |
SHA_256 | |
SHA_384 |
Definition at line 50 of file tls_algos.h.
|
strong |
Enumerator | |
---|---|
STATIC_RSA | |
DH | |
ECDH | |
CECPQ1 | |
PSK | |
ECDHE_PSK | |
UNDEFINED |
Definition at line 106 of file tls_algos.h.
|
strong |
Enumerator | |
---|---|
CBC_MODE | |
AEAD_IMPLICIT_4 | |
AEAD_XOR_12 |
Definition at line 58 of file tls_algos.h.
Enumerator | |
---|---|
INVALID | |
CHANGE_CIPHER_SPEC | |
ALERT | |
HANDSHAKE | |
APPLICATION_DATA | |
HEARTBEAT | |
NO_RECORD |
Definition at line 49 of file tls_magic.h.
enum Botan::TLS::Size_Limits : size_t |
Protocol Constants for SSL/TLS
TODO: this should not be an enum
Enumerator | |
---|---|
TLS_HEADER_SIZE | |
DTLS_HEADER_SIZE | |
MAX_PLAINTEXT_SIZE | |
MAX_COMPRESSED_SIZE | |
MAX_CIPHERTEXT_SIZE | |
MAX_AEAD_EXPANSION_SIZE_TLS13 | |
MAX_CIPHERTEXT_SIZE_TLS13 |
Definition at line 26 of file tls_magic.h.
Enumerator | |
---|---|
StreamTruncated |
Definition at line 33 of file asio_error.h.
void Botan::TLS::append_tls_length_value | ( | std::vector< uint8_t, Alloc > & | buf, |
const std::string & | str, | ||
size_t | tag_size | ||
) |
Definition at line 245 of file tls_reader.h.
References append_tls_length_value(), and Botan::cast_char_ptr_to_uint8().
void Botan::TLS::append_tls_length_value | ( | std::vector< uint8_t, Alloc > & | buf, |
const std::vector< T, Alloc2 > & | vals, | ||
size_t | tag_size | ||
) |
Definition at line 237 of file tls_reader.h.
References append_tls_length_value().
void Botan::TLS::append_tls_length_value | ( | std::vector< uint8_t, Alloc > & | buf, |
const T * | vals, | ||
size_t | vals_size, | ||
size_t | tag_size | ||
) |
Helper function for encoding length-tagged vectors
Definition at line 212 of file tls_reader.h.
References Botan::get_byte_var(), and T.
Referenced by append_tls_length_value(), Botan::TLS::Client_Key_Exchange::Client_Key_Exchange(), Botan::TLS::Client_Hello::serialize(), Botan::TLS::Server_Hello::serialize(), Botan::TLS::Certificate_13::serialize(), Botan::TLS::Certificate_Request_12::serialize(), Botan::TLS::New_Session_Ticket_12::serialize(), Botan::TLS::Renegotiation_Extension::serialize(), Botan::TLS::Application_Layer_Protocol_Notification::serialize(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().
Auth_Method BOTAN_TEST_API Botan::TLS::auth_method_from_string | ( | const std::string & | str | ) |
Definition at line 95 of file tls_algos.cpp.
std::string BOTAN_TEST_API Botan::TLS::auth_method_to_string | ( | Auth_Method | method | ) |
Definition at line 78 of file tls_algos.cpp.
References ECDSA, IMPLICIT, RSA, and UNDEFINED.
Referenced by Botan::TLS::Ciphersuite::sig_algo().
|
inlinenoexcept |
Definition at line 88 of file asio_error.h.
Referenced by make_error_code().
|
inline |
Definition at line 60 of file asio_error.h.
Referenced by make_error_code().
BOTAN_TEST_API uint16_t Botan::TLS::check_tls_cbc_padding | ( | const uint8_t | record[], |
size_t | record_len | ||
) |
Check the TLS padding of a record
record | the record bits |
record_len | length of record |
Definition at line 242 of file tls_cbc.cpp.
References Botan::CT::Mask< T >::is_equal(), Botan::CT::Mask< T >::is_lt(), and Botan::CT::Mask< T >::is_lte().
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish().
Group_Params Botan::TLS::group_param_from_string | ( | const std::string & | group_name | ) |
Definition at line 115 of file tls_algos.cpp.
References BRAINPOOL256R1, BRAINPOOL384R1, BRAINPOOL512R1, FFDHE_2048, FFDHE_3072, FFDHE_4096, FFDHE_6144, FFDHE_8192, NONE, SECP256R1, SECP384R1, SECP521R1, and X25519.
Referenced by Botan::TLS::Text_Policy::read_group_list().
bool Botan::TLS::group_param_is_dh | ( | Group_Params | group | ) |
Definition at line 109 of file tls_algos.cpp.
Referenced by Botan::TLS::Policy::default_dh_group(), Botan::TLS::Supported_Groups::dh_groups(), Botan::TLS::Supported_Groups::ec_groups(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().
std::string Botan::TLS::group_param_to_string | ( | Group_Params | group | ) |
Definition at line 146 of file tls_algos.cpp.
References BRAINPOOL256R1, BRAINPOOL384R1, BRAINPOOL512R1, FFDHE_2048, FFDHE_3072, FFDHE_4096, FFDHE_6144, FFDHE_8192, SECP256R1, SECP384R1, SECP521R1, and X25519.
Referenced by Botan::TLS::Callbacks::tls_decode_group_param().
const char * Botan::TLS::handshake_type_to_string | ( | Handshake_Type | type | ) |
Definition at line 23 of file tls_handshake_state.cpp.
References CERTIFICATE, CERTIFICATE_REQUEST, CERTIFICATE_STATUS, CERTIFICATE_URL, CERTIFICATE_VERIFY, CLIENT_HELLO, CLIENT_KEX, ENCRYPTED_EXTENSIONS, END_OF_EARLY_DATA, FINISHED, HANDSHAKE_CCS, HANDSHAKE_NONE, HELLO_REQUEST, HELLO_RETRY_REQUEST, HELLO_VERIFY_REQUEST, KEY_UPDATE, NEW_SESSION_TICKET, SERVER_HELLO, SERVER_HELLO_DONE, SERVER_KEX, Botan::ASN1::to_string(), type, and Botan::TLS::Alert::UNEXPECTED_MESSAGE.
Referenced by Botan::TLS::Handshake_Transitions::confirm_transition_to(), and Botan::TLS::Handshake_Message::type_string().
Definition at line 14 of file tls_algos.cpp.
References SHA_1, SHA_256, and SHA_384.
Referenced by Botan::TLS::Ciphersuite::prf_algo().
Kex_Algo BOTAN_TEST_API Botan::TLS::kex_method_from_string | ( | const std::string & | str | ) |
Definition at line 52 of file tls_algos.cpp.
References CECPQ1, DH, ECDH, ECDHE_PSK, PSK, STATIC_RSA, and UNDEFINED.
std::string BOTAN_TEST_API Botan::TLS::kex_method_to_string | ( | Kex_Algo | method | ) |
Definition at line 29 of file tls_algos.cpp.
References CECPQ1, DH, ECDH, ECDHE_PSK, PSK, STATIC_RSA, and UNDEFINED.
Referenced by Botan::TLS::Ciphersuite::kex_algo(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().
|
inline |
Definition at line 121 of file tls_algos.h.
References ECDHE_PSK, and PSK.
Referenced by Botan::TLS::Client_Key_Exchange::Client_Key_Exchange().
|
inline |
Definition at line 94 of file asio_error.h.
References botan_alert_category().
|
inline |
Definition at line 66 of file asio_error.h.
References botan_stream_category().
std::vector< uint8_t > Botan::TLS::make_hello_random | ( | RandomNumberGenerator & | rng, |
Callbacks & | cb, | ||
const Policy & | policy | ||
) |
Definition at line 40 of file msg_client_hello.cpp.
References Botan::TLS::Policy::allow_dtls12(), Botan::TLS::Policy::allow_tls12(), Botan::HashFunction::create_or_throw(), Botan::TLS::Policy::hash_hello_random(), Botan::TLS::Policy::include_time_in_hello_random(), Botan::RandomNumberGenerator::randomize(), Botan::store_be(), and Botan::TLS::Callbacks::tls_current_timestamp().
Referenced by Botan::TLS::Client_Hello_12::Client_Hello_12().
|
inline |
Definition at line 84 of file tls_server_info.h.
References b.
|
inline |
Definition at line 89 of file tls_server_info.h.
References b, Botan::TLS::Server_Information::hostname(), Botan::TLS::Server_Information::port(), and Botan::TLS::Server_Information::service().
|
inline |
Definition at line 76 of file tls_server_info.h.
References b, Botan::TLS::Server_Information::hostname(), Botan::TLS::Server_Information::port(), and Botan::TLS::Server_Information::service().
Record_Header Botan::TLS::read_record | ( | bool | is_datagram, |
secure_vector< uint8_t > & | read_buffer, | ||
const uint8_t | input[], | ||
size_t | input_len, | ||
size_t & | consumed, | ||
secure_vector< uint8_t > & | record_buf, | ||
Connection_Sequence_Numbers * | sequence_numbers, | ||
const get_cipherstate_fn & | get_cipherstate, | ||
bool | allow_epoch0_restart | ||
) |
Decode a TLS record
Definition at line 557 of file tls_record.cpp.
Referenced by Botan::TLS::Channel_Impl_12::received_data().
void Botan::TLS::write_record | ( | secure_vector< uint8_t > & | write_buffer, |
uint8_t | record_type, | ||
Protocol_Version | record_version, | ||
uint64_t | record_sequence, | ||
const uint8_t * | message, | ||
size_t | message_len, | ||
Connection_Cipher_State & | cipherstate, | ||
RandomNumberGenerator & | rng | ||
) |
Create a TLS record
write_buffer | the output record is placed here |
record_type | the record layer type |
record_version | the record layer version |
record_sequence | the record layer sequence number |
message | the record contents |
message_len | is size of message |
cipherstate | is the writing cipher state |
rng | is a random number generator |
Definition at line 222 of file tls_record.cpp.
References Botan::TLS::Connection_Cipher_State::aead(), Botan::TLS::Connection_Cipher_State::aead_nonce(), BOTAN_ASSERT, CBC_MODE, Botan::Cipher_Mode::finish(), Botan::TLS::Connection_Cipher_State::format_ad(), MAX_CIPHERTEXT_SIZE, Botan::TLS::Connection_Cipher_State::nonce_bytes_from_handshake(), Botan::TLS::Connection_Cipher_State::nonce_bytes_from_record(), Botan::TLS::Connection_Cipher_State::nonce_format(), Botan::Cipher_Mode::output_length(), Botan::AEAD_Mode::set_ad(), and Botan::Cipher_Mode::start().
void Botan::TLS::write_unencrypted_record | ( | secure_vector< uint8_t > & | write_buffer, |
uint8_t | record_type, | ||
Protocol_Version | record_version, | ||
uint64_t | record_sequence, | ||
const uint8_t * | message, | ||
size_t | message_len | ||
) |
Create an initial (unencrypted) TLS handshake record
write_buffer | the output record is placed here |
record_type | the record layer type |
record_version | the record layer version |
record_sequence | the record layer sequence number |
message | the record contents |
message_len | is size of message |
Definition at line 208 of file tls_record.cpp.
References APPLICATION_DATA.