diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-07-22 10:40:55 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-07-22 10:40:55 +1000 |
commit | 90409da6a520812b0266fcb1303175406dea81fe (patch) | |
tree | a9d4fcbae513c3daaa7dabb9dce681e30465bd90 /test/recipes | |
parent | 77174598920a05826a28d8a0bd87a3af43d3f4d8 (diff) | |
download | openssl-90409da6a520812b0266fcb1303175406dea81fe.zip openssl-90409da6a520812b0266fcb1303175406dea81fe.tar.gz openssl-90409da6a520812b0266fcb1303175406dea81fe.tar.bz2 |
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)
Diffstat (limited to 'test/recipes')
-rw-r--r-- | test/recipes/30-test_evp_libctx.t | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/recipes/30-test_evp_libctx.t b/test/recipes/30-test_evp_libctx.t index 0d0a762..8c36a9e 100644 --- a/test/recipes/30-test_evp_libctx.t +++ b/test/recipes/30-test_evp_libctx.t @@ -27,7 +27,7 @@ my $infile = bldtop_file('providers', platform->dso('fips')); my @test_args = ( ); plan tests => - ($no_fips ? 0 : 1) # FIPS install test + ($no_fips ? 0 : 2) # FIPS install test + 1; unless ($no_fips) { @@ -36,10 +36,11 @@ unless ($no_fips) { ok(run(app(['openssl', 'fipsinstall', '-out', bldtop_file('providers', 'fipsmodule.cnf'), - '-module', $infile, - '-provider_name', 'fips', '-mac_name', 'HMAC', - '-section_name', 'fips_sect'])), + '-module', $infile])), "fipsinstall"); + ok(run(test(["evp_libctx_test", @test_args])), "running fips evp_libctx_test"); } -ok(run(test(["evp_libctx_test", @test_args])), "running evp_libctx_test"); +ok(run(test(["evp_libctx_test", + "-config", srctop_file("test","default-and-legacy.cnf"),])), + "running default-and-legacy evp_libctx_test"); |