8#include <botan/tls_ciphersuite.h>
9#include <botan/exceptn.h>
10#include <botan/internal/parsing.h>
11#include <botan/block_cipher.h>
12#include <botan/stream_cipher.h>
13#include <botan/hash.h>
20 switch(m_nonce_format)
35 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
41 switch(m_nonce_format)
51 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
57 return (suite == 0x00FF || suite == 0x5600);
101 auto s = std::lower_bound(all_suites.begin(), all_suites.end(), suite);
103 if(s != all_suites.end() && s->ciphersuite_code() == suite)
115 for(
auto suite : all_suites)
117 if(suite.to_string() ==
name)
126bool have_hash(std::string_view prf)
131bool have_cipher(std::string_view cipher)
139bool Ciphersuite::is_usable()
const
147#if !defined(BOTAN_HAS_TLS_CBC)
156#if !defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305)
163 BOTAN_ASSERT(cipher_and_mode.size() == 2,
"Expected format for AEAD algo");
164 if(!have_cipher(cipher_and_mode[0]))
167 const auto mode = cipher_and_mode[1];
169#if !defined(BOTAN_HAS_AEAD_CCM)
170 if(mode ==
"CCM" || mode ==
"CCM-8")
174#if !defined(BOTAN_HAS_AEAD_GCM)
179#if !defined(BOTAN_HAS_AEAD_OCB)
180 if(mode ==
"OCB(12)" || mode ==
"OCB")
196#if !defined(BOTAN_HAS_ECDH)
202#if !defined(BOTAN_HAS_DIFFIE_HELLMAN)
209#if !defined(BOTAN_HAS_ECDSA)
215#if !defined(BOTAN_HAS_RSA)
#define BOTAN_UNUSED(...)
#define BOTAN_ASSERT(expr, assertion_made)
static std::vector< std::string > providers(std::string_view algo_spec)
static std::vector< std::string > providers(std::string_view algo_spec)
static std::vector< std::string > providers(std::string_view algo_spec)
bool cbc_ciphersuite() const
bool signature_used() const
bool ecc_ciphersuite() const
bool psk_ciphersuite() const
uint16_t ciphersuite_code() const
size_t nonce_bytes_from_record(Protocol_Version version) const
static const std::vector< Ciphersuite > & all_known_ciphersuites()
Auth_Method auth_method() const
bool usable_in_version(Protocol_Version version) const
static std::optional< Ciphersuite > from_name(std::string_view name)
size_t nonce_bytes_from_handshake() const
static bool is_scsv(uint16_t suite)
static std::optional< Ciphersuite > by_id(uint16_t suite)
Kex_Algo kex_method() const
std::string mac_algo() const
std::string prf_algo() const
std::string cipher_algo() const
bool is_pre_tls_13() const
std::vector< std::string > split_on(std::string_view str, char delim)