linux-stable/crypto/asymmetric_keys
Roberto Sassu 6b31c11d87 KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()
commit c3d03e8e35 upstream.

Commit ac4e97abce ("scatterlist: sg_set_buf() argument must be in linear
mapping") checks that both the signature and the digest reside in the
linear mapping area.

However, more recently commit ba14a194a4 ("fork: Add generic vmalloced
stack support") made it possible to move the stack in the vmalloc area,
which is not contiguous, and thus not suitable for sg_set_buf() which needs
adjacent pages.

Always make a copy of the signature and digest in the same buffer used to
store the key and its parameters, and pass them to sg_init_one(). Prefer it
to conditionally doing the copy if necessary, to keep the code simple. The
buffer allocated with kmalloc() is in the linear mapping area.

Cc: stable@vger.kernel.org # 4.9.x
Fixes: ba14a194a4 ("fork: Add generic vmalloced stack support")
Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-09 10:48:25 +02:00
..
Kconfig crypto: certs: fix FIPS selftest dependency 2023-02-13 10:00:41 +02:00
Makefile certs: Add FIPS selftests 2022-06-21 16:05:12 +01:00
asymmetric_keys.h
asymmetric_type.c keys: X.509 public key issuer lookup without AKID 2022-01-09 00:18:42 +02:00
mscode.asn1
mscode_parser.c
pkcs7.asn1
pkcs7_key_type.c
pkcs7_parser.c pkcs7: support EC-RDSA/streebog in SignerInfo 2022-08-03 23:56:20 +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 keys: X.509 public key issuer lookup without AKID 2022-01-09 00:18:42 +02:00
pkcs7_verify.c asymmetric_keys: log on fatal failures in PE/pkcs7 2023-03-21 16:23:56 +00:00
pkcs8.asn1
pkcs8_parser.c
public_key.c KEYS: asymmetric: Copy sig and digest in public_key_verify_signature() 2023-06-09 10:48:25 +02:00
restrict.c keys: X.509 public key issuer lookup without AKID 2022-01-09 00:18:42 +02:00
selftest.c certs: Add FIPS selftests 2022-06-21 16:05:12 +01:00
signature.c crypto: cleanup comments 2022-03-03 10:49:20 +12:00
verify_pefile.c asymmetric_keys: log on fatal failures in PE/pkcs7 2023-03-21 16:23:56 +00:00
verify_pefile.h
x509.asn1 KEYS: x509: clearly distinguish between key and signature algorithms 2022-03-08 10:33:18 +02:00
x509_akid.asn1
x509_cert_parser.c X.509: Support parsing certificate using SM2 algorithm 2022-08-03 23:56:20 +03:00
x509_loader.c wifi: cfg80211: Deduplicate certificate loading 2023-01-19 14:46:45 +01:00
x509_parser.h certs: Add FIPS selftests 2022-06-21 16:05:12 +01:00
x509_public_key.c certs: Add FIPS selftests 2022-06-21 16:05:12 +01:00