diff options
author | David Howells <dhowells@redhat.com> | 2015-10-21 09:04:48 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2015-10-21 10:18:36 -0400 |
commit | 146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc (patch) | |
tree | a89ef2cd2e8029b0c09a58739cca0e7e2e68f4db /include/keys | |
parent | 4adc605edc5f744dcf432241b5996ff6a13d868c (diff) |
KEYS: Merge the type-specific data with the payload data
Merge the type-specific data with the payload data into one four-word chunk
as it seems pointless to keep them separate.
Use user_key_payload() for accessing the payloads of overloaded
user-defined keys.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-cifs@vger.kernel.org
cc: ecryptfs@vger.kernel.org
cc: linux-ext4@vger.kernel.org
cc: linux-f2fs-devel@lists.sourceforge.net
cc: linux-nfs@vger.kernel.org
cc: ceph-devel@vger.kernel.org
cc: linux-ima-devel@lists.sourceforge.net
Diffstat (limited to 'include/keys')
-rw-r--r-- | include/keys/asymmetric-subtype.h | 2 | ||||
-rw-r--r-- | include/keys/asymmetric-type.h | 15 | ||||
-rw-r--r-- | include/keys/user-type.h | 8 |
3 files changed, 24 insertions, 1 deletions
diff --git a/include/keys/asymmetric-subtype.h b/include/keys/asymmetric-subtype.h index 4b840e822209..4915d40d3c3c 100644 --- a/include/keys/asymmetric-subtype.h +++ b/include/keys/asymmetric-subtype.h | |||
@@ -49,7 +49,7 @@ struct asymmetric_key_subtype { | |||
49 | static inline | 49 | static inline |
50 | struct asymmetric_key_subtype *asymmetric_key_subtype(const struct key *key) | 50 | struct asymmetric_key_subtype *asymmetric_key_subtype(const struct key *key) |
51 | { | 51 | { |
52 | return key->type_data.p[0]; | 52 | return key->payload.data[asym_subtype]; |
53 | } | 53 | } |
54 | 54 | ||
55 | #endif /* _KEYS_ASYMMETRIC_SUBTYPE_H */ | 55 | #endif /* _KEYS_ASYMMETRIC_SUBTYPE_H */ |
diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h index c0754abb2f56..59c1df9cf922 100644 --- a/include/keys/asymmetric-type.h +++ b/include/keys/asymmetric-type.h | |||
@@ -19,6 +19,16 @@ | |||
19 | extern struct key_type key_type_asymmetric; | 19 | extern struct key_type key_type_asymmetric; |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * The key payload is four words. The asymmetric-type key uses them as | ||
23 | * follows: | ||
24 | */ | ||
25 | enum asymmetric_payload_bits { | ||
26 | asym_crypto, | ||
27 | asym_subtype, | ||
28 | asym_key_ids, | ||
29 | }; | ||
30 | |||
31 | /* | ||
22 | * Identifiers for an asymmetric key ID. We have three ways of looking up a | 32 | * Identifiers for an asymmetric key ID. We have three ways of looking up a |
23 | * key derived from an X.509 certificate: | 33 | * key derived from an X.509 certificate: |
24 | * | 34 | * |
@@ -58,6 +68,11 @@ extern struct asymmetric_key_id *asymmetric_key_generate_id(const void *val_1, | |||
58 | size_t len_1, | 68 | size_t len_1, |
59 | const void *val_2, | 69 | const void *val_2, |
60 | size_t len_2); | 70 | size_t len_2); |
71 | static inline | ||
72 | const struct asymmetric_key_ids *asymmetric_key_ids(const struct key *key) | ||
73 | { | ||
74 | return key->payload.data[asym_key_ids]; | ||
75 | } | ||
61 | 76 | ||
62 | /* | 77 | /* |
63 | * The payload is at the discretion of the subtype. | 78 | * The payload is at the discretion of the subtype. |
diff --git a/include/keys/user-type.h b/include/keys/user-type.h index cebefb069c44..c56fef40f53e 100644 --- a/include/keys/user-type.h +++ b/include/keys/user-type.h | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/key.h> | 15 | #include <linux/key.h> |
16 | #include <linux/rcupdate.h> | 16 | #include <linux/rcupdate.h> |
17 | 17 | ||
18 | #ifdef CONFIG_KEYS | ||
19 | |||
18 | /*****************************************************************************/ | 20 | /*****************************************************************************/ |
19 | /* | 21 | /* |
20 | * the payload for a key of type "user" or "logon" | 22 | * the payload for a key of type "user" or "logon" |
@@ -46,5 +48,11 @@ extern void user_describe(const struct key *user, struct seq_file *m); | |||
46 | extern long user_read(const struct key *key, | 48 | extern long user_read(const struct key *key, |
47 | char __user *buffer, size_t buflen); | 49 | char __user *buffer, size_t buflen); |
48 | 50 | ||
51 | static inline const struct user_key_payload *user_key_payload(const struct key *key) | ||
52 | { | ||
53 | return (struct user_key_payload *)rcu_dereference_key(key); | ||
54 | } | ||
55 | |||
56 | #endif /* CONFIG_KEYS */ | ||
49 | 57 | ||
50 | #endif /* _KEYS_USER_TYPE_H */ | 58 | #endif /* _KEYS_USER_TYPE_H */ |