]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the check of EVP_PKEY_decrypt_init
authorPeiwei Hu <jlu.hpw@foxmail.com>
Fri, 2 Dec 2022 08:33:02 +0000 (16:33 +0800)
committerTomas Mraz <tomas@openssl.org>
Mon, 5 Dec 2022 12:04:18 +0000 (13:04 +0100)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19819)

crypto/crmf/crmf_lib.c
test/evp_extra_test.c

index 13d8cf19c3096c118d86d42929b98785ab92ae29..4e90cbe02cffe890d30aca7cc69ad47c80823d3d 100644 (file)
@@ -653,7 +653,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;
index 1e62e2b6a4d794bc01a19c8d880a85a65060227f..7f82a0cdf2bf3ef6de3f844bcd153a856ab83713 100644 (file)
@@ -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)))