1261287Sdes/* $OpenBSD: cipher-chachapoly.h,v 1.1 2013/11/21 00:45:44 djm Exp $ */ 2261287Sdes 3261287Sdes/* 4261287Sdes * Copyright (c) Damien Miller 2013 <djm@mindrot.org> 5261287Sdes * 6261287Sdes * Permission to use, copy, modify, and distribute this software for any 7261287Sdes * purpose with or without fee is hereby granted, provided that the above 8261287Sdes * copyright notice and this permission notice appear in all copies. 9261287Sdes * 10261287Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11261287Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12261287Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13261287Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14261287Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15261287Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16261287Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17261287Sdes */ 18261287Sdes#ifndef CHACHA_POLY_AEAD_H 19261287Sdes#define CHACHA_POLY_AEAD_H 20261287Sdes 21261287Sdes#include <sys/types.h> 22261287Sdes#include "chacha.h" 23261287Sdes#include "poly1305.h" 24261287Sdes 25261287Sdes#define CHACHA_KEYLEN 32 /* Only 256 bit keys used here */ 26261287Sdes 27261287Sdesstruct chachapoly_ctx { 28261287Sdes struct chacha_ctx main_ctx, header_ctx; 29261287Sdes}; 30261287Sdes 31261287Sdesvoid chachapoly_init(struct chachapoly_ctx *cpctx, 32261287Sdes const u_char *key, u_int keylen) 33261287Sdes __attribute__((__bounded__(__buffer__, 2, 3))); 34261287Sdesint chachapoly_crypt(struct chachapoly_ctx *cpctx, u_int seqnr, 35261287Sdes u_char *dest, const u_char *src, u_int len, u_int aadlen, u_int authlen, 36261287Sdes int do_encrypt); 37261287Sdesint chachapoly_get_length(struct chachapoly_ctx *cpctx, 38261287Sdes u_int *plenp, u_int seqnr, const u_char *cp, u_int len) 39261287Sdes __attribute__((__bounded__(__buffer__, 4, 5))); 40261287Sdes 41261287Sdes#endif /* CHACHA_POLY_AEAD_H */ 42