Fix incomplete checks for EVP_CIPHER_asn1_to_param
authorNiels Dossche <niels.dossche@ugent.be>
Mon, 23 Jan 2023 16:16:34 +0000 (17:16 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 25 Jan 2023 14:27:14 +0000 (14:27 +0000)
commit114d99b46bfb212ffc510865df317ca2c1542623
treea13f6db35e8b07fde61009db2afa082186f3706c
parente95d6e1eec2f080713aa91c12e411cea4cffee65
Fix incomplete checks for EVP_CIPHER_asn1_to_param

EVP_CIPHER_asn1_to_param() returns a value <= 0 in case of an error, and
a value greater than 0 in case of success. Two callsites only check for
< 0 instead of <= 0. The other callsites perform this check correctly.
Change the two callsites to <= 0. Additionally correctly handle a zero
return value from EVP_CIPHER_get_asn1_iv as success.

Fixes: #20116
CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/201213)
crypto/evp/evp_lib.c
crypto/evp/p5_crpt2.c
crypto/pkcs7/pk7_doit.c