Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 */
19 class BOTAN_DLL HMAC final : public MessageAuthenticationCode
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 // Absurd max length here is to support PBKDF2
31 return Key_Length_Specification(0, 512);
32 }
33
34 /**
35 * @param hash the hash to use for HMACing
36 */
37 explicit HMAC(HashFunction* hash);
38
39 HMAC(const HMAC&) = delete;
40 HMAC& operator=(const HMAC&) = delete;
41 private:
42 void add_data(const uint8_t[], size_t) override;
43 void final_result(uint8_t[]) override;
44 void key_schedule(const uint8_t[], size_t) override;
45
46 std::unique_ptr<HashFunction> m_hash;
47 secure_vector<uint8_t> m_ikey, m_okey;
48 };
49
50 }
51
52 #endif
Botan::HMAC::key_spec
Key_Length_Specification key_spec() const override
Definition: hmac.h:28
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::MessageAuthenticationCode
Definition: mac.h:20
Botan::HMAC::output_length
size_t output_length() const override
Definition: hmac.h:26
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
Botan::HashFunction
Definition: hash.h:19
Botan::HMAC
Definition: hmac.h:19
m_hash
std::unique_ptr< HashFunction > m_hash
Definition: tpm.cpp:439
hash
MechanismType hash
Definition: p11_mechanism.cpp:63