diff options
author | David Howells <dhowells@redhat.com> | 2013-09-24 05:35:15 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-09-24 05:35:15 -0400 |
commit | 16feef4340172b7dbb9cba60850e78fa6388adf1 (patch) | |
tree | 192d76bb3ba75b99c4a4746e2d47996b92b46e39 /include/linux | |
parent | 7e55ca6dcd07b45619035df343c9614a3ab35034 (diff) |
KEYS: Consolidate the concept of an 'index key' for key access
Consolidate the concept of an 'index key' for accessing keys. The index key
is the search term needed to find a key directly - basically the key type and
the key description. We can add to that the description length.
This will be useful when turning a keyring into an associative array rather
than just a pointer block.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/key.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index 51bce2950de4..d573e820a23d 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -82,6 +82,12 @@ struct key_owner; | |||
82 | struct keyring_list; | 82 | struct keyring_list; |
83 | struct keyring_name; | 83 | struct keyring_name; |
84 | 84 | ||
85 | struct keyring_index_key { | ||
86 | struct key_type *type; | ||
87 | const char *description; | ||
88 | size_t desc_len; | ||
89 | }; | ||
90 | |||
85 | /*****************************************************************************/ | 91 | /*****************************************************************************/ |
86 | /* | 92 | /* |
87 | * key reference with possession attribute handling | 93 | * key reference with possession attribute handling |
@@ -129,7 +135,6 @@ struct key { | |||
129 | struct list_head graveyard_link; | 135 | struct list_head graveyard_link; |
130 | struct rb_node serial_node; | 136 | struct rb_node serial_node; |
131 | }; | 137 | }; |
132 | struct key_type *type; /* type of key */ | ||
133 | struct rw_semaphore sem; /* change vs change sem */ | 138 | struct rw_semaphore sem; /* change vs change sem */ |
134 | struct key_user *user; /* owner of this key */ | 139 | struct key_user *user; /* owner of this key */ |
135 | void *security; /* security data for this key */ | 140 | void *security; /* security data for this key */ |
@@ -163,12 +168,18 @@ struct key { | |||
163 | #define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ | 168 | #define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ |
164 | #define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ | 169 | #define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */ |
165 | 170 | ||
166 | /* the description string | 171 | /* the key type and key description string |
167 | * - this is used to match a key against search criteria | 172 | * - the desc is used to match a key against search criteria |
168 | * - this should be a printable string | 173 | * - it should be a printable string |
169 | * - eg: for krb5 AFS, this might be "afs@REDHAT.COM" | 174 | * - eg: for krb5 AFS, this might be "afs@REDHAT.COM" |
170 | */ | 175 | */ |
171 | char *description; | 176 | union { |
177 | struct keyring_index_key index_key; | ||
178 | struct { | ||
179 | struct key_type *type; /* type of key */ | ||
180 | char *description; | ||
181 | }; | ||
182 | }; | ||
172 | 183 | ||
173 | /* type specific data | 184 | /* type specific data |
174 | * - this is used by the keyring type to index the name | 185 | * - this is used by the keyring type to index the name |