Make the ExperimentalProtocol option obsolete.
[tinc] / src / chacha-poly1305 / poly1305.h
1 #ifndef POLY1305_H
2 #define POLY1305_H
3
4 #include <stddef.h>
5 #include <stdint.h>
6 #include <string.h>
7
8 #define POLY1305_KEYLEN     32
9 #define POLY1305_TAGLEN     16
10 #define POLY1305_BLOCK_SIZE 16
11
12 /* use memcpy() to copy blocks of memory (typically faster) */
13 #define USE_MEMCPY          1
14 /* use unaligned little-endian load/store (can be faster) */
15 #define USE_UNALIGNED       0
16
17 struct poly1305_context {
18         uint32_t r[5];
19         uint32_t h[5];
20         uint32_t pad[4];
21         size_t leftover;
22         unsigned char buffer[POLY1305_BLOCK_SIZE];
23         unsigned char final;
24 };
25
26 void poly1305_init(struct poly1305_context *ctx, const unsigned char key[32]);
27 void poly1305_update(struct poly1305_context *ctx, const unsigned char *m, size_t bytes);
28 void poly1305_finish(struct poly1305_context *ctx, unsigned char mac[16]);
29 void poly1305_auth(unsigned char mac[16], const unsigned char *m, size_t bytes, const unsigned char key[32]);
30
31 #endif /* POLY1305_H */
32