diff options
Diffstat (limited to 'security/keys/internal.h')
-rw-r--r-- | security/keys/internal.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/security/keys/internal.h b/security/keys/internal.h index a2f4c0abb8d8..c0f8682eba69 100644 --- a/security/keys/internal.h +++ b/security/keys/internal.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/key-type.h> | 17 | #include <linux/key-type.h> |
18 | #include <linux/task_work.h> | 18 | #include <linux/task_work.h> |
19 | #include <linux/keyctl.h> | 19 | #include <linux/keyctl.h> |
20 | #include <linux/refcount.h> | ||
21 | #include <linux/compat.h> | ||
20 | 22 | ||
21 | struct iovec; | 23 | struct iovec; |
22 | 24 | ||
@@ -53,7 +55,7 @@ struct key_user { | |||
53 | struct rb_node node; | 55 | struct rb_node node; |
54 | struct mutex cons_lock; /* construction initiation lock */ | 56 | struct mutex cons_lock; /* construction initiation lock */ |
55 | spinlock_t lock; | 57 | spinlock_t lock; |
56 | atomic_t usage; /* for accessing qnkeys & qnbytes */ | 58 | refcount_t usage; /* for accessing qnkeys & qnbytes */ |
57 | atomic_t nkeys; /* number of keys */ | 59 | atomic_t nkeys; /* number of keys */ |
58 | atomic_t nikeys; /* number of instantiated keys */ | 60 | atomic_t nikeys; /* number of instantiated keys */ |
59 | kuid_t uid; | 61 | kuid_t uid; |
@@ -167,6 +169,8 @@ extern void key_change_session_keyring(struct callback_head *twork); | |||
167 | extern struct work_struct key_gc_work; | 169 | extern struct work_struct key_gc_work; |
168 | extern unsigned key_gc_delay; | 170 | extern unsigned key_gc_delay; |
169 | extern void keyring_gc(struct key *keyring, time_t limit); | 171 | extern void keyring_gc(struct key *keyring, time_t limit); |
172 | extern void keyring_restriction_gc(struct key *keyring, | ||
173 | struct key_type *dead_type); | ||
170 | extern void key_schedule_gc(time_t gc_at); | 174 | extern void key_schedule_gc(time_t gc_at); |
171 | extern void key_schedule_gc_links(void); | 175 | extern void key_schedule_gc_links(void); |
172 | extern void key_gc_keytype(struct key_type *ktype); | 176 | extern void key_gc_keytype(struct key_type *ktype); |
@@ -249,6 +253,9 @@ struct iov_iter; | |||
249 | extern long keyctl_instantiate_key_common(key_serial_t, | 253 | extern long keyctl_instantiate_key_common(key_serial_t, |
250 | struct iov_iter *, | 254 | struct iov_iter *, |
251 | key_serial_t); | 255 | key_serial_t); |
256 | extern long keyctl_restrict_keyring(key_serial_t id, | ||
257 | const char __user *_type, | ||
258 | const char __user *_restriction); | ||
252 | #ifdef CONFIG_PERSISTENT_KEYRINGS | 259 | #ifdef CONFIG_PERSISTENT_KEYRINGS |
253 | extern long keyctl_get_persistent(uid_t, key_serial_t); | 260 | extern long keyctl_get_persistent(uid_t, key_serial_t); |
254 | extern unsigned persistent_keyring_expiry; | 261 | extern unsigned persistent_keyring_expiry; |
@@ -261,15 +268,34 @@ static inline long keyctl_get_persistent(uid_t uid, key_serial_t destring) | |||
261 | 268 | ||
262 | #ifdef CONFIG_KEY_DH_OPERATIONS | 269 | #ifdef CONFIG_KEY_DH_OPERATIONS |
263 | extern long keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *, | 270 | extern long keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *, |
264 | size_t, void __user *); | 271 | size_t, struct keyctl_kdf_params __user *); |
272 | extern long __keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *, | ||
273 | size_t, struct keyctl_kdf_params *); | ||
274 | #ifdef CONFIG_KEYS_COMPAT | ||
275 | extern long compat_keyctl_dh_compute(struct keyctl_dh_params __user *params, | ||
276 | char __user *buffer, size_t buflen, | ||
277 | struct compat_keyctl_kdf_params __user *kdf); | ||
278 | #endif | ||
279 | #define KEYCTL_KDF_MAX_OUTPUT_LEN 1024 /* max length of KDF output */ | ||
280 | #define KEYCTL_KDF_MAX_OI_LEN 64 /* max length of otherinfo */ | ||
265 | #else | 281 | #else |
266 | static inline long keyctl_dh_compute(struct keyctl_dh_params __user *params, | 282 | static inline long keyctl_dh_compute(struct keyctl_dh_params __user *params, |
267 | char __user *buffer, size_t buflen, | 283 | char __user *buffer, size_t buflen, |
268 | void __user *reserved) | 284 | struct keyctl_kdf_params __user *kdf) |
285 | { | ||
286 | return -EOPNOTSUPP; | ||
287 | } | ||
288 | |||
289 | #ifdef CONFIG_KEYS_COMPAT | ||
290 | static inline long compat_keyctl_dh_compute( | ||
291 | struct keyctl_dh_params __user *params, | ||
292 | char __user *buffer, size_t buflen, | ||
293 | struct keyctl_kdf_params __user *kdf) | ||
269 | { | 294 | { |
270 | return -EOPNOTSUPP; | 295 | return -EOPNOTSUPP; |
271 | } | 296 | } |
272 | #endif | 297 | #endif |
298 | #endif | ||
273 | 299 | ||
274 | /* | 300 | /* |
275 | * Debugging key validation | 301 | * Debugging key validation |