Thore Sommer 51ffed9ca1 X.509: if signature is unsupported skip validation
commit ef5b52a631f8c18353e80ccab8408b963305510c 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: 6c2dc5ae4ab7 ("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
..
2020-08-28 16:58:28 +10:00
2021-03-26 19:55:55 +11:00
2021-05-28 15:11:47 +08:00
2023-03-10 09:39:11 +01:00
2022-08-17 14:24:19 +02:00
2022-08-17 14:24:19 +02:00
2020-02-28 08:43:21 +08:00
2023-03-10 09:39:11 +01:00
2021-08-21 15:44:58 +08:00
2021-06-11 15:03:30 +08:00
2023-03-10 09:39:13 +01:00