]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the checks of BIO_get_cipher_status
authorPeiwei Hu <jlu.hpw@foxmail.com>
Sat, 28 May 2022 16:07:04 +0000 (00:07 +0800)
committerTodd Short <todd.short@me.com>
Thu, 2 Jun 2022 14:36:56 +0000 (10:36 -0400)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/18424)

crypto/cms/cms_smime.c
crypto/pkcs7/pk7_smime.c

index 6d4351648957069243dfa2db5f6a96f490707d44..2123875f1cd898dec52dbf8ac7a6fb5fe4e3e4c2 100644 (file)
@@ -48,7 +48,7 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
         i = BIO_read(in, buf, sizeof(buf));
         if (i <= 0) {
             if (BIO_method_type(in) == BIO_TYPE_CIPHER) {
-                if (!BIO_get_cipher_status(in))
+                if (BIO_get_cipher_status(in) <= 0)
                     goto err;
             }
             if (i < 0)
index 8bc83bc9f45d06d5b411accc1e43907abc30a68b..56891b6efb7699af189378b75b1addc6ce23b3d8 100644 (file)
@@ -533,7 +533,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
         }
         ret = SMIME_text(bread, data);
         if (ret > 0 && BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
-            if (!BIO_get_cipher_status(tmpmem))
+            if (BIO_get_cipher_status(tmpmem) <= 0)
                 ret = 0;
         }
         BIO_free_all(bread);
@@ -548,7 +548,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
         if (i <= 0) {
             ret = 1;
             if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
-                if (!BIO_get_cipher_status(tmpmem))
+                if (BIO_get_cipher_status(tmpmem) <= 0)
                     ret = 0;
             }