diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-04-15 09:55:04 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-04-19 10:01:08 +0200 |
commit | d6c6f6c51d0d9bb02d5b40a8a69471f6a2929617 (patch) | |
tree | 0c5cbe9559a34e1d3590be1c5c825b875a288fb9 /providers/implementations/ciphers/cipher_tdes_common.c | |
parent | ae6f65ae08262d4c32575ad94e491d9fb59f00ff (diff) | |
download | openssl-new-d6c6f6c51d0d9bb02d5b40a8a69471f6a2929617.tar.gz |
Do IV reset also for DES and 3DES implementations
Fixes #14704
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14882)
Diffstat (limited to 'providers/implementations/ciphers/cipher_tdes_common.c')
-rw-r--r-- | providers/implementations/ciphers/cipher_tdes_common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/providers/implementations/ciphers/cipher_tdes_common.c b/providers/implementations/ciphers/cipher_tdes_common.c index 048b08661d..88acc16049 100644 --- a/providers/implementations/ciphers/cipher_tdes_common.c +++ b/providers/implementations/ciphers/cipher_tdes_common.c @@ -77,6 +77,12 @@ static int tdes_init(void *vctx, const unsigned char *key, size_t keylen, if (iv != NULL) { if (!ossl_cipher_generic_initiv(ctx, iv, ivlen)) return 0; + } else if (ctx->iv_set + && (ctx->mode == EVP_CIPH_CBC_MODE + || ctx->mode == EVP_CIPH_CFB_MODE + || ctx->mode == EVP_CIPH_OFB_MODE)) { + /* reset IV to keep compatibility with 1.1.1 */ + memcpy(ctx->iv, ctx->oiv, ctx->ivlen); } if (key != NULL) { |