Botan 3.13.0
Crypto and TLS for C&
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/hash.h>
12#include <botan/mac.h>
13
14namespace Botan {
15
16/**
17* HMAC
18*/
20 public:
21 void clear() override;
22 std::string name() const override;
23 std::unique_ptr<MessageAuthenticationCode> new_object() const override;
24
25 size_t output_length() const override;
26
27 Key_Length_Specification key_spec() const override;
28
29 bool has_keying_material() const override;
30
31 /**
32 * @param hash the hash to use for HMACing
33 */
34 explicit HMAC(std::unique_ptr<HashFunction> hash);
35
36 private:
37 void add_data(std::span<const uint8_t> input) override;
38 void final_result(std::span<uint8_t> output) override;
39 void start_msg(std::span<const uint8_t> nonce) override;
40 void key_schedule(std::span<const uint8_t> key) override;
41
42 std::unique_ptr<HashFunction> m_hash;
43 secure_vector<uint8_t> m_ikey, m_okey;
44 size_t m_hash_output_length;
45 size_t m_hash_block_size;
46};
47
48} // namespace Botan
49
50#endif
void final(uint8_t out[])
Definition buf_comp.h:97
bool has_keying_material() const override
Definition hmac.cpp:57
size_t output_length() const override
Definition hmac.cpp:53
std::string name() const override
Definition hmac.cpp:136
std::unique_ptr< MessageAuthenticationCode > new_object() const override
Definition hmac.cpp:143
Key_Length_Specification key_spec() const override
Definition hmac.cpp:48
HMAC(std::unique_ptr< HashFunction > hash)
Definition hmac.cpp:150
void clear() override
Definition hmac.cpp:127
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:128