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