openssl/providers/implementations/ciphers
Shane Lontis 90409da6a5 Fix provider cipher reinit issue
Fixes #12405
Fixes #12377

Calling Init()/Update() and then Init()/Update() again gave a different result when using the same key and iv.
Cipher modes that were using ctx->num were not resetting this value, this includes OFB, CFB & CTR.
The fix is to reset this value during the ciphers einit() and dinit() methods.
Most ciphers go thru a generic method so one line fixes most cases.

Add test for calling EVP_EncryptInit()/EVP_EncryptUpdate() multiple times for all ciphers.
Ciphers should return the same value for both updates.
DES3-WRAP does not since it uses a random in the update.
CCM modes currently also fail on the second update (This also happens in 1_1_1).

Fix memory leak in AES_OCB cipher if EVP_EncryptInit is called multiple times.

Fix AES_SIV cipher dup_ctx and init.
Calling EVP_CIPHER_init multiple times resulted in a memory leak in the siv.
Fixing this leak also showed that the dup ctx was not working for siv mode.
Note: aes_siv_cleanup() can not be used by aes_siv_dupctx() as it clears data
that is required for the decrypt (e.g the tag).

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12413)
2020-07-22 10:40:55 +10:00
..
build.info Add AES_CBC_CTS ciphers to providers 2020-07-15 23:11:50 +02:00
cipher_aes_cbc_hmac_sha1_hw.c Decreate the length after decryption for the stitched ciphers 2020-07-06 09:26:09 +01:00
cipher_aes_cbc_hmac_sha256_hw.c Decreate the length after decryption for the stitched ciphers 2020-07-06 09:26:09 +01:00
cipher_aes_cbc_hmac_sha.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_aes_cbc_hmac_sha.h
cipher_aes_ccm_hw_aesni.inc
cipher_aes_ccm_hw_s390x.inc
cipher_aes_ccm_hw_t4.inc
cipher_aes_ccm_hw.c
cipher_aes_ccm.c Make the naming scheme for dispatched functions more consistent 2020-06-24 22:01:22 +02:00
cipher_aes_ccm.h
cipher_aes_cts_fips.c Add AES_CBC_CTS ciphers to providers 2020-07-15 23:11:50 +02:00
cipher_aes_cts.h Add AES_CBC_CTS ciphers to providers 2020-07-15 23:11:50 +02:00
cipher_aes_cts.inc Add AES_CBC_CTS ciphers to providers 2020-07-15 23:11:50 +02:00
cipher_aes_gcm_hw_aesni.inc
cipher_aes_gcm_hw_armv8.inc
cipher_aes_gcm_hw_s390x.inc
cipher_aes_gcm_hw_t4.inc
cipher_aes_gcm_hw.c
cipher_aes_gcm.c Make the naming scheme for dispatched functions more consistent 2020-06-24 22:01:22 +02:00
cipher_aes_gcm.h
cipher_aes_hw_aesni.inc
cipher_aes_hw_s390x.inc
cipher_aes_hw_t4.inc
cipher_aes_hw.c
cipher_aes_ocb_hw.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_aes_ocb.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_aes_ocb.h
cipher_aes_siv_hw.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_aes_siv.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_aes_siv.h Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_aes_wrp.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_aes_xts_fips.c
cipher_aes_xts_hw.c
cipher_aes_xts.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_aes_xts.h
cipher_aes.c Add AES_CBC_CTS ciphers to providers 2020-07-15 23:11:50 +02:00
cipher_aes.h
cipher_aria_ccm_hw.c
cipher_aria_ccm.c Update copyright year 2020-06-25 14:13:12 +01:00
cipher_aria_ccm.h
cipher_aria_gcm_hw.c
cipher_aria_gcm.c Update copyright year 2020-06-25 14:13:12 +01:00
cipher_aria_gcm.h
cipher_aria_hw.c
cipher_aria.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_aria.h
cipher_blowfish_hw.c
cipher_blowfish.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_blowfish.h
cipher_camellia_hw_t4.inc
cipher_camellia_hw.c
cipher_camellia.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_camellia.h
cipher_cast5_hw.c
cipher_cast5.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_cast.h
cipher_chacha20_hw.c
cipher_chacha20_poly1305_hw.c Update copyright year 2020-07-16 14:47:04 +02:00
cipher_chacha20_poly1305.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_chacha20_poly1305.h
cipher_chacha20.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_chacha20.h Update copyright year 2020-06-25 14:13:12 +01:00
cipher_des_hw.c
cipher_des.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_des.h
cipher_desx_hw.c
cipher_desx.c
cipher_idea_hw.c
cipher_idea.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_idea.h
cipher_null.c Make the NULL cipher TLS aware 2020-07-06 09:26:09 +01:00
cipher_rc2_hw.c
cipher_rc2.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_rc2.h
cipher_rc4_hmac_md5_hw.c
cipher_rc4_hmac_md5.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_rc4_hmac_md5.h
cipher_rc4_hw.c
cipher_rc4.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_rc4.h
cipher_rc5_hw.c
cipher_rc5.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_rc5.h
cipher_seed_hw.c
cipher_seed.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_seed.h
cipher_sm4_hw.c
cipher_sm4.c Ensure any allocated MAC is freed in the provider code 2020-07-06 09:26:09 +01:00
cipher_sm4.h
cipher_tdes_common.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00
cipher_tdes_default_hw.c
cipher_tdes_default.c
cipher_tdes_default.h
cipher_tdes_hw.c
cipher_tdes_wrap_hw.c
cipher_tdes_wrap.c Make the naming scheme for dispatched functions more consistent 2020-06-24 22:01:22 +02:00
cipher_tdes.c
cipher_tdes.h Make the naming scheme for dispatched functions more consistent 2020-06-24 22:01:22 +02:00
ciphercommon_block.c Add provider support for TLS CBC padding and MAC removal 2020-07-06 09:26:09 +01:00
ciphercommon_ccm_hw.c
ciphercommon_ccm.c
ciphercommon_gcm_hw.c
ciphercommon_gcm.c Ensure GCM "update" failures return 0 on error 2020-07-06 09:26:09 +01:00
ciphercommon_hw.c
ciphercommon_local.h Update copyright year 2020-07-16 14:47:04 +02:00
ciphercommon.c Fix provider cipher reinit issue 2020-07-22 10:40:55 +10:00