All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-security-module@vger.kernel.org, keyrings@linux-nfs.org,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	dan.carpenter@oracle.com
Subject: Re: [PATCH] PKCS#7: issuer and subject are mandatory fields in the ASN.1
Date: Fri, 1 Aug 2014 12:03:28 -0400	[thread overview]
Message-ID: <20140801160328.GA5100@redhat.com> (raw)
In-Reply-To: <20140731141103.16348.91901.stgit@warthog.procyon.org.uk>

On Thu, Jul 31, 2014 at 03:11:03PM +0100, David Howells wrote:
> issuer and subject are mandatory fields in the ASN.1 and so their existence
> needn't be tested for.  They are guaranteed to end up with an empty string if
> the name material has nothing we can use (see x509_fabricate_name()).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: David Howells <dhowells@redhat.com>

Looks good to me.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Thanks
Vivek

> ---
>  crypto/asymmetric_keys/pkcs7_verify.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
> index 51ff36f3a913..c62cf8006e1f 100644
> --- a/crypto/asymmetric_keys/pkcs7_verify.c
> +++ b/crypto/asymmetric_keys/pkcs7_verify.c
> @@ -190,14 +190,12 @@ static int pkcs7_verify_sig_chain(struct pkcs7_message *pkcs7,
>  		if (ret < 0)
>  			return ret;
>  
> -		if (x509->issuer)
> -			pr_debug("- issuer %s\n", x509->issuer);
> +		pr_debug("- issuer %s\n", x509->issuer);
>  		if (x509->authority)
>  			pr_debug("- authkeyid %s\n", x509->authority);
>  
>  		if (!x509->authority ||
> -		    (x509->subject &&
> -		     strcmp(x509->subject, x509->issuer) == 0)) {
> +		    strcmp(x509->subject, x509->issuer) == 0) {
>  			/* If there's no authority certificate specified, then
>  			 * the certificate must be self-signed and is the root
>  			 * of the chain.  Likewise if the cert is its own

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Vivek Goyal <vgoyal@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: dan.carpenter@oracle.com, keyrings@linux-nfs.org,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH] PKCS#7: issuer and subject are mandatory fields in the ASN.1
Date: Fri, 1 Aug 2014 12:03:28 -0400	[thread overview]
Message-ID: <20140801160328.GA5100@redhat.com> (raw)
In-Reply-To: <20140731141103.16348.91901.stgit@warthog.procyon.org.uk>

On Thu, Jul 31, 2014 at 03:11:03PM +0100, David Howells wrote:
> issuer and subject are mandatory fields in the ASN.1 and so their existence
> needn't be tested for.  They are guaranteed to end up with an empty string if
> the name material has nothing we can use (see x509_fabricate_name()).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: David Howells <dhowells@redhat.com>

Looks good to me.

Acked-by: Vivek Goyal <vgoyal@redhat.com>

Thanks
Vivek

> ---
>  crypto/asymmetric_keys/pkcs7_verify.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c
> index 51ff36f3a913..c62cf8006e1f 100644
> --- a/crypto/asymmetric_keys/pkcs7_verify.c
> +++ b/crypto/asymmetric_keys/pkcs7_verify.c
> @@ -190,14 +190,12 @@ static int pkcs7_verify_sig_chain(struct pkcs7_message *pkcs7,
>  		if (ret < 0)
>  			return ret;
>  
> -		if (x509->issuer)
> -			pr_debug("- issuer %s\n", x509->issuer);
> +		pr_debug("- issuer %s\n", x509->issuer);
>  		if (x509->authority)
>  			pr_debug("- authkeyid %s\n", x509->authority);
>  
>  		if (!x509->authority ||
> -		    (x509->subject &&
> -		     strcmp(x509->subject, x509->issuer) == 0)) {
> +		    strcmp(x509->subject, x509->issuer) == 0) {
>  			/* If there's no authority certificate specified, then
>  			 * the certificate must be self-signed and is the root
>  			 * of the chain.  Likewise if the cert is its own

  reply	other threads:[~2014-08-01 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 14:11 [PATCH] PKCS#7: issuer and subject are mandatory fields in the ASN.1 David Howells
2014-07-31 14:11 ` David Howells
2014-08-01 16:03 ` Vivek Goyal [this message]
2014-08-01 16:03   ` Vivek Goyal

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=20140801160328.GA5100@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=keyrings@linux-nfs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@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.