All of lore.kernel.org
 help / color / mirror / Atom feed
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 3/5] pkcs7: Clear the ->verified flag before checking trust
Date: Tue, 1 Dec 2026 18:25:00 +0200	[thread overview]
Message-ID: <aw703IvR6Ou2agnn@kernel.org> (raw)
In-Reply-To: <20261201-pkcs7-v1-3-ace9edcd1a53@pereq.eu>

On Tue, Dec 01, 2026 at 11:22:29AM +0300, Dan Carpenter wrote:
> The pkcs7_validate_trust() function can be called multiple times.  In
> particular we call it with the .blacklist keyring and then again with
> the trusted keyring.  The ->verified flag should always be reset to false
> at the start so we don't re-use the value from the previous call.
> 
> This doesn't affect anything after my previous fixes are applied but it's
> obviously the correct thing to do.
> 
> 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>
> ---
>  crypto/asymmetric_keys/pkcs7_trust.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_trust.c b/crypto/asymmetric_keys/pkcs7_trust.c
> index 7f8b80c8488a..82ff3d2bb4ac 100644
> --- a/crypto/asymmetric_keys/pkcs7_trust.c
> +++ b/crypto/asymmetric_keys/pkcs7_trust.c
> @@ -168,8 +168,10 @@ int pkcs7_validate_trust(struct pkcs7_message *pkcs7,
>  	int cached_ret = -ENOKEY;
>  	int ret;
>  
> -	for (p = pkcs7->certs; p; p = p->next)
> +	for (p = pkcs7->certs; p; p = p->next) {
>  		p->seen = false;
> +		p->verified = false;
> +	}
>  
>  	for (sinfo = pkcs7->signed_infos; sinfo; sinfo = sinfo->next) {
>  		ret = pkcs7_validate_trust_one(pkcs7, sinfo, trust_keyring);
> 
> -- 
> 2.53.0
> 


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

I have a fresh recollection of this code as I recently updated my old
patch set [1] and went through asymmetric keys while at it. Thus,
this sudden activity.

[1] https://lore.kernel.org/keyrings/awzN3mJnVJWckleF@kernel.org/T/#rc8d0baf69de43237c2f29a2edfa1c36e11e3035b

Br, Jarkko

  reply	other threads:[~2026-12-01 16:25 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
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 [this message]
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=aw703IvR6Ou2agnn@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.