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_KEY_SIZE 32 13 #define POLY1305_BLOCK_SIZE 16 14 #define POLY1305_MAC_SIZE 16 15 16 typedef struct poly1305_state { 17 unsigned long r[5]; 18 unsigned long h[5]; 19 unsigned long pad[4]; 20 size_t leftover; 21 uint8_t buffer[POLY1305_BLOCK_SIZE]; 22 uint8_t final; 23 } poly1305_state; 24 25 void poly1305_init(poly1305_state *, const uint8_t[POLY1305_KEY_SIZE]); 26 void poly1305_update(poly1305_state *, const uint8_t *, size_t); 27 void poly1305_finish(poly1305_state *, uint8_t[POLY1305_MAC_SIZE]); 28 29 #endif /* _POLY1305_H_ */ 30