]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix "Error finalizing cipher loop" when running openssl speed -evp -decrypt
authorTom Cosgrove <tom.cosgrove@arm.com>
Mon, 26 Feb 2024 17:14:48 +0000 (17:14 +0000)
committerTomas Mraz <tomas@openssl.org>
Tue, 9 Apr 2024 18:27:39 +0000 (20:27 +0200)
commitb3be6cc89e4dcfafe8f8be97e9519c26af2d19f5
tree0169b9aec3e4726c80e79dc88bb9944a87448b25
parent6b566687b58fde08b28e3331377f050768fad89b
Fix "Error finalizing cipher loop" when running openssl speed -evp -decrypt

When using CCM, openssl speed uses the loop function EVP_Update_loop_ccm() which
sets a (fake) tag when decrypting. When using -aead (which benchmarks a different
sequence than normal, to be comparable to TLS operation), the loop function
EVP_Update_loop_aead() is used, which also sets a tag when decrypting.

However, when using defaults, the loop function EVP_Update_loop() is used, which
does not set a tag on decryption, leading to "Error finalizing cipher loop".

To fix this, set a fake tag value if we're doing decryption on an AEAD cipher in
EVP_Update_loop(). We don't check the return value: this shouldn't really be able
to fail, and if it does, the following EVP_DecryptUpdate() is almost certain to
fail, so that can catch it.

The decryption is certain to fail (well, almost certain, but with a very low
probability of success), but this is no worse than at present. This minimal
change means that future benchmarking data should be comparable to previous
benchmarking data.

(This is benchmarking code: don't write real apps like this!)

Fixes #23657

Change-Id: Id581cf30503c1eb766464e315b1f33914040dcf7

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23757)
apps/speed.c