aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-09-13 10:17:32 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-10-07 23:20:13 -0400
commit46c6f1776e2f53eebb1fc361946877bab7533227 (patch)
treeef326bf43e5b20dbe88f2506481c6bdb4487e3de /include
parent964f3b3bf49eb84b5831121446a28b76de3fb23a (diff)
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> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include')
-rw-r--r--include/keys/asymmetric-parser.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/keys/asymmetric-parser.h b/include/keys/asymmetric-parser.h
new file mode 100644
index 000000000000..09b3b4807f5c
--- /dev/null
+++ b/include/keys/asymmetric-parser.h
@@ -0,0 +1,37 @@
1/* Asymmetric public-key cryptography data parser
2 *
3 * See Documentation/crypto/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
12 */
13
14#ifndef _KEYS_ASYMMETRIC_PARSER_H
15#define _KEYS_ASYMMETRIC_PARSER_H
16
17/*
18 * Key data parser. Called during key instantiation.
19 */
20struct asymmetric_key_parser {
21 struct list_head link;
22 struct module *owner;
23 const char *name;
24
25 /* Attempt to parse a key from the data blob passed to add_key() or
26 * keyctl_instantiate(). Should also generate a proposed description
27 * that the caller can optionally use for the key.
28 *
29 * Return EBADMSG if not recognised.
30 */
31 int (*parse)(struct key_preparsed_payload *prep);
32};
33
34extern int register_asymmetric_key_parser(struct asymmetric_key_parser *);
35extern void unregister_asymmetric_key_parser(struct asymmetric_key_parser *);
36
37#endif /* _KEYS_ASYMMETRIC_PARSER_H */