• Mimi Zohar's avatar
    KEYS: fix "ca_keys=" partial key matching · f2b3dee4
    Mimi Zohar authored
    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 46963b77 ("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: default avatarDavid Howells <dhowells@redhat.com>
    Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
    Cc: stable@vger.kernel.org # 3.18
    f2b3dee4
x509_public_key.c 9.44 KB