xref: /openbsd-src/sys/crypto/poly1305.h (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1 /*
2  * Public Domain poly1305 from Andrew Moon
3  *
4  * poly1305 implementation using 32 bit * 32 bit = 64 bit multiplication
5  * and 64 bit addition from https://github.com/floodyberry/poly1305-donna
6  */
7 
8 #ifndef _POLY1305_H_
9 #define _POLY1305_H_
10 
11 #define poly1305_block_size 16
12 
13 typedef struct poly1305_state {
14 	unsigned long r[5];
15 	unsigned long h[5];
16 	unsigned long pad[4];
17 	size_t leftover;
18 	unsigned char buffer[poly1305_block_size];
19 	unsigned char final;
20 } poly1305_state;
21 
22 void	poly1305_init(poly1305_state *, const unsigned char[32]);
23 void	poly1305_update(poly1305_state *, const unsigned char *, size_t);
24 void	poly1305_finish(poly1305_state *, unsigned char[16]);
25 
26 #endif	/* _POLY1305_H_ */
27