[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230815112942.392572-1-public@thson.de>
Date: Tue, 15 Aug 2023 14:29:42 +0300
From: Thore Sommer <public@...on.de>
To: dhowells@...hat.com, herbert@...dor.apana.org.au,
davem@...emloft.net
Cc: keyrings@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, Thore Sommer <public@...on.de>
Subject: [PATCH] X.509: if signature is unsupported skip validation
When the hash algorithm for the signature is not available the digest size
is 0 and the signature in the certificate is marked as unsupported.
When validating a self-signed certificate, this needs to be checked,
because otherwise trying to validate the signature will fail with an
warning:
Loading compiled-in X.509 certificates
WARNING: CPU: 0 PID: 1 at crypto/rsa-pkcs1pad.c:537 \
pkcs1pad_verify+0x46/0x12c
...
Problem loading in-kernel X.509 certificate (-22)
Signed-off-by: Thore Sommer <public@...on.de>
---
crypto/asymmetric_keys/x509_public_key.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
index 6fdfc82e23a8..7c71db3ac23d 100644
--- a/crypto/asymmetric_keys/x509_public_key.c
+++ b/crypto/asymmetric_keys/x509_public_key.c
@@ -130,6 +130,11 @@ int x509_check_for_self_signed(struct x509_certificate *cert)
goto out;
}
+ if (cert->unsupported_sig) {
+ ret = 0;
+ goto out;
+ }
+
ret = public_key_verify_signature(cert->pub, cert->sig);
if (ret < 0) {
if (ret == -ENOPKG) {
--
2.41.0
Powered by blists - more mailing lists