aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/key.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/key.h')
-rw-r--r--include/linux/key.h33
1 files changed, 14 insertions, 19 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index e1d4715f3222..66f705243985 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -89,6 +89,11 @@ struct keyring_index_key {
89 size_t desc_len; 89 size_t desc_len;
90}; 90};
91 91
92union key_payload {
93 void __rcu *rcu_data0;
94 void *data[4];
95};
96
92/*****************************************************************************/ 97/*****************************************************************************/
93/* 98/*
94 * key reference with possession attribute handling 99 * key reference with possession attribute handling
@@ -186,28 +191,18 @@ struct key {
186 }; 191 };
187 }; 192 };
188 193
189 /* type specific data
190 * - this is used by the keyring type to index the name
191 */
192 union {
193 struct list_head link;
194 unsigned long x[2];
195 void *p[2];
196 int reject_error;
197 } type_data;
198
199 /* key data 194 /* key data
200 * - this is used to hold the data actually used in cryptography or 195 * - this is used to hold the data actually used in cryptography or
201 * whatever 196 * whatever
202 */ 197 */
203 union { 198 union {
204 union { 199 union key_payload payload;
205 unsigned long value; 200 struct {
206 void __rcu *rcudata; 201 /* Keyring bits */
207 void *data; 202 struct list_head name_link;
208 void *data2[2]; 203 struct assoc_array keys;
209 } payload; 204 };
210 struct assoc_array keys; 205 int reject_error;
211 }; 206 };
212}; 207};
213 208
@@ -336,12 +331,12 @@ static inline bool key_is_instantiated(const struct key *key)
336} 331}
337 332
338#define rcu_dereference_key(KEY) \ 333#define rcu_dereference_key(KEY) \
339 (rcu_dereference_protected((KEY)->payload.rcudata, \ 334 (rcu_dereference_protected((KEY)->payload.rcu_data0, \
340 rwsem_is_locked(&((struct key *)(KEY))->sem))) 335 rwsem_is_locked(&((struct key *)(KEY))->sem)))
341 336
342#define rcu_assign_keypointer(KEY, PAYLOAD) \ 337#define rcu_assign_keypointer(KEY, PAYLOAD) \
343do { \ 338do { \
344 rcu_assign_pointer((KEY)->payload.rcudata, (PAYLOAD)); \ 339 rcu_assign_pointer((KEY)->payload.rcu_data0, (PAYLOAD)); \
345} while (0) 340} while (0)
346 341
347#ifdef CONFIG_SYSCTL 342#ifdef CONFIG_SYSCTL