linux-stable/crypto/asymmetric_keys
Thore Sommer 27d694a312 X.509: if signature is unsupported skip validation
commit ef5b52a631 upstream.

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@thson.de>
Cc: stable@vger.kernel.org # v4.7+
Fixes: 6c2dc5ae4a ("X.509: Extract signature digest and make self-signed cert checks earlier")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-23 10:47:01 +02:00
..
.gitignore
Kconfig crypto: asymmetric_keys - select CRYPTO_HASH where needed 2019-07-31 07:28:31 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
asymmetric_keys.h KEYS: Generalise x509_request_asymmetric_key() 2016-04-11 22:41:56 +01:00
asymmetric_type.c KEYS: checking the input id parameters before finding asymmetric key 2017-10-18 09:12:40 +01:00
mscode.asn1
mscode_parser.c pefile: Fix the failure of calculation for digest 2016-07-18 12:19:46 +10:00
pkcs7.asn1 PKCS#7: Appropriately restrict authenticated attributes and content type 2015-08-12 17:01:01 +01:00
pkcs7_key_type.c Replace magic for trusting the secondary keyring with #define 2018-09-09 19:55:54 +02:00
pkcs7_parser.c pkcs7: Prevent NULL pointer dereference, since sinfo is not always set. 2017-10-18 09:12:41 +01:00
pkcs7_parser.h PKCS#7: Handle blacklisted certificates 2017-04-03 16:07:25 +01:00
pkcs7_trust.c PKCS#7: fix direct verification of SignerInfo signature 2018-05-30 07:52:01 +02:00
pkcs7_verify.c PKCS#7: fix certificate blacklisting 2018-02-28 10:19:39 +01:00
public_key.c X.509: fix BUG_ON() when hash algorithm is unsupported 2018-02-28 10:19:39 +01:00
restrict.c X.509: fix NULL dereference when restricting key with unsupported_sig 2018-02-28 10:19:39 +01:00
signature.c KEYS: Add identifier pointers to public_key_signature struct 2016-04-06 16:13:33 +01:00
verify_pefile.c verify_pefile: relax wrapper length check 2023-04-20 12:02:12 +02:00
verify_pefile.h KEYS: Generalise system_verify_data() to provide access to internal content 2016-04-06 16:14:24 +01:00
x509.asn1
x509_akid.asn1 X.509: Extract both parts of the AuthorityKeyIdentifier 2015-08-07 16:26:13 +01:00
x509_cert_parser.c X.509: unpack RSA signatureValue field from BIT STRING 2018-07-03 11:24:57 +02:00
x509_parser.h X.509: Allow X.509 certs to be blacklisted 2017-04-03 16:07:25 +01:00
x509_public_key.c X.509: if signature is unsupported skip validation 2023-09-23 10:47:01 +02:00