kernel_optimize_test/crypto/asymmetric_keys
Tianjia Zhang 90bd4a0cf5 X.509: Fix crash caused by NULL pointer
commit 7178a107f5ea7bdb1cc23073234f0ded0ef90ec7 upstream.

On the following call path, `sig->pkey_algo` is not assigned
in asymmetric_key_verify_signature(), which causes runtime
crash in public_key_verify_signature().

  keyctl_pkey_verify
    asymmetric_key_verify_signature
      verify_signature
        public_key_verify_signature

This patch simply check this situation and fixes the crash
caused by NULL pointer.

Fixes: 2155256396 ("X.509: support OSCCA SM2-with-SM3 certificate verification")
Reported-by: Tobias Markus <tobias@markus-regensburg.de>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-and-tested-by: Toke Høiland-Jørgensen <toke@redhat.com>
Tested-by: João Fonseca <jpedrofonseca@ua.pt>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-23 16:03:58 +01:00
..
asym_tpm.c crypto: asym_tpm: correct zero out potential secrets 2021-01-12 20:18:17 +01:00
asymmetric_keys.h
asymmetric_type.c
Kconfig
Makefile X.509: Fix modular build of public_key_sm2 2020-10-08 16:39:14 +11:00
mscode_parser.c
mscode.asn1
pkcs7_key_type.c
pkcs7_parser.c
pkcs7_parser.h
pkcs7_trust.c
pkcs7_verify.c
pkcs7.asn1
pkcs8_parser.c
pkcs8.asn1
public_key.c X.509: Fix crash caused by NULL pointer 2021-01-23 16:03:58 +01:00
restrict.c
signature.c
tpm_parser.c
tpm.asn1
verify_pefile.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
verify_pefile.h
x509_akid.asn1
x509_cert_parser.c X.509: support OSCCA certificate parse 2020-09-25 17:48:54 +10:00
x509_parser.h
x509_public_key.c X.509: support OSCCA SM2-with-SM3 certificate verification 2020-09-25 17:48:55 +10:00
x509.asn1