Botan
2.1.0
Crypto and TLS for C++11
|
#include <tls_cbc.h>
Public Member Functions | |
bool | authenticated () const override |
void | clear () overridefinal |
size_t | default_nonce_length () const overridefinal |
void | finish (secure_vector< uint8_t > &final_block, size_t offset=0) override |
Key_Length_Specification | key_spec () const overridefinal |
size_t | minimum_final_size () const override |
std::string | name () const overridefinal |
size_t | output_length (size_t input_length) const override |
size_t | process (uint8_t buf[], size_t sz) overridefinal |
virtual std::string | provider () const |
void | reset () overridefinal |
template<typename Alloc > | |
void | set_ad (const std::vector< uint8_t, Alloc > &ad) |
void | set_associated_data (const uint8_t ad[], size_t ad_len) override |
template<typename Alloc > | |
void | set_associated_data_vec (const std::vector< uint8_t, Alloc > &ad) |
template<typename Alloc > | |
void | set_key (const std::vector< uint8_t, Alloc > &key) |
void | set_key (const SymmetricKey &key) |
void | set_key (const uint8_t key[], size_t length) |
template<typename Alloc > | |
void | start (const std::vector< uint8_t, Alloc > &nonce) |
void | start (const uint8_t nonce[], size_t nonce_len) |
void | start () |
size_t | tag_size () const overridefinal |
TLS_CBC_HMAC_AEAD_Encryption (const std::string &cipher_algo, const size_t cipher_keylen, const std::string &mac_algo, const size_t mac_keylen, bool use_explicit_iv, bool use_encrypt_then_mac) | |
void | update (secure_vector< uint8_t > &buffer, size_t offset=0) |
size_t | update_granularity () const overridefinal |
bool | valid_keylength (size_t length) const |
bool | valid_nonce_length (size_t nl) const overridefinal |
Protected Member Functions | |
std::vector< uint8_t > & | assoc_data () |
std::vector< uint8_t > | assoc_data_with_len (uint16_t len) |
size_t | block_size () const |
secure_vector< uint8_t > & | cbc_state () |
BlockCipher & | cipher () const |
size_t | cipher_keylen () const |
size_t | iv_size () const |
MessageAuthenticationCode & | mac () const |
size_t | mac_keylen () const |
secure_vector< uint8_t > & | msg () |
bool | use_encrypt_then_mac () const |
|
inline |
Definition at line 110 of file tls_cbc.h.
|
inlineprotectedinherited |
Definition at line 75 of file tls_cbc.h.
Referenced by finish(), and set_associated_data().
|
protectedinherited |
Definition at line 114 of file tls_cbc.cpp.
References BOTAN_ASSERT, and Botan::get_byte().
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish().
|
inlineoverridevirtualinherited |
Reimplemented from Botan::Cipher_Mode.
|
inlineprotectedinherited |
Definition at line 58 of file tls_cbc.h.
Referenced by finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), output_length(), set_associated_data(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::valid_nonce_length().
|
inlineprotectedinherited |
Definition at line 74 of file tls_cbc.h.
Referenced by finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::reset().
|
inlineprotectedinherited |
Definition at line 62 of file tls_cbc.h.
References BOTAN_ASSERT_NONNULL.
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::clear().
|
inlineprotectedinherited |
|
finaloverridevirtualinherited |
Zeroise all state See also reset_msg()
Implements Botan::Cipher_Mode.
Definition at line 46 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::cipher(), Botan::SymmetricAlgorithm::clear(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::mac(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::reset().
|
inlinefinaloverridevirtualinherited |
Reimplemented from Botan::AEAD_Mode.
|
overridevirtual |
Complete processing of a message.
final_block | in/out parameter which must be at least minimum_final_size() bytes, and will be set to any final output |
offset | an offset into final_block to begin processing |
Implements Botan::Cipher_Mode.
Definition at line 168 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::assoc_data(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::block_size(), BOTAN_ASSERT, Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::cbc_state(), Botan::Buffered_Computation::final(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::iv_size(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::mac(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::msg(), Botan::round_up(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::tag_size(), Botan::Buffered_Computation::update(), Botan::Cipher_Mode::update(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::use_encrypt_then_mac().
|
inlineprotectedinherited |
Definition at line 57 of file tls_cbc.h.
Referenced by finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), set_associated_data(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::valid_nonce_length().
|
finaloverridevirtualinherited |
Implements Botan::Cipher_Mode.
Definition at line 77 of file tls_cbc.cpp.
|
inlineprotectedinherited |
Definition at line 68 of file tls_cbc.h.
References BOTAN_ASSERT_NONNULL, and m_mac.
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::clear(), finish(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish().
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Implements Botan::Cipher_Mode.
|
inlineprotectedinherited |
Definition at line 76 of file tls_cbc.h.
Referenced by finish(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish().
|
finaloverridevirtualinherited |
|
overridevirtual |
Returns the size of the output if this transform is used to process a message with input_length bytes. Will throw if unable to give a precise answer.
Implements Botan::Cipher_Mode.
Definition at line 162 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::block_size(), Botan::round_up(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::tag_size(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::use_encrypt_then_mac().
|
finaloverridevirtualinherited |
Process message blocks
Input must be a multiple of update_granularity
Processes msg in place and returns bytes written. Normally this will be either msg_len (indicating the entire message was processed) or for certain AEAD modes zero (indicating that the mode requires the entire message be processed in one pass).
msg | the message to be processed |
msg_len | length of the message in bytes |
Implements Botan::Cipher_Mode.
Definition at line 108 of file tls_cbc.cpp.
|
inlinevirtualinherited |
Reimplemented in Botan::GCM_Mode.
Definition at line 202 of file cipher_mode.h.
|
finaloverridevirtualinherited |
Resets just the message specific state and allows encrypting again under the existing key
Implements Botan::Cipher_Mode.
Definition at line 53 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::cbc_state().
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::clear().
|
inlineinherited |
Set associated data that is not included in the ciphertext but that should be authenticated. Must be called after set_key and before start.
ad | the associated data |
Definition at line 66 of file aead.h.
Referenced by Botan::TLS::write_record().
|
overridevirtual |
Set associated data that is not included in the ciphertext but that should be authenticated. Must be called after set_key and before start.
Unless reset by another call, the associated data is kept between messages. Thus, if the AD does not change, calling once (after set_key) is the optimum.
ad | the associated data |
ad_len | length of add in bytes |
Reimplemented from Botan::TLS::TLS_CBC_HMAC_AEAD_Mode.
Definition at line 130 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::assoc_data(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::block_size(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::iv_size(), Botan::make_uint16(), Botan::round_up(), Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::set_associated_data(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::use_encrypt_then_mac().
|
inlineinherited |
|
inlineinherited |
Set the symmetric key of this transform
key | contains the key material |
Definition at line 172 of file cipher_mode.h.
Referenced by botan_cipher_set_key().
|
inlineinherited |
Set the symmetric key of this transform
key | contains the key material |
Definition at line 181 of file cipher_mode.h.
References Botan::OctetString::begin(), and Botan::OctetString::length().
|
inlineinherited |
Set the symmetric key of this transform
key | contains the key material |
length | in bytes of key param |
Definition at line 191 of file cipher_mode.h.
|
inlineinherited |
Begin processing a message.
nonce | the per message nonce |
Definition at line 38 of file cipher_mode.h.
Referenced by botan_cipher_start(), and Botan::TLS::write_record().
|
inlineinherited |
Begin processing a message.
nonce | the per message nonce |
nonce_len | length of nonce |
Definition at line 48 of file cipher_mode.h.
|
inlineinherited |
Begin processing a message.
Definition at line 56 of file cipher_mode.h.
|
inlinefinaloverridevirtualinherited |
Reimplemented from Botan::Cipher_Mode.
Definition at line 39 of file tls_cbc.h.
Referenced by finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), and output_length().
|
inlineinherited |
Process some data. Input must be in size update_granularity() uint8_t blocks.
buffer | in/out parameter which will possibly be resized |
offset | an offset into blocks to begin processing |
Definition at line 81 of file cipher_mode.h.
References BOTAN_ASSERT.
Referenced by botan_cipher_update(), Botan::XTS_Encryption::finish(), Botan::ChaCha20Poly1305_Encryption::finish(), Botan::CBC_Encryption::finish(), Botan::CFB_Encryption::finish(), Botan::EAX_Encryption::finish(), Botan::XTS_Decryption::finish(), Botan::CFB_Decryption::finish(), Botan::CTS_Encryption::finish(), Botan::CBC_Decryption::finish(), finish(), Botan::CTS_Decryption::finish(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish().
|
finaloverridevirtualinherited |
Implements Botan::Cipher_Mode.
Definition at line 65 of file tls_cbc.cpp.
|
inlineprotectedinherited |
Definition at line 60 of file tls_cbc.h.
Referenced by finish(), Botan::TLS::TLS_CBC_HMAC_AEAD_Decryption::finish(), output_length(), and set_associated_data().
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 162 of file cipher_mode.h.
|
finaloverridevirtualinherited |
Implements Botan::Cipher_Mode.
Definition at line 70 of file tls_cbc.cpp.
References Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::block_size(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::iv_size().