From: Peiwei Hu Date: Sat, 28 May 2022 16:07:04 +0000 (+0800) Subject: Fix the checks of BIO_get_cipher_status X-Git-Tag: openssl-3.2.0-alpha1~2574 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48b571fe771f283d547ca2a5999ce5dd9a5509d0;p=thirdparty%2Fopenssl.git Fix the checks of BIO_get_cipher_status Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Todd Short (Merged from https://github.com/openssl/openssl/pull/18424) --- diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index 6d435164895..2123875f1cd 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -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) diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c index 8bc83bc9f45..56891b6efb7 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -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; }