Botan  2.15.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 
15 
16 namespace Botan {
17 
18 /**
19 * CBC-MAC
20 */
22  {
23  public:
24  std::string name() const override;
25  MessageAuthenticationCode* clone() const override;
26  size_t output_length() const override { return m_cipher->block_size(); }
27  void clear() override;
28 
30  {
31  return m_cipher->key_spec();
32  }
33 
34  /**
35  * @param cipher the block cipher to use
36  */
37  explicit CBC_MAC(BlockCipher* cipher);
38  private:
39  void add_data(const uint8_t[], size_t) override;
40  void final_result(uint8_t[]) override;
41  void key_schedule(const uint8_t[], size_t) override;
42 
43  std::unique_ptr<BlockCipher> m_cipher;
44  secure_vector<uint8_t> m_state;
45  size_t m_position = 0;
46  };
47 
48 }
49 
50 #endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
virtual std::string name() const =0
virtual void clear()=0
Definition: alg_id.cpp:13
Key_Length_Specification key_spec() const override
Definition: cbc_mac.h:29
virtual MessageAuthenticationCode * clone() const =0
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
size_t output_length() const override
Definition: cbc_mac.h:26
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:145