8 #include <botan/cbc_mac.h>
15 void CBC_MAC::add_data(
const uint8_t input[],
size_t length)
18 xor_buf(&m_state[m_position], input, xored);
24 m_cipher->encrypt(m_state);
30 m_cipher->encrypt(m_state);
35 xor_buf(m_state, input, length);
42 void CBC_MAC::final_result(uint8_t mac[])
45 m_cipher->encrypt(m_state);
47 copy_mem(mac, m_state.data(), m_state.size());
55 void CBC_MAC::key_schedule(
const uint8_t key[],
size_t length)
57 m_cipher->set_key(key, length);
75 return "CBC-MAC(" + m_cipher->name() +
")";
83 return new CBC_MAC(m_cipher->clone());
90 m_cipher(cipher), m_state(cipher->block_size())
void xor_buf(T out[], const T in[], size_t length)
std::string name() const override
CBC_MAC(BlockCipher *cipher)
MessageAuthenticationCode * clone() const override
void copy_mem(T *out, const T *in, size_t n)
size_t output_length() const override
void zeroise(std::vector< T, Alloc > &vec)