KEYS: fix "ca_keys=" partial key matching
authorMimi Zohar <zohar@linux.vnet.ibm.com>
Wed, 11 Feb 2015 12:33:34 +0000 (07:33 -0500)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Thu, 21 May 2015 17:58:59 +0000 (13:58 -0400)
commitf2b3dee484f9cee967a54ef05a66866282337519
tree98af0f7b105fe0971aec9583180c4047ba621c90
parent7c51bb00c40e5608fb2cdac5230f51aeb56a28df
KEYS: fix "ca_keys=" partial key matching

The call to asymmetric_key_hex_to_key_id() from ca_keys_setup()
silently fails with -ENOMEM.  Instead of dynamically allocating
memory from a __setup function, this patch defines a variable
and calls __asymmetric_key_hex_to_key_id(), a new helper function,
directly.

This bug was introduced by 'commit 46963b774d44 ("KEYS: Overhaul
key identification when searching for asymmetric keys")'.

Changelog:
- for clarification, rename hexlen to asciihexlen in
  asymmetric_key_hex_to_key_id()
- add size argument to __asymmetric_key_hex_to_key_id() - David Howells
- inline __asymmetric_key_hex_to_key_id() - David Howells
- remove duplicate strlen() calls

Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # 3.18
crypto/asymmetric_keys/asymmetric_keys.h
crypto/asymmetric_keys/asymmetric_type.c
crypto/asymmetric_keys/x509_public_key.c