From acb30f4b593bbd1bdaa6495d0f641da7ef702b95 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 2 Jul 2020 14:12:33 -0700 Subject: [PATCH] Use local IV storage in e_xcbc_d.c Inline the pre-13273237a65d46186b6bea0b51aec90670d4598a versions of EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and EVP_CIPHER_CTX_iv_noconst() in e_xcbc_d.c. For the legacy implementations, there's no need to use an in-provider storage for the IV, when the crypto operations themselves will be performed outside of the provider. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12233) --- crypto/evp/e_xcbc_d.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/evp/e_xcbc_d.c b/crypto/evp/e_xcbc_d.c index f2b540e7cf..20756211b0 100644 --- a/crypto/evp/e_xcbc_d.c +++ b/crypto/evp/e_xcbc_d.c @@ -22,6 +22,7 @@ # include # include "crypto/evp.h" # include +# include "evp_local.h" static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); @@ -72,7 +73,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, { while (inl >= EVP_MAXCHUNK) { DES_xcbc_encrypt(in, out, (long)EVP_MAXCHUNK, &data(ctx)->ks, - (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), + (DES_cblock *)ctx->iv, &data(ctx)->inw, &data(ctx)->outw, EVP_CIPHER_CTX_encrypting(ctx)); inl -= EVP_MAXCHUNK; @@ -81,7 +82,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, } if (inl) DES_xcbc_encrypt(in, out, (long)inl, &data(ctx)->ks, - (DES_cblock *)EVP_CIPHER_CTX_iv_noconst(ctx), + (DES_cblock *)ctx->iv, &data(ctx)->inw, &data(ctx)->outw, EVP_CIPHER_CTX_encrypting(ctx)); return 1; -- GitLab