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