1 | /* $NetBSD: cipher-chachapoly.h,v 1.2 2018/04/06 18:59:00 christos Exp $ */ |
2 | /* $OpenBSD: cipher-chachapoly.h,v 1.4 2014/06/24 01:13:21 djm Exp $ */ |
3 | |
4 | /* |
5 | * Copyright (c) Damien Miller 2013 <djm@mindrot.org> |
6 | * |
7 | * Permission to use, copy, modify, and distribute this software for any |
8 | * purpose with or without fee is hereby granted, provided that the above |
9 | * copyright notice and this permission notice appear in all copies. |
10 | * |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
18 | */ |
19 | #ifndef CHACHA_POLY_AEAD_H |
20 | #define CHACHA_POLY_AEAD_H |
21 | |
22 | #include <sys/types.h> |
23 | #include "chacha.h" |
24 | #include "poly1305.h" |
25 | |
26 | #define CHACHA_KEYLEN 32 /* Only 256 bit keys used here */ |
27 | |
28 | struct chachapoly_ctx { |
29 | struct chacha_ctx main_ctx, ; |
30 | }; |
31 | |
32 | int chachapoly_init(struct chachapoly_ctx *cpctx, |
33 | const u_char *key, u_int keylen) |
34 | __attribute__((__bounded__(__buffer__, 2, 3))); |
35 | int chachapoly_crypt(struct chachapoly_ctx *cpctx, u_int seqnr, |
36 | u_char *dest, const u_char *src, u_int len, u_int aadlen, u_int authlen, |
37 | int do_encrypt); |
38 | int chachapoly_get_length(struct chachapoly_ctx *cpctx, |
39 | u_int *plenp, u_int seqnr, const u_char *cp, u_int len) |
40 | __attribute__((__bounded__(__buffer__, 4, 5))); |
41 | |
42 | #endif /* CHACHA_POLY_AEAD_H */ |
43 | |