Botan 3.6.1
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 HMAC(const HMAC&) = delete;
37 HMAC& operator=(const HMAC&) = delete;
38
39 private:
40 void add_data(std::span<const uint8_t>) override;
41 void final_result(std::span<uint8_t>) override;
42 void key_schedule(std::span<const uint8_t>) override;
43
44 std::unique_ptr<HashFunction> m_hash;
45 secure_vector<uint8_t> m_ikey, m_okey;
46 size_t m_hash_output_length;
47 size_t m_hash_block_size;
48};
49
50} // namespace Botan
51
52#endif
bool has_keying_material() const override
Definition hmac.cpp:45
size_t output_length() const override
Definition hmac.cpp:41
HMAC(const HMAC &)=delete
std::string name() const override
Definition hmac.cpp:124
std::unique_ptr< MessageAuthenticationCode > new_object() const override
Definition hmac.cpp:131
HMAC & operator=(const HMAC &)=delete
Key_Length_Specification key_spec() const override
Definition hmac.cpp:36
HMAC(std::unique_ptr< HashFunction > hash)
Definition hmac.cpp:138
void clear() override
Definition hmac.cpp:115
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61