summaryrefslogtreecommitdiff
path: root/crypto/asymmetric_keys/restrict.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-02-22 14:38:33 +0000
committerDavid Howells <dhowells@redhat.com>2018-02-22 14:38:33 +0000
commitd1fe066df0d1d00008b30898c7f4377a88870055 (patch)
tree95c3ce54499d0d5b7edcf9fe8f3e5f8d5f07708f /crypto/asymmetric_keys/restrict.c
parentfeac26f3aa29740b74f3d108fd58fdbed85418aa (diff)
downloadlinux-crypto-d1fe066df0d1d00008b30898c7f4377a88870055.tar.gz
linux-crypto-d1fe066df0d1d00008b30898c7f4377a88870055.zip
X.509: fix BUG_ON() when hash algorithm is unsupported
The X.509 parser mishandles the case where the certificate's signature's hash algorithm is not available in the crypto API. In this case, x509_get_sig_params() doesn't allocate the cert->sig->digest buffer; this part seems to be intentional. However, public_key_verify_signature() is still called via x509_check_for_self_signed(), which triggers the 'BUG_ON(!sig->digest)'. Fix this by making public_key_verify_signature() return -ENOPKG if the hash buffer has not been allocated. Reproducer when all the CONFIG_CRYPTO_SHA512* options are disabled: openssl req -new -sha512 -x509 -batch -nodes -outform der \ | keyctl padd asymmetric desc @s Fixes: c68cd83d9915 ("X.509: Extract signature digest and make self-signed cert checks earlier") Reported-by: Paolo Valente <paolo.valente@linaro.org> Cc: Paolo Valente <paolo.valente@linaro.org> Cc: <stable@vger.kernel.org> # v4.7+ Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions