aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/internal.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-11-13 18:39:13 -0500
committerJames Morris <jmorris@namei.org>2008-11-13 18:39:13 -0500
commite9e349b051d98799b743ebf248cc2d986fedf090 (patch)
treed59a46ae39d81d27bcf605663ce0e24d1c6db375 /security/keys/internal.h
parent76aac0e9a17742e60d408be1a706e9aaad370891 (diff)
KEYS: Disperse linux/key_ui.h
Disperse the bits of linux/key_ui.h as the reason they were put here (keyfs) didn't get in. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: James Morris <jmorris@namei.org> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/keys/internal.h')
-rw-r--r--security/keys/internal.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/security/keys/internal.h b/security/keys/internal.h
index b39f5c2e2c4b..a60c68138b4d 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -13,7 +13,6 @@
13#define _INTERNAL_H 13#define _INTERNAL_H
14 14
15#include <linux/key-type.h> 15#include <linux/key-type.h>
16#include <linux/key-ui.h>
17 16
18static inline __attribute__((format(printf, 1, 2))) 17static inline __attribute__((format(printf, 1, 2)))
19void no_printk(const char *fmt, ...) 18void no_printk(const char *fmt, ...)
@@ -82,6 +81,9 @@ extern struct mutex key_construction_mutex;
82extern wait_queue_head_t request_key_conswq; 81extern wait_queue_head_t request_key_conswq;
83 82
84 83
84extern struct key_type *key_type_lookup(const char *type);
85extern void key_type_put(struct key_type *ktype);
86
85extern int __key_link(struct key *keyring, struct key *key); 87extern int __key_link(struct key *keyring, struct key *key);
86 88
87extern key_ref_t __keyring_search_one(key_ref_t keyring_ref, 89extern key_ref_t __keyring_search_one(key_ref_t keyring_ref,
@@ -118,6 +120,33 @@ extern struct key *request_key_and_link(struct key_type *type,
118 struct key *dest_keyring, 120 struct key *dest_keyring,
119 unsigned long flags); 121 unsigned long flags);
120 122
123extern key_ref_t lookup_user_key(struct task_struct *context,
124 key_serial_t id, int create, int partial,
125 key_perm_t perm);
126
127extern long join_session_keyring(const char *name);
128
129/*
130 * check to see whether permission is granted to use a key in the desired way
131 */
132extern int key_task_permission(const key_ref_t key_ref,
133 struct task_struct *context,
134 key_perm_t perm);
135
136static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
137{
138 return key_task_permission(key_ref, current, perm);
139}
140
141/* required permissions */
142#define KEY_VIEW 0x01 /* require permission to view attributes */
143#define KEY_READ 0x02 /* require permission to read content */
144#define KEY_WRITE 0x04 /* require permission to update / modify */
145#define KEY_SEARCH 0x08 /* require permission to search (keyring) or find (key) */
146#define KEY_LINK 0x10 /* require permission to link */
147#define KEY_SETATTR 0x20 /* require permission to change attributes */
148#define KEY_ALL 0x3f /* all the above permissions */
149
121/* 150/*
122 * request_key authorisation 151 * request_key authorisation
123 */ 152 */