From: James Morris <james.l.morris@oracle.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>,
linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH] pkcs7: fix check for self-signed certificate
Date: Mon, 27 Nov 2017 20:54:52 +1100 (AEDT) [thread overview]
Message-ID: <alpine.LFD.2.20.1711272054440.2808@localhost> (raw)
In-Reply-To: <20171127071942.26214-1-ebiggers3@gmail.com>
On Sun, 26 Nov 2017, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> pkcs7_validate_trust_one() used 'x509->next == x509' to identify a
> self-signed certificate. That's wrong; ->next is simply the link in the
> linked list of certificates in the PKCS#7 message. It should be
> checking ->signer instead. Fix it.
>
> Fortunately this didn't actually matter because when we re-visited
> 'x509' on the next iteration via 'x509->signer', it was already seen and
> not verified, so we returned -ENOKEY anyway.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> crypto/asymmetric_keys/pkcs7_trust.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/crypto/asymmetric_keys/pkcs7_trust.c b/crypto/asymmetric_keys/pkcs7_trust.c
> index f6a009d88a33..1f4e25f10049 100644
> --- a/crypto/asymmetric_keys/pkcs7_trust.c
> +++ b/crypto/asymmetric_keys/pkcs7_trust.c
> @@ -69,7 +69,7 @@ static int pkcs7_validate_trust_one(struct pkcs7_message *pkcs7,
> /* Self-signed certificates form roots of their own, and if we
> * don't know them, then we can't accept them.
> */
> - if (x509->next == x509) {
> + if (x509->signer == x509) {
> kleave(" = -ENOKEY [unknown self-signed]");
> return -ENOKEY;
> }
> --
Reviewed-by: James Morris <james.l.morris@oracle.com>
--
James Morris
<james.l.morris@oracle.com>
WARNING: multiple messages have this Message-ID (diff)
From: James Morris <james.l.morris@oracle.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>,
linux-crypto@vger.kernel.org, Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH] pkcs7: fix check for self-signed certificate
Date: Mon, 27 Nov 2017 09:54:52 +0000 [thread overview]
Message-ID: <alpine.LFD.2.20.1711272054440.2808@localhost> (raw)
In-Reply-To: <20171127071942.26214-1-ebiggers3@gmail.com>
On Sun, 26 Nov 2017, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> pkcs7_validate_trust_one() used 'x509->next = x509' to identify a
> self-signed certificate. That's wrong; ->next is simply the link in the
> linked list of certificates in the PKCS#7 message. It should be
> checking ->signer instead. Fix it.
>
> Fortunately this didn't actually matter because when we re-visited
> 'x509' on the next iteration via 'x509->signer', it was already seen and
> not verified, so we returned -ENOKEY anyway.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> crypto/asymmetric_keys/pkcs7_trust.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/crypto/asymmetric_keys/pkcs7_trust.c b/crypto/asymmetric_keys/pkcs7_trust.c
> index f6a009d88a33..1f4e25f10049 100644
> --- a/crypto/asymmetric_keys/pkcs7_trust.c
> +++ b/crypto/asymmetric_keys/pkcs7_trust.c
> @@ -69,7 +69,7 @@ static int pkcs7_validate_trust_one(struct pkcs7_message *pkcs7,
> /* Self-signed certificates form roots of their own, and if we
> * don't know them, then we can't accept them.
> */
> - if (x509->next = x509) {
> + if (x509->signer = x509) {
> kleave(" = -ENOKEY [unknown self-signed]");
> return -ENOKEY;
> }
> --
Reviewed-by: James Morris <james.l.morris@oracle.com>
--
James Morris
<james.l.morris@oracle.com>
next prev parent reply other threads:[~2017-11-27 9:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 7:19 [PATCH] pkcs7: fix check for self-signed certificate Eric Biggers
2017-11-27 7:19 ` Eric Biggers
2017-11-27 9:54 ` James Morris [this message]
2017-11-27 9:54 ` James Morris
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=alpine.LFD.2.20.1711272054440.2808@localhost \
--to=james.l.morris@oracle.com \
--cc=dhowells@redhat.com \
--cc=ebiggers3@gmail.com \
--cc=ebiggers@google.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-crypto@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.