8#include <botan/tls_ciphersuite.h>
10#include <botan/block_cipher.h>
11#include <botan/exceptn.h>
12#include <botan/hash.h>
13#include <botan/stream_cipher.h>
14#include <botan/internal/parsing.h>
20 switch(m_nonce_format) {
34 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
39 switch(m_nonce_format) {
48 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
53 return (suite == 0x00FF || suite == 0x5600);
92 auto s = std::lower_bound(all_suites.begin(), all_suites.end(), suite);
94 if(s != all_suites.end() && s->ciphersuite_code() == suite) {
104 for(
auto suite : all_suites) {
105 if(suite.to_string() ==
name) {
115bool have_hash(std::string_view prf) {
119bool have_cipher(std::string_view cipher) {
125bool Ciphersuite::is_usable()
const {
126 if(!m_cipher_keylen) {
134#if !defined(BOTAN_HAS_TLS_CBC)
141#if !defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305)
146 BOTAN_ASSERT(cipher_and_mode.size() == 2,
"Expected format for AEAD algo");
147 if(!have_cipher(cipher_and_mode[0])) {
151 const auto mode = cipher_and_mode[1];
153#if !defined(BOTAN_HAS_AEAD_CCM)
154 if(mode ==
"CCM" || mode ==
"CCM-8")
158#if !defined(BOTAN_HAS_AEAD_GCM)
163#if !defined(BOTAN_HAS_AEAD_OCB)
164 if(mode ==
"OCB(12)" || mode ==
"OCB")
182#if !defined(BOTAN_HAS_ECDH)
186#if !defined(BOTAN_HAS_DIFFIE_HELLMAN)
192#if !defined(BOTAN_HAS_ECDSA)
196#if !defined(BOTAN_HAS_RSA)
#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
bool aead_ciphersuite() 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)