diff options
author | Benjamin Kaduk <bkaduk@akamai.com> | 2020-07-02 14:12:33 -0700 |
---|---|---|
committer | Benjamin Kaduk <bkaduk@akamai.com> | 2020-08-11 07:07:58 -0700 |
commit | 1453d736b5bb8abaa18482652828096b44c4bf3a (patch) | |
tree | 44399ace5e383eba1fa0582bd2ba83085e006d44 /crypto/evp/e_sm4.c | |
parent | c4d21d2f71363e9f6d4a0e377789555e655d96f4 (diff) | |
download | openssl-new-1453d736b5bb8abaa18482652828096b44c4bf3a.tar.gz |
Use local IV storage in e_sm4.c
Inline the pre-13273237a65d46186b6bea0b51aec90670d4598a versions
of EVP_CIPHER_CTX_iv(), EVP_CIPHER_CTX_original_iv(), and
EVP_CIPHER_CTX_iv_noconst() in e_sm4.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 <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12233)
Diffstat (limited to 'crypto/evp/e_sm4.c')
-rw-r--r-- | crypto/evp/e_sm4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/evp/e_sm4.c b/crypto/evp/e_sm4.c index 4653c10a14..96c50cf13f 100644 --- a/crypto/evp/e_sm4.c +++ b/crypto/evp/e_sm4.c @@ -15,6 +15,7 @@ # include <openssl/modes.h> # include "crypto/sm4.h" # include "crypto/evp.h" +# include "evp_local.h" typedef struct { SM4_KEY ks; @@ -74,8 +75,7 @@ static int sm4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, unsigned int num = EVP_CIPHER_CTX_num(ctx); EVP_SM4_KEY *dat = EVP_C_DATA(EVP_SM4_KEY, ctx); - CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, - EVP_CIPHER_CTX_iv_noconst(ctx), + CRYPTO_ctr128_encrypt(in, out, len, &dat->ks, ctx->iv, EVP_CIPHER_CTX_buf_noconst(ctx), &num, (block128_f)SM4_encrypt); EVP_CIPHER_CTX_set_num(ctx, num); |