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.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index cbf464ad9589..e693e729bc92 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -205,6 +205,11 @@ struct key_type {
205 /* match a key against a description */ 205 /* match a key against a description */
206 int (*match)(const struct key *key, const void *desc); 206 int (*match)(const struct key *key, const void *desc);
207 207
208 /* clear some of the data from a key on revokation (optional)
209 * - the key's semaphore will be write-locked by the caller
210 */
211 void (*revoke)(struct key *key);
212
208 /* clear the data from a key (optional) */ 213 /* clear the data from a key (optional) */
209 void (*destroy)(struct key *key); 214 void (*destroy)(struct key *key);
210 215
@@ -241,8 +246,16 @@ extern void unregister_key_type(struct key_type *ktype);
241 246
242extern struct key *key_alloc(struct key_type *type, 247extern struct key *key_alloc(struct key_type *type,
243 const char *desc, 248 const char *desc,
244 uid_t uid, gid_t gid, key_perm_t perm, 249 uid_t uid, gid_t gid,
245 int not_in_quota); 250 struct task_struct *ctx,
251 key_perm_t perm,
252 unsigned long flags);
253
254
255#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
256#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
257#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
258
246extern int key_payload_reserve(struct key *key, size_t datalen); 259extern int key_payload_reserve(struct key *key, size_t datalen);
247extern int key_instantiate_and_link(struct key *key, 260extern int key_instantiate_and_link(struct key *key,
248 const void *data, 261 const void *data,
@@ -279,7 +292,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring,
279 const char *description, 292 const char *description,
280 const void *payload, 293 const void *payload,
281 size_t plen, 294 size_t plen,
282 int not_in_quota); 295 unsigned long flags);
283 296
284extern int key_update(key_ref_t key, 297extern int key_update(key_ref_t key,
285 const void *payload, 298 const void *payload,
@@ -292,7 +305,9 @@ extern int key_unlink(struct key *keyring,
292 struct key *key); 305 struct key *key);
293 306
294extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 307extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
295 int not_in_quota, struct key *dest); 308 struct task_struct *ctx,
309 unsigned long flags,
310 struct key *dest);
296 311
297extern int keyring_clear(struct key *keyring); 312extern int keyring_clear(struct key *keyring);
298 313
@@ -313,7 +328,8 @@ extern void keyring_replace_payload(struct key *key, void *replacement);
313 * the userspace interface 328 * the userspace interface
314 */ 329 */
315extern struct key root_user_keyring, root_session_keyring; 330extern struct key root_user_keyring, root_session_keyring;
316extern int alloc_uid_keyring(struct user_struct *user); 331extern int alloc_uid_keyring(struct user_struct *user,
332 struct task_struct *ctx);
317extern void switch_uid_keyring(struct user_struct *new_user); 333extern void switch_uid_keyring(struct user_struct *new_user);
318extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); 334extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
319extern int copy_thread_group_keys(struct task_struct *tsk); 335extern int copy_thread_group_keys(struct task_struct *tsk);
@@ -342,7 +358,7 @@ extern void key_init(void);
342#define make_key_ref(k) ({ NULL; }) 358#define make_key_ref(k) ({ NULL; })
343#define key_ref_to_ptr(k) ({ NULL; }) 359#define key_ref_to_ptr(k) ({ NULL; })
344#define is_key_possessed(k) 0 360#define is_key_possessed(k) 0
345#define alloc_uid_keyring(u) 0 361#define alloc_uid_keyring(u,c) 0
346#define switch_uid_keyring(u) do { } while(0) 362#define switch_uid_keyring(u) do { } while(0)
347#define __install_session_keyring(t, k) ({ NULL; }) 363#define __install_session_keyring(t, k) ({ NULL; })
348#define copy_keys(f,t) 0 364#define copy_keys(f,t) 0
@@ -355,6 +371,10 @@ extern void key_init(void);
355#define key_fsgid_changed(t) do { } while(0) 371#define key_fsgid_changed(t) do { } while(0)
356#define key_init() do { } while(0) 372#define key_init() do { } while(0)
357 373
374/* Initial keyrings */
375extern struct key root_user_keyring;
376extern struct key root_session_keyring;
377
358#endif /* CONFIG_KEYS */ 378#endif /* CONFIG_KEYS */
359#endif /* __KERNEL__ */ 379#endif /* __KERNEL__ */
360#endif /* _LINUX_KEY_H */ 380#endif /* _LINUX_KEY_H */