Botan  2.4.0
Crypto and TLS for C++11
cbc_mac.h
Go to the documentation of this file.
1 /*
2 * CBC-MAC
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_CBC_MAC_H_
9 #define BOTAN_CBC_MAC_H_
10 
11 #include <botan/mac.h>
12 #include <botan/block_cipher.h>
13 
14 namespace Botan {
15 
16 /**
17 * CBC-MAC
18 */
20  {
21  public:
22  std::string name() const override;
23  MessageAuthenticationCode* clone() const override;
24  size_t output_length() const override { return m_cipher->block_size(); }
25  void clear() override;
26 
28  {
29  return m_cipher->key_spec();
30  }
31 
32  /**
33  * @param cipher the block cipher to use
34  */
35  explicit CBC_MAC(BlockCipher* cipher);
36  private:
37  void add_data(const uint8_t[], size_t) override;
38  void final_result(uint8_t[]) override;
39  void key_schedule(const uint8_t[], size_t) override;
40 
41  std::unique_ptr<BlockCipher> m_cipher;
42  secure_vector<uint8_t> m_state;
43  size_t m_position = 0;
44  };
45 
46 }
47 
48 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: alg_id.cpp:13
Key_Length_Specification key_spec() const override
Definition: cbc_mac.h:27
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
size_t output_length() const override
Definition: cbc_mac.h:24