-/* $OpenBSD: evp_enc.c,v 1.45 2022/07/26 19:50:06 tb Exp $ */
+/* $OpenBSD: evp_enc.c,v 1.46 2022/09/04 13:34:13 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include "evp_locl.h"
-#define M_do_cipher(ctx, out, in, inl) ctx->cipher->do_cipher(ctx, out, in, inl)
-
int
EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv, int enc)
return 1;
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
- i = M_do_cipher(ctx, out, in, inl);
+ i = ctx->cipher->do_cipher(ctx, out, in, inl);
if (i < 0)
return 0;
else
}
if (ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0) {
- if (M_do_cipher(ctx, out, in, inl)) {
+ if (ctx->cipher->do_cipher(ctx, out, in, inl)) {
*outl = inl;
return 1;
} else {
return 0;
}
memcpy(&(ctx->buf[i]), in, j);
- if (!M_do_cipher(ctx, out, ctx->buf, bl))
+ if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))
return 0;
inl -= j;
in += j;
i = inl&(bl - 1);
inl -= i;
if (inl > 0) {
- if (!M_do_cipher(ctx, out, in, inl))
+ if (!ctx->cipher->do_cipher(ctx, out, in, inl))
return 0;
*outl += inl;
}
unsigned int i, b, bl;
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
- ret = M_do_cipher(ctx, out, NULL, 0);
+ ret = ctx->cipher->do_cipher(ctx, out, NULL, 0);
if (ret < 0)
return 0;
else
n = b - bl;
for (i = bl; i < b; i++)
ctx->buf[i] = n;
- ret = M_do_cipher(ctx, out, ctx->buf, b);
+ ret = ctx->cipher->do_cipher(ctx, out, ctx->buf, b);
if (ret)
return 1;
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
- fix_len = M_do_cipher(ctx, out, in, inl);
+ fix_len = ctx->cipher->do_cipher(ctx, out, in, inl);
if (fix_len < 0) {
*outl = 0;
return 0;
*outl = 0;
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
- i = M_do_cipher(ctx, out, NULL, 0);
+ i = ctx->cipher->do_cipher(ctx, out, NULL, 0);
if (i < 0)
return 0;
else