From 69807ab8ed5d5b3b0bb59f418cb3a7658de005a3 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 7 Jun 2021 21:07:21 +1000 Subject: [PATCH] evp: avoid some calls to EVP_CIPHER_CTX_get_iv_length() because it's been called already Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/15635) --- crypto/evp/evp_enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index cf73ba230e..5188e73602 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -345,8 +345,8 @@ static int evp_cipher_init_internal(EVP_CIPHER_CTX *ctx, if (!ossl_assert(n >= 0 && n <= (int)sizeof(ctx->iv))) return 0; if (iv != NULL) - memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_get_iv_length(ctx)); - memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_get_iv_length(ctx)); + memcpy(ctx->oiv, iv, n); + memcpy(ctx->iv, ctx->oiv, n); break; case EVP_CIPH_CTR_MODE: -- 2.39.2