aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/internal.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 11:50:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 11:50:52 -0400
commit0302e28dee643932ee7b3c112ebccdbb9f8ec32c (patch)
tree405d4cb3f772ef069ed7f291adc4b74a4e73346e /security/keys/internal.h
parent89c9fea3c8034cdb2fd745f551cde0b507fd6893 (diff)
parent8979b02aaf1d6de8d52cc143aa4da961ed32e5a2 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "Highlights: IMA: - provide ">" and "<" operators for fowner/uid/euid rules KEYS: - add a system blacklist keyring - add KEYCTL_RESTRICT_KEYRING, exposes keyring link restriction functionality to userland via keyctl() LSM: - harden LSM API with __ro_after_init - add prlmit security hook, implement for SELinux - revive security_task_alloc hook TPM: - implement contextual TPM command 'spaces'" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (98 commits) tpm: Fix reference count to main device tpm_tis: convert to using locality callbacks tpm: fix handling of the TPM 2.0 event logs tpm_crb: remove a cruft constant keys: select CONFIG_CRYPTO when selecting DH / KDF apparmor: Make path_max parameter readonly apparmor: fix parameters so that the permission test is bypassed at boot apparmor: fix invalid reference to index variable of iterator line 836 apparmor: use SHASH_DESC_ON_STACK security/apparmor/lsm.c: set debug messages apparmor: fix boolreturn.cocci warnings Smack: Use GFP_KERNEL for smk_netlbl_mls(). smack: fix double free in smack_parse_opts_str() KEYS: add SP800-56A KDF support for DH KEYS: Keyring asymmetric key restrict method with chaining KEYS: Restrict asymmetric key linkage using a specific keychain KEYS: Add a lookup_restriction function for the asymmetric key type KEYS: Add KEYCTL_RESTRICT_KEYRING KEYS: Consistent ordering for __key_link_begin and restrict check KEYS: Add an optional lookup_restriction hook to key_type ...
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