summaryrefslogtreecommitdiff
path: root/poly1305.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-11-21 14:12:23 +1100
committerDamien Miller <djm@mindrot.org>2013-11-21 14:12:23 +1100
commit0fde8acdad78a4d20cadae974376cc0165f645ee (patch)
tree6e6aa82b73163bcb412920050d98f82ca9f4e86e /poly1305.h
parentfdb2306acdc3eb2bc46b6dfdaaf6005c650af22a (diff)
- djm@cvs.openbsd.org 2013/11/21 00:45:44
[Makefile.in PROTOCOL PROTOCOL.chacha20poly1305 authfile.c chacha.c] [chacha.h cipher-chachapoly.c cipher-chachapoly.h cipher.c cipher.h] [dh.c myproposal.h packet.c poly1305.c poly1305.h servconf.c ssh.1] [ssh.c ssh_config.5 sshd_config.5] Add a new protocol 2 transport cipher "chacha20-poly1305@openssh.com" that combines Daniel Bernstein's ChaCha20 stream cipher and Poly1305 MAC to build an authenticated encryption mode. Inspired by and similar to Adam Langley's proposal for TLS: http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-03 but differs in layout used for the MAC calculation and the use of a second ChaCha20 instance to separately encrypt packet lengths. Details are in the PROTOCOL.chacha20poly1305 file. Feedback markus@, naddy@; manpage bits Loganden Velvindron @ AfriNIC ok markus@ naddy@
Diffstat (limited to 'poly1305.h')
-rw-r--r--poly1305.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/poly1305.h b/poly1305.h
new file mode 100644
index 000000000..a31fb7425
--- /dev/null
+++ b/poly1305.h
@@ -0,0 +1,22 @@
1/* $OpenBSD: poly1305.h,v 1.1 2013/11/21 00:45:44 djm Exp $ */
2
3/*
4 * Public Domain poly1305 from Andrew M.
5 * poly1305-donna-unrolled.c from https://github.com/floodyberry/poly1305-donna
6 */
7
8#ifndef POLY1305_H
9#define POLY1305_H
10
11#include <sys/types.h>
12
13#define POLY1305_KEYLEN 32
14#define POLY1305_TAGLEN 16
15
16void poly1305_auth(u_char out[POLY1305_TAGLEN], const u_char *m, size_t inlen,
17 const u_char key[POLY1305_KEYLEN])
18 __attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN)))
19 __attribute__((__bounded__(__buffer__, 2, 3)))
20 __attribute__((__bounded__(__minbytes__, 4, POLY1305_KEYLEN)));
21
22#endif /* POLY1305_H */