From: Jiasheng Jiang Date: Mon, 4 Mar 2024 17:34:02 +0000 (+0000) Subject: PKCS7: Remove one of the duplicate checks X-Git-Tag: openssl-3.3.0-alpha1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8211ca45e41efd4224705848f1de3c2d6aa7b07a;p=thirdparty%2Fopenssl.git PKCS7: Remove one of the duplicate checks There are two consecutive identical checks "if (i <= 0)". We can remove one of them to make the code clear. CLA: trivial Signed-off-by: Jiasheng Jiang Reviewed-by: Tom Cosgrove Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23741) --- diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c index 1f951d77fb4..d3ba19ba29c 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -290,9 +290,8 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, if (!(flags & PKCS7_NOCRL)) X509_STORE_CTX_set0_crls(cert_ctx, p7->d.sign->crl); i = X509_verify_cert(cert_ctx); - if (i <= 0) - j = X509_STORE_CTX_get_error(cert_ctx); if (i <= 0) { + j = X509_STORE_CTX_get_error(cert_ctx); ERR_raise_data(ERR_LIB_PKCS7, PKCS7_R_CERTIFICATE_VERIFY_ERROR, "Verify error: %s", X509_verify_cert_error_string(j));