]> git.karo-electronics.de Git - karo-tx-linux.git/commit
KEYS: Asymmetric key pluggable data parsers
authorDavid Howells <dhowells@redhat.com>
Thu, 13 Sep 2012 14:17:32 +0000 (15:17 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 28 Sep 2012 05:14:49 +0000 (14:44 +0930)
commitd9e3b785dbde72b61ef0d35f444b1356996b04b8
treebced43296c5f40c5962114cd59123ef9a5671ec2
parent1883e09f8a5bcc7c599b0ae8234acea6a2276089
KEYS: Asymmetric key pluggable data parsers

The instantiation data passed to the asymmetric key type are expected to be
formatted in some way, and there are several possible standard ways to format
the data.

The two obvious standards are OpenPGP keys and X.509 certificates.  The latter
is especially useful when dealing with UEFI, and the former might be useful
when dealing with, say, eCryptfs.

Further, it might be desirable to provide formatted blobs that indicate
hardware is to be accessed to retrieve the keys or that the keys live
unretrievably in a hardware store, but that the keys can be used by means of
the hardware.

From userspace, the keys can be loaded using the keyctl command, for example,
an X.509 binary certificate:

keyctl padd asymmetric foo @s <dhowells.pem

or a PGP key:

keyctl padd asymmetric bar @s <dhowells.pub

or a pointer into the contents of the TPM:

keyctl add asymmetric zebra "TPM:04982390582905f8" @s

Inside the kernel, pluggable parsers register themselves and then get to
examine the payload data to see if they can handle it.  If they can, they get
to:

  (1) Propose a name for the key, to be used it the name is "" or NULL.

  (2) Specify the key subtype.

  (3) Provide the data for the subtype.

The key type asks the parser to do its stuff before a key is allocated and thus
before the name is set.  If successful, the parser stores the suggested data
into the key_preparsed_payload struct, which will be either used (if the key is
successfully created and instantiated or updated) or discarded.

Signed-off-by: David Howells <dhowells@redhat.com>
crypto/asymmetric_keys/asymmetric_type.c
include/keys/asymmetric-parser.h [new file with mode: 0644]