linux-stable/crypto/asymmetric_keys
Thore Sommer 51ffed9ca1 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-19 12:22:52 +02:00
..
Kconfig crypto: asymmetric_keys - select CRYPTO_HASH where needed 2019-06-27 14:28:01 +08:00
Makefile X.509: Fix modular build of public_key_sm2 2020-10-08 16:39:14 +11:00
asym_tpm.c crypto: asym_tpm: correct zero out potential secrets 2020-12-31 10:48:53 +01:00
asymmetric_keys.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
asymmetric_type.c KEYS: asymmetric: Fix kerneldoc 2021-01-21 16:16:09 +00:00
mscode.asn1
mscode_parser.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
pkcs7.asn1
pkcs7_key_type.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
pkcs7_parser.c certs: Add support for using elliptic curve keys for signing modules 2021-08-23 19:55:42 +03:00
pkcs7_parser.h crypto: asymmetric_keys: fix some comments in pkcs7_parser.h 2021-01-21 16:16:09 +00:00
pkcs7_trust.c PKCS#7: drop function from kernel-doc pkcs7_validate_trust_one 2021-01-21 16:16:09 +00:00
pkcs7_verify.c asymmetric_keys: log on fatal failures in PE/pkcs7 2023-04-20 12:13:54 +02:00
pkcs8.asn1 KEYS: Implement PKCS#8 RSA Private Key parser [ver #2] 2018-10-26 09:30:46 +01:00
pkcs8_parser.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
public_key.c KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() 2023-06-09 10:32:34 +02:00
restrict.c keys: Update comment for restrict_link_by_key_or_keyring_chain 2021-02-16 10:40:27 +02:00
signature.c docs: crypto: convert asymmetric-keys.txt to ReST 2020-06-19 14:03:46 -06:00
tpm.asn1 KEYS: Add parser for TPM-based keys [ver #2] 2018-10-26 09:30:46 +01:00
tpm_parser.c KEYS: Add parser for TPM-based keys [ver #2] 2018-10-26 09:30:46 +01:00
verify_pefile.c asymmetric_keys: log on fatal failures in PE/pkcs7 2023-04-20 12:13:54 +02:00
verify_pefile.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
x509.asn1 X.509: parse public key parameters from x509 for akcipher 2019-04-18 22:15:02 +08:00
x509_akid.asn1
x509_cert_parser.c x509: Add OID for NIST P384 and extend parser for it 2021-03-26 19:41:59 +11:00
x509_parser.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
x509_public_key.c X.509: if signature is unsupported skip validation 2023-09-19 12:22:52 +02:00