8#include <botan/tls_ciphersuite.h>
10#include <botan/assert.h>
11#include <botan/block_cipher.h>
12#include <botan/exceptn.h>
13#include <botan/hash.h>
14#include <botan/stream_cipher.h>
15#include <botan/internal/parsing.h>
21 switch(m_nonce_format) {
37 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
42 switch(m_nonce_format) {
52 throw Invalid_State(
"In Ciphersuite::nonce_bytes_from_handshake invalid enum value");
57 return (suite == 0x00FF || suite == 0x5600);
100 auto s = std::lower_bound(all_suites.begin(), all_suites.end(), suite);
102 if(s != all_suites.end() && s->ciphersuite_code() == suite) {
112 for(
auto suite : all_suites) {
113 if(suite.to_string() == name) {
123bool have_hash(std::string_view prf) {
127bool have_cipher(std::string_view cipher) {
133bool Ciphersuite::is_usable()
const {
136 if(((
cipher_algo() !=
"NULL") && (m_cipher_keylen == 0)) ||
137 ((
cipher_algo() ==
"NULL") && (m_cipher_keylen != 0))) {
145#if !defined(BOTAN_HAS_TLS_CBC)
151#if !defined(BOTAN_HAS_TLS_NULL)
159#if !defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305)
164 BOTAN_ASSERT(cipher_and_mode.size() == 2,
"Expected format for AEAD algo");
165 if(!have_cipher(cipher_and_mode[0])) {
169 const auto& mode = cipher_and_mode[1];
171#if !defined(BOTAN_HAS_AEAD_CCM)
172 if(mode ==
"CCM" || mode ==
"CCM-8") {
177#if !defined(BOTAN_HAS_AEAD_GCM)
183#if !defined(BOTAN_HAS_AEAD_OCB)
184 if(mode ==
"OCB(12)" || mode ==
"OCB") {
203#if !defined(BOTAN_HAS_ECDH)
207#if !defined(BOTAN_HAS_DIFFIE_HELLMAN)
213#if !defined(BOTAN_HAS_ECDSA)
217#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
bool null_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)