Coverage Report

Created: 2024-11-21 07:03

/src/botan/build/include/internal/botan/internal/poly1305.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
* Poly1305
3
* (C) 2014 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7
8
#ifndef BOTAN_MAC_POLY1305_H_
9
#define BOTAN_MAC_POLY1305_H_
10
11
#include <botan/mac.h>
12
#include <botan/internal/alignment_buffer.h>
13
#include <memory>
14
15
namespace Botan {
16
17
/**
18
* DJB's Poly1305
19
* Important note: each key can only be used once
20
*/
21
class Poly1305 final : public MessageAuthenticationCode {
22
   public:
23
0
      std::string name() const override { return "Poly1305"; }
24
25
0
      std::unique_ptr<MessageAuthenticationCode> new_object() const override { return std::make_unique<Poly1305>(); }
26
27
      void clear() override;
28
29
0
      size_t output_length() const override { return 16; }
30
31
0
      Key_Length_Specification key_spec() const override { return Key_Length_Specification(32); }
32
33
0
      bool fresh_key_required_per_message() const override { return true; }
34
35
      bool has_keying_material() const override;
36
37
   private:
38
      void add_data(std::span<const uint8_t>) override;
39
      void final_result(std::span<uint8_t>) override;
40
      void key_schedule(std::span<const uint8_t>) override;
41
42
      secure_vector<uint64_t> m_poly;
43
      AlignmentBuffer<uint8_t, 16> m_buffer;
44
};
45
46
}  // namespace Botan
47
48
#endif