Coverage Report

Created: 2023-06-07 07:00

/src/botan/build/include/botan/internal/blake2bmac.h
Line
Count
Source (jump to first uncovered line)
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
15
namespace Botan {
16
17
/**
18
* BLAKE2b MAC
19
*/
20
class BLAKE2bMAC final : public MessageAuthenticationCode {
21
   public:
22
      explicit BLAKE2bMAC(size_t output_bits = 512);
23
24
      BLAKE2bMAC(const BLAKE2bMAC&) = delete;
25
      BLAKE2bMAC& operator=(const BLAKE2bMAC&) = delete;
26
27
0
      std::string name() const override { return m_blake.name(); }
28
29
0
      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
0
      bool has_keying_material() const override { return m_blake.has_keying_material(); }
36
37
0
      Key_Length_Specification key_spec() const override { return m_blake.key_spec(); }
38
39
   private:
40
0
      void key_schedule(const uint8_t key[], size_t length) override { m_blake.set_key(key, length); }
41
42
0
      void add_data(const uint8_t input[], size_t length) override {
43
0
         assert_key_material_set();
44
0
         m_blake.update(input, length);
45
0
      }
46
47
0
      void final_result(uint8_t out[]) override {
48
0
         assert_key_material_set();
49
0
         m_blake.final(out);
50
0
      }
51
52
      BLAKE2b m_blake;
53
};
54
55
}  // namespace Botan
56
57
#endif