diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2022-12-02 16:33:02 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-12-05 13:06:00 +0100 |
commit | 18e45bd9eade832d3ab575f48fcf1f22695939b8 (patch) | |
tree | 6b3746a86b3e62894eb4416dc9407a5ed3c8ce1b | |
parent | 5812a2d282a76e83a95ea19aa08e89ba0571b182 (diff) |
Fix the check of EVP_PKEY_decrypt_init
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19819)
(cherry picked from commit b794476df71441a6d30740ab9fadcc0f6d18d3d6)
-rw-r--r-- | crypto/crmf/crmf_lib.c | 2 | ||||
-rw-r--r-- | test/evp_extra_test.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index 8b42e4392e..3607fb0bf4 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -648,7 +648,7 @@ X509 cikeysize = EVP_CIPHER_get_key_length(cipher); /* first the symmetric key needs to be decrypted */ pkctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, propq); - if (pkctx != NULL && EVP_PKEY_decrypt_init(pkctx)) { + if (pkctx != NULL && EVP_PKEY_decrypt_init(pkctx) > 0) { ASN1_BIT_STRING *encKey = ecert->encSymmKey; size_t failure; int retval; diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index caffdbd53f..3747532ff0 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -2040,7 +2040,7 @@ static int test_EVP_SM2(void) sizeof(kMsg)))) goto done; - if (!TEST_true(EVP_PKEY_decrypt_init(cctx))) + if (!TEST_int_gt(EVP_PKEY_decrypt_init(cctx), 0)) goto done; if (!TEST_true(EVP_PKEY_CTX_set_params(cctx, sparams))) |