Botan 3.6.1
Crypto and TLS for C&
blake2bmac.h
Go to the documentation of this file.
1/*
2* BLAKE2b MAC
3* (C) 1999-2007,2014 Jack Lloyd
4* (C) 2020 Tom Crowley
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#ifndef BOTAN_BLAKE2MAC_H_
10#define BOTAN_BLAKE2MAC_H_
11
12#include <botan/mac.h>
13#include <botan/internal/blake2b.h>
14
15namespace Botan {
16
17/**
18* BLAKE2b MAC
19*/
21 public:
22 explicit BLAKE2bMAC(size_t output_bits = 512);
23
24 BLAKE2bMAC(const BLAKE2bMAC&) = delete;
25 BLAKE2bMAC& operator=(const BLAKE2bMAC&) = delete;
26
27 std::string name() const override { return m_blake.name(); }
28
29 size_t output_length() const override { return m_blake.output_length(); }
30
31 std::unique_ptr<MessageAuthenticationCode> new_object() const override;
32
33 void clear() override;
34
35 bool has_keying_material() const override { return m_blake.has_keying_material(); }
36
37 Key_Length_Specification key_spec() const override { return m_blake.key_spec(); }
38
39 private:
40 void key_schedule(std::span<const uint8_t> key) override { m_blake.set_key(key); }
41
42 void add_data(std::span<const uint8_t> input) override {
44 m_blake.update(input);
45 }
46
47 void final_result(std::span<uint8_t> out) override {
49 m_blake.final(out);
50 }
51
52 BLAKE2b m_blake;
53};
54
55} // namespace Botan
56
57#endif
BLAKE2bMAC & operator=(const BLAKE2bMAC &)=delete
void clear() override
std::unique_ptr< MessageAuthenticationCode > new_object() const override
size_t output_length() const override
Definition blake2bmac.h:29
bool has_keying_material() const override
Definition blake2bmac.h:35
std::string name() const override
Definition blake2bmac.h:27
BLAKE2bMAC(const BLAKE2bMAC &)=delete
BLAKE2bMAC(size_t output_bits=512)
Key_Length_Specification key_spec() const override
Definition blake2bmac.h:37
Key_Length_Specification key_spec() const override
Definition blake2b.cpp:168
size_t output_length() const override
Definition blake2b.h:36
std::string name() const override
Definition blake2b.cpp:172
bool has_keying_material() const override
Definition blake2b.cpp:184
void update(const uint8_t in[], size_t length)
Definition buf_comp.h:35
void final(uint8_t out[])
Definition buf_comp.h:70
void set_key(const SymmetricKey &key)
Definition sym_algo.h:113
void assert_key_material_set() const
Definition sym_algo.h:139
int(* final)(unsigned char *, CTX *)