Botan 2.13.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 BOTAN_FUTURE_INTERNAL_HEADER(poly1305.h)
15
16 namespace Botan {
17
18 /**
19 * DJB's Poly1305
20 * Important note: each key can only be used once
21 */
22 class BOTAN_PUBLIC_API(2,0) Poly1305 final : public MessageAuthenticationCode
23 {
24 public:
25 std::string name() const override { return "Poly1305"; }
26
27 MessageAuthenticationCode* clone() const override { return new Poly1305; }
28
29 void clear() override;
30
31 size_t output_length() const override { return 16; }
32
33 Key_Length_Specification key_spec() const override
34 {
35 return Key_Length_Specification(32);
36 }
37
38 private:
39 void add_data(const uint8_t[], size_t) override;
40 void final_result(uint8_t[]) override;
41 void key_schedule(const uint8_t[], size_t) override;
42
43 secure_vector<uint64_t> m_poly;
44 secure_vector<uint8_t> m_buf;
45 size_t m_buf_pos = 0;
46 };
47
48 }
49
50 #endif
Botan::Poly1305
Definition: poly1305.h:22
Botan::Key_Length_Specification
Definition: key_spec.h:18
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:28
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::MessageAuthenticationCode
Definition: mac.h:21
Botan::Poly1305::clone
MessageAuthenticationCode * clone() const override
Definition: poly1305.h:27
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:65
Botan::Poly1305::name
std::string name() const override
Definition: poly1305.h:25
Botan::SymmetricAlgorithm::clear
virtual void clear()=0
Botan::Poly1305::key_spec
Key_Length_Specification key_spec() const override
Definition: poly1305.h:33
Botan
Definition: alg_id.cpp:13
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:139
Botan::Poly1305::output_length
size_t output_length() const override
Definition: poly1305.h:31