aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'security/keys/internal.h')
-rw-r--r--security/keys/internal.h32
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
21struct iovec; 23struct 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);
167extern struct work_struct key_gc_work; 169extern struct work_struct key_gc_work;
168extern unsigned key_gc_delay; 170extern unsigned key_gc_delay;
169extern void keyring_gc(struct key *keyring, time_t limit); 171extern void keyring_gc(struct key *keyring, time_t limit);
172extern void keyring_restriction_gc(struct key *keyring,
173 struct key_type *dead_type);
170extern void key_schedule_gc(time_t gc_at); 174extern void key_schedule_gc(time_t gc_at);
171extern void key_schedule_gc_links(void); 175extern void key_schedule_gc_links(void);
172extern void key_gc_keytype(struct key_type *ktype); 176extern void key_gc_keytype(struct key_type *ktype);
@@ -249,6 +253,9 @@ struct iov_iter;
249extern long keyctl_instantiate_key_common(key_serial_t, 253extern long keyctl_instantiate_key_common(key_serial_t,
250 struct iov_iter *, 254 struct iov_iter *,
251 key_serial_t); 255 key_serial_t);
256extern 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
253extern long keyctl_get_persistent(uid_t, key_serial_t); 260extern long keyctl_get_persistent(uid_t, key_serial_t);
254extern unsigned persistent_keyring_expiry; 261extern 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
263extern long keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *, 270extern long keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *,
264 size_t, void __user *); 271 size_t, struct keyctl_kdf_params __user *);
272extern long __keyctl_dh_compute(struct keyctl_dh_params __user *, char __user *,
273 size_t, struct keyctl_kdf_params *);
274#ifdef CONFIG_KEYS_COMPAT
275extern 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
266static inline long keyctl_dh_compute(struct keyctl_dh_params __user *params, 282static 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
290static 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