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