Lines Matching +full:no +full:- +full:chacha
1 /* $NetBSD: cipher-chachapoly-libcrypto.c,v 1.3 2023/10/25 20:19:57 christos Exp $ */
2 /* $OpenBSD: cipher-chachapoly-libcrypto.c,v 1.2 2023/07/17 05:26:38 djm Exp $ */
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
21 __RCSID("$NetBSD: cipher-chachapoly-libcrypto.c,v 1.3 2023/10/25 20:19:57 christos Exp $");
33 #include "cipher-chachapoly.h"
48 if ((ctx->main_evp = EVP_CIPHER_CTX_new()) == NULL || in chachapoly_new()
49 (ctx->header_evp = EVP_CIPHER_CTX_new()) == NULL) in chachapoly_new()
51 if (!EVP_CipherInit(ctx->main_evp, EVP_chacha20(), key, NULL, 1)) in chachapoly_new()
53 if (!EVP_CipherInit(ctx->header_evp, EVP_chacha20(), key + 32, NULL, 1)) in chachapoly_new()
55 if (EVP_CIPHER_CTX_iv_length(ctx->header_evp) != 16) in chachapoly_new()
68 EVP_CIPHER_CTX_free(cpctx->main_evp); in chachapoly_free()
69 EVP_CIPHER_CTX_free(cpctx->header_evp); in chachapoly_free()
97 if (!EVP_CipherInit(ctx->main_evp, NULL, NULL, seqbuf, 1) || in chachapoly_crypt()
98 EVP_Cipher(ctx->main_evp, poly_key, in chachapoly_crypt()
117 if (!EVP_CipherInit(ctx->header_evp, NULL, NULL, seqbuf, 1) || in chachapoly_crypt()
118 EVP_Cipher(ctx->header_evp, dest, src, aadlen) < 0) { in chachapoly_crypt()
124 /* Set Chacha's block counter to 1 */ in chachapoly_crypt()
126 if (!EVP_CipherInit(ctx->main_evp, NULL, NULL, seqbuf, 1) || in chachapoly_crypt()
127 EVP_Cipher(ctx->main_evp, dest + aadlen, src + aadlen, len) < 0) { in chachapoly_crypt()
156 if (!EVP_CipherInit(ctx->header_evp, NULL, NULL, seqbuf, 0)) in chachapoly_get_length()
158 if (EVP_Cipher(ctx->header_evp, buf, (u_char *)cp, sizeof(buf)) < 0) in chachapoly_get_length()