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