Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

poly1305.h
Go to the documentation of this file.
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 <memory>
13
14 namespace Botan {
15
16 /**
17 * DJB's Poly1305
18 * Important note: each key can only be used once
19 */
20 class BOTAN_DLL Poly1305 final : public MessageAuthenticationCode
21 {
22 public:
23 std::string name() const override { return "Poly1305"; }
24
25 MessageAuthenticationCode* clone() const override { return new Poly1305; }
26
27 void clear() override;
28
29 size_t output_length() const override { return 16; }
30
31 Key_Length_Specification key_spec() const override
32 {
33 return Key_Length_Specification(32);
34 }
35
36 private:
37 void add_data(const uint8_t[], size_t) override;
38 void final_result(uint8_t[]) override;
39 void key_schedule(const uint8_t[], size_t) override;
40
41 secure_vector<uint64_t> m_poly;
42 secure_vector<uint8_t> m_buf;
43 size_t m_buf_pos = 0;
44 };
45
46 }
47
48 #endif
Botan::Poly1305
Definition: poly1305.h:20
Botan::Key_Length_Specification
Definition: key_spec.h:18
Botan::MessageAuthenticationCode
Definition: mac.h:20
Botan::Poly1305::clone
MessageAuthenticationCode * clone() const override
Definition: poly1305.h:25
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::Poly1305::name
std::string name() const override
Definition: poly1305.h:23
Botan::Poly1305::key_spec
Key_Length_Specification key_spec() const override
Definition: poly1305.h:31
Botan
Definition: alg_id.cpp:13
Botan::Poly1305::output_length
size_t output_length() const override
Definition: poly1305.h:29