diff options
author | Eric Biggers <ebiggers@google.com> | 2018-02-22 14:38:34 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-02-22 14:38:34 +0000 |
commit | c7ee969dff58a7f5e447e27fe064e2d1ce81d574 (patch) | |
tree | 89cf28b0e13c85f0a04d216121cbdafdf9668ba0 /crypto/xts.c | |
parent | d1fe066df0d1d00008b30898c7f4377a88870055 (diff) | |
download | linux-crypto-c7ee969dff58a7f5e447e27fe064e2d1ce81d574.tar.gz linux-crypto-c7ee969dff58a7f5e447e27fe064e2d1ce81d574.zip |
X.509: fix NULL dereference when restricting key with unsupported_sig
The asymmetric key type allows an X.509 certificate to be added even if
its signature's hash algorithm is not available in the crypto API. In
that case 'payload.data[asym_auth]' will be NULL. But the key
restriction code failed to check for this case before trying to use the
signature, resulting in a NULL pointer dereference in
key_or_keyring_common() or in restrict_link_by_signature().
Fix this by returning -ENOPKG when the signature is unsupported.
Reproducer when all the CONFIG_CRYPTO_SHA512* options are disabled and
keyctl has support for the 'restrict_keyring' command:
keyctl new_session
keyctl restrict_keyring @s asymmetric builtin_trusted
openssl req -new -sha512 -x509 -batch -nodes -outform der \
| keyctl padd asymmetric desc @s
Fixes: fb2b7eea1a8e ("KEYS: Move the point of trust determination to __key_link()")
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