linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: keyrings@vger.kernel.org, David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko@kernel.org>
Cc: linux-crypto@vger.kernel.org
Subject: [PATCH 4/4] KEYS: x509: remove dead code that set ->unsupported_sig
Date: Thu, 13 Jan 2022 16:29:20 -0800	[thread overview]
Message-ID: <20220114002920.103858-5-ebiggers@kernel.org> (raw)
In-Reply-To: <20220114002920.103858-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

The X.509 parser always sets cert->sig->pkey_algo and
cert->sig->hash_algo on success, since x509_note_sig_algo() is a
mandatory action in the X.509 ASN.1 grammar, and it returns an error if
the signature's algorithm is unknown.  Thus, remove the dead code which
handled these fields being NULL.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/asymmetric_keys/x509_public_key.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
index b03d04d78eb9..8c77a297a82d 100644
--- a/crypto/asymmetric_keys/x509_public_key.c
+++ b/crypto/asymmetric_keys/x509_public_key.c
@@ -33,15 +33,6 @@ int x509_get_sig_params(struct x509_certificate *cert)
 	sig->data = cert->tbs;
 	sig->data_size = cert->tbs_size;
 
-	if (!sig->pkey_algo)
-		cert->unsupported_sig = true;
-
-	/* We check the hash if we can - even if we can't then verify it */
-	if (!sig->hash_algo) {
-		cert->unsupported_sig = true;
-		return 0;
-	}
-
 	sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL);
 	if (!sig->s)
 		return -ENOMEM;
-- 
2.34.1


  parent reply	other threads:[~2022-01-14  0:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  0:29 [PATCH 0/4] KEYS: x509: various cleanups Eric Biggers
2022-01-14  0:29 ` [PATCH 1/4] KEYS: x509: clearly distinguish between key and signature algorithms Eric Biggers
2022-01-15 19:04   ` Jarkko Sakkinen
2022-01-14  0:29 ` [PATCH 2/4] KEYS: x509: remove unused fields Eric Biggers
2022-01-15 19:05   ` Jarkko Sakkinen
2022-01-14  0:29 ` [PATCH 3/4] KEYS: x509: remove never-set ->unsupported_key flag Eric Biggers
2022-01-15 18:53   ` Jarkko Sakkinen
2022-01-14  0:29 ` Eric Biggers [this message]
2022-01-15 19:07   ` [PATCH 4/4] KEYS: x509: remove dead code that set ->unsupported_sig Jarkko Sakkinen

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=20220114002920.103858-5-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).