* [PATCH] X.509: if signature is unsupported skip validation
@ 2023-08-15 11:29 Thore Sommer
2023-08-16 20:54 ` Jarkko Sakkinen
2023-08-25 11:05 ` Herbert Xu
0 siblings, 2 replies; 5+ messages in thread
From: Thore Sommer @ 2023-08-15 11:29 UTC (permalink / raw)
To: dhowells, herbert, davem
Cc: keyrings, linux-crypto, linux-kernel, Thore Sommer
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>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] X.509: if signature is unsupported skip validation
2023-08-15 11:29 [PATCH] X.509: if signature is unsupported skip validation Thore Sommer
@ 2023-08-16 20:54 ` Jarkko Sakkinen
2023-08-21 10:30 ` Thore Sommer
2023-08-25 11:05 ` Herbert Xu
1 sibling, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2023-08-16 20:54 UTC (permalink / raw)
To: Thore Sommer, dhowells, herbert, davem
Cc: keyrings, linux-crypto, linux-kernel
On Tue Aug 15, 2023 at 2:29 PM EEST, Thore Sommer wrote:
> 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>
> ---
> 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
Should have:
Cc: stable@vger.kernel.org # v4.7+
Fixes: 6c2dc5ae4ab7 ("X.509: Extract signature digest and make self-signed cert checks earlier")
BR, Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] X.509: if signature is unsupported skip validation
2023-08-16 20:54 ` Jarkko Sakkinen
@ 2023-08-21 10:30 ` Thore Sommer
2023-08-22 11:36 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Thore Sommer @ 2023-08-21 10:30 UTC (permalink / raw)
To: Jarkko Sakkinen, dhowells, herbert, davem
Cc: keyrings, linux-crypto, linux-kernel
On 16.08.23 23:54, Jarkko Sakkinen wrote:
> On Tue Aug 15, 2023 at 2:29 PM EEST, Thore Sommer wrote:
>> 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>
>> ---
>> 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
>
> Should have:
>
> Cc: stable@vger.kernel.org # v4.7+
> Fixes: 6c2dc5ae4ab7 ("X.509: Extract signature digest and make self-signed cert checks earlier")
>
> BR, Jarkko
Hi Jarkko,
should I resend it with the stable mailing list in CC or will it be
added when a maintainer includes the change?
Best regards,
Thore
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] X.509: if signature is unsupported skip validation
2023-08-21 10:30 ` Thore Sommer
@ 2023-08-22 11:36 ` Jarkko Sakkinen
0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2023-08-22 11:36 UTC (permalink / raw)
To: Thore Sommer, dhowells, herbert, davem
Cc: keyrings, linux-crypto, linux-kernel
On Mon Aug 21, 2023 at 1:30 PM EEST, Thore Sommer wrote:
> On 16.08.23 23:54, Jarkko Sakkinen wrote:
> > On Tue Aug 15, 2023 at 2:29 PM EEST, Thore Sommer wrote:
> >> 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>
> >> ---
> >> 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
> >
> > Should have:
> >
> > Cc: stable@vger.kernel.org # v4.7+
> > Fixes: 6c2dc5ae4ab7 ("X.509: Extract signature digest and make self-signed cert checks earlier")
> >
> > BR, Jarkko
>
> Hi Jarkko,
>
> should I resend it with the stable mailing list in CC or will it be
> added when a maintainer includes the change?
AFAIK the correct tags, and automation takes care of the rest.
If there is a merge conflict to some stable branch, the bots will call
back to you :-)
BR, Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] X.509: if signature is unsupported skip validation
2023-08-15 11:29 [PATCH] X.509: if signature is unsupported skip validation Thore Sommer
2023-08-16 20:54 ` Jarkko Sakkinen
@ 2023-08-25 11:05 ` Herbert Xu
1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2023-08-25 11:05 UTC (permalink / raw)
To: Thore Sommer; +Cc: dhowells, davem, keyrings, linux-crypto, linux-kernel
On Tue, Aug 15, 2023 at 02:29:42PM +0300, Thore Sommer wrote:
> 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>
> ---
> crypto/asymmetric_keys/x509_public_key.c | 5 +++++
> 1 file changed, 5 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-25 11:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15 11:29 [PATCH] X.509: if signature is unsupported skip validation Thore Sommer
2023-08-16 20:54 ` Jarkko Sakkinen
2023-08-21 10:30 ` Thore Sommer
2023-08-22 11:36 ` Jarkko Sakkinen
2023-08-25 11:05 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox