提交 acb30f4b 编写于 作者: B Benjamin Kaduk

Use local IV storage in e_xcbc_d.c

Inline the pre-13273237 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: NTomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12233)
上级 1453d736
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
# include <openssl/objects.h> # include <openssl/objects.h>
# include "crypto/evp.h" # include "crypto/evp.h"
# include <openssl/des.h> # include <openssl/des.h>
# include "evp_local.h"
static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, static int desx_cbc_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc); const unsigned char *iv, int enc);
...@@ -72,7 +73,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ...@@ -72,7 +73,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
{ {
while (inl >= EVP_MAXCHUNK) { while (inl >= EVP_MAXCHUNK) {
DES_xcbc_encrypt(in, out, (long)EVP_MAXCHUNK, &data(ctx)->ks, 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, &data(ctx)->inw, &data(ctx)->outw,
EVP_CIPHER_CTX_encrypting(ctx)); EVP_CIPHER_CTX_encrypting(ctx));
inl -= EVP_MAXCHUNK; inl -= EVP_MAXCHUNK;
...@@ -81,7 +82,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, ...@@ -81,7 +82,7 @@ static int desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
} }
if (inl) if (inl)
DES_xcbc_encrypt(in, out, (long)inl, &data(ctx)->ks, 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, &data(ctx)->inw, &data(ctx)->outw,
EVP_CIPHER_CTX_encrypting(ctx)); EVP_CIPHER_CTX_encrypting(ctx));
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册