From: Jarkko Sakkinen <jarkko@kernel.org>
To: Dan Carpenter <dan@pereq.eu>
Cc: "David Howells" <dhowells@redhat.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Ignat Korchagin" <ignat@linux.win>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"David Woodhouse" <dwmw2@infradead.org>,
"Eric Snowberg" <eric.snowberg@oracle.com>,
"Karthik Bhargavan" <karthik@pereq.eu>,
"Clément Blaudeau" <clement@cryspen.com>,
keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 2/5] certs: Fix error checking in is_key_on_revocation_list()
Date: Tue, 1 Dec 2026 18:22:51 +0200 [thread overview]
Message-ID: <aw70W6S8afpk3WXn@kernel.org> (raw)
In-Reply-To: <20261201-pkcs7-v1-2-ace9edcd1a53@pereq.eu>
On Tue, Dec 01, 2026 at 11:22:28AM +0300, Dan Carpenter wrote:
> The is_key_on_revocation_list() function is a bit unusual because it
> always returns errors. An -EKEYREJECTED error is bad, while -ENOKEY
> means the key was not on the revocation list and that's the success
> path.
>
> It works by re-using the pkcs7_validate_trust() function to find the key
> in the revoked list. If the key is found that's bad. If it's not that's
> good. The problem is that pkcs7_validate_trust() gives up early with
> -EKEYREJECTED when it encounters an invalid signature.
>
> We could write a different function that doesn't give up instead of
> re-using pkcs7_validate_trust(), but in practice a key with a bad
> signature should never succeed so just treat that as revoked and return
> -EKEYREJECTED. Or if we hit an -ENOMEM in a non-malicious situation
> then we are already scuppered so rejecting the key is fine.
>
> Fixes: 56c5812623f9 ("certs: Add EFI_CERT_X509_GUID support for dbx entries")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dan Carpenter <dan@pereq.eu>
> ---
> certs/blacklist.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index fa561c12eabf..abadeeb5baa7 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -294,6 +294,8 @@ int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
>
> if (ret == 0)
> return -EKEYREJECTED;
> + if (ret != -ENOKEY && ret != -ENOPKG)
> + return ret;
>
> return -ENOKEY;
> }
>
> --
> 2.53.0
>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Br, Jarkko
next prev parent reply other threads:[~2026-12-01 16:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:22 [PATCH 0/5] pkcs7: Fix some certificate handling bugs Dan Carpenter
2026-12-01 8:22 ` [PATCH 1/5] pkcs7: Don't trust a blacklisted certificate Dan Carpenter
2026-12-01 15:42 ` Jarkko Sakkinen
2026-12-01 15:46 ` Jarkko Sakkinen
2026-12-01 8:22 ` [PATCH 2/5] certs: Fix error checking in is_key_on_revocation_list() Dan Carpenter
2026-12-01 16:22 ` Jarkko Sakkinen [this message]
2026-12-01 8:22 ` [PATCH 3/5] pkcs7: Clear the ->verified flag before checking trust Dan Carpenter
2026-12-01 16:25 ` Jarkko Sakkinen
2026-12-01 8:22 ` [PATCH 4/5] pkcs7: Reset the signer identifier fields and check them Dan Carpenter
2026-12-01 16:25 ` Jarkko Sakkinen
2026-12-01 16:36 ` Dan Carpenter
2026-12-01 8:22 ` [PATCH 5/5] pkcs7: Fix support for subjectKeyIdentifier signers Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aw70W6S8afpk3WXn@kernel.org \
--to=jarkko@kernel.org \
--cc=clement@cryspen.com \
--cc=dan@pereq.eu \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=eric.snowberg@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=ignat@linux.win \
--cc=karthik@pereq.eu \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.