diff options
Diffstat (limited to 'include/linux/key.h')
| -rw-r--r-- | include/linux/key.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index a70b8a8f2005..c45c962d1cc5 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
| 20 | #include <linux/rbtree.h> | 20 | #include <linux/rbtree.h> |
| 21 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
| 22 | #include <linux/sysctl.h> | ||
| 22 | #include <asm/atomic.h> | 23 | #include <asm/atomic.h> |
| 23 | 24 | ||
| 24 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
| @@ -67,6 +68,8 @@ struct key; | |||
| 67 | #define KEY_OTH_SETATTR 0x00000020 | 68 | #define KEY_OTH_SETATTR 0x00000020 |
| 68 | #define KEY_OTH_ALL 0x0000003f | 69 | #define KEY_OTH_ALL 0x0000003f |
| 69 | 70 | ||
| 71 | #define KEY_PERM_UNDEF 0xffffffff | ||
| 72 | |||
| 70 | struct seq_file; | 73 | struct seq_file; |
| 71 | struct user_struct; | 74 | struct user_struct; |
| 72 | struct signal_struct; | 75 | struct signal_struct; |
| @@ -208,16 +211,19 @@ extern struct key *request_key(struct key_type *type, | |||
| 208 | 211 | ||
| 209 | extern struct key *request_key_with_auxdata(struct key_type *type, | 212 | extern struct key *request_key_with_auxdata(struct key_type *type, |
| 210 | const char *description, | 213 | const char *description, |
| 211 | const char *callout_info, | 214 | const void *callout_info, |
| 215 | size_t callout_len, | ||
| 212 | void *aux); | 216 | void *aux); |
| 213 | 217 | ||
| 214 | extern struct key *request_key_async(struct key_type *type, | 218 | extern struct key *request_key_async(struct key_type *type, |
| 215 | const char *description, | 219 | const char *description, |
| 216 | const char *callout_info); | 220 | const void *callout_info, |
| 221 | size_t callout_len); | ||
| 217 | 222 | ||
| 218 | extern struct key *request_key_async_with_auxdata(struct key_type *type, | 223 | extern struct key *request_key_async_with_auxdata(struct key_type *type, |
| 219 | const char *description, | 224 | const char *description, |
| 220 | const char *callout_info, | 225 | const void *callout_info, |
| 226 | size_t callout_len, | ||
| 221 | void *aux); | 227 | void *aux); |
| 222 | 228 | ||
| 223 | extern int wait_for_key_construction(struct key *key, bool intr); | 229 | extern int wait_for_key_construction(struct key *key, bool intr); |
| @@ -229,6 +235,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring, | |||
| 229 | const char *description, | 235 | const char *description, |
| 230 | const void *payload, | 236 | const void *payload, |
| 231 | size_t plen, | 237 | size_t plen, |
| 238 | key_perm_t perm, | ||
| 232 | unsigned long flags); | 239 | unsigned long flags); |
| 233 | 240 | ||
| 234 | extern int key_update(key_ref_t key, | 241 | extern int key_update(key_ref_t key, |
| @@ -257,14 +264,18 @@ extern int keyring_add_key(struct key *keyring, | |||
| 257 | 264 | ||
| 258 | extern struct key *key_lookup(key_serial_t id); | 265 | extern struct key *key_lookup(key_serial_t id); |
| 259 | 266 | ||
| 260 | #define key_serial(key) ((key) ? (key)->serial : 0) | 267 | static inline key_serial_t key_serial(struct key *key) |
| 268 | { | ||
| 269 | return key ? key->serial : 0; | ||
| 270 | } | ||
| 271 | |||
| 272 | #ifdef CONFIG_SYSCTL | ||
| 273 | extern ctl_table key_sysctls[]; | ||
| 274 | #endif | ||
| 261 | 275 | ||
| 262 | /* | 276 | /* |
| 263 | * the userspace interface | 277 | * the userspace interface |
| 264 | */ | 278 | */ |
| 265 | extern struct key root_user_keyring, root_session_keyring; | ||
| 266 | extern int alloc_uid_keyring(struct user_struct *user, | ||
| 267 | struct task_struct *ctx); | ||
| 268 | extern void switch_uid_keyring(struct user_struct *new_user); | 279 | extern void switch_uid_keyring(struct user_struct *new_user); |
| 269 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); | 280 | extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk); |
| 270 | extern int copy_thread_group_keys(struct task_struct *tsk); | 281 | extern int copy_thread_group_keys(struct task_struct *tsk); |
| @@ -293,7 +304,6 @@ extern void key_init(void); | |||
| 293 | #define make_key_ref(k, p) ({ NULL; }) | 304 | #define make_key_ref(k, p) ({ NULL; }) |
| 294 | #define key_ref_to_ptr(k) ({ NULL; }) | 305 | #define key_ref_to_ptr(k) ({ NULL; }) |
| 295 | #define is_key_possessed(k) 0 | 306 | #define is_key_possessed(k) 0 |
| 296 | #define alloc_uid_keyring(u,c) 0 | ||
| 297 | #define switch_uid_keyring(u) do { } while(0) | 307 | #define switch_uid_keyring(u) do { } while(0) |
| 298 | #define __install_session_keyring(t, k) ({ NULL; }) | 308 | #define __install_session_keyring(t, k) ({ NULL; }) |
| 299 | #define copy_keys(f,t) 0 | 309 | #define copy_keys(f,t) 0 |
| @@ -306,10 +316,6 @@ extern void key_init(void); | |||
| 306 | #define key_fsgid_changed(t) do { } while(0) | 316 | #define key_fsgid_changed(t) do { } while(0) |
| 307 | #define key_init() do { } while(0) | 317 | #define key_init() do { } while(0) |
| 308 | 318 | ||
| 309 | /* Initial keyrings */ | ||
| 310 | extern struct key root_user_keyring; | ||
| 311 | extern struct key root_session_keyring; | ||
| 312 | |||
| 313 | #endif /* CONFIG_KEYS */ | 319 | #endif /* CONFIG_KEYS */ |
| 314 | #endif /* __KERNEL__ */ | 320 | #endif /* __KERNEL__ */ |
| 315 | #endif /* _LINUX_KEY_H */ | 321 | #endif /* _LINUX_KEY_H */ |
