diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/key.h | 13 | ||||
-rw-r--r-- | include/linux/security.h | 11 |
2 files changed, 17 insertions, 7 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index e81ebf910d0b..e693e729bc92 100644 --- a/include/linux/key.h +++ b/include/linux/key.h | |||
@@ -248,7 +248,14 @@ extern struct key *key_alloc(struct key_type *type, | |||
248 | const char *desc, | 248 | const char *desc, |
249 | uid_t uid, gid_t gid, | 249 | uid_t uid, gid_t gid, |
250 | struct task_struct *ctx, | 250 | struct task_struct *ctx, |
251 | key_perm_t perm, int not_in_quota); | 251 | key_perm_t perm, |
252 | unsigned long flags); | ||
253 | |||
254 | |||
255 | #define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */ | ||
256 | #define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */ | ||
257 | #define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ | ||
258 | |||
252 | extern int key_payload_reserve(struct key *key, size_t datalen); | 259 | extern int key_payload_reserve(struct key *key, size_t datalen); |
253 | extern int key_instantiate_and_link(struct key *key, | 260 | extern int key_instantiate_and_link(struct key *key, |
254 | const void *data, | 261 | const void *data, |
@@ -285,7 +292,7 @@ extern key_ref_t key_create_or_update(key_ref_t keyring, | |||
285 | const char *description, | 292 | const char *description, |
286 | const void *payload, | 293 | const void *payload, |
287 | size_t plen, | 294 | size_t plen, |
288 | int not_in_quota); | 295 | unsigned long flags); |
289 | 296 | ||
290 | extern int key_update(key_ref_t key, | 297 | extern int key_update(key_ref_t key, |
291 | const void *payload, | 298 | const void *payload, |
@@ -299,7 +306,7 @@ extern int key_unlink(struct key *keyring, | |||
299 | 306 | ||
300 | extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, | 307 | extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, |
301 | struct task_struct *ctx, | 308 | struct task_struct *ctx, |
302 | int not_in_quota, | 309 | unsigned long flags, |
303 | struct key *dest); | 310 | struct key *dest); |
304 | 311 | ||
305 | extern int keyring_clear(struct key *keyring); | 312 | extern int keyring_clear(struct key *keyring); |
diff --git a/include/linux/security.h b/include/linux/security.h index d2c17bd91a29..51805806f974 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -862,6 +862,7 @@ struct swap_info_struct; | |||
862 | * Permit allocation of a key and assign security data. Note that key does | 862 | * Permit allocation of a key and assign security data. Note that key does |
863 | * not have a serial number assigned at this point. | 863 | * not have a serial number assigned at this point. |
864 | * @key points to the key. | 864 | * @key points to the key. |
865 | * @flags is the allocation flags | ||
865 | * Return 0 if permission is granted, -ve error otherwise. | 866 | * Return 0 if permission is granted, -ve error otherwise. |
866 | * @key_free: | 867 | * @key_free: |
867 | * Notification of destruction; free security data. | 868 | * Notification of destruction; free security data. |
@@ -1324,7 +1325,7 @@ struct security_operations { | |||
1324 | 1325 | ||
1325 | /* key management security hooks */ | 1326 | /* key management security hooks */ |
1326 | #ifdef CONFIG_KEYS | 1327 | #ifdef CONFIG_KEYS |
1327 | int (*key_alloc)(struct key *key, struct task_struct *tsk); | 1328 | int (*key_alloc)(struct key *key, struct task_struct *tsk, unsigned long flags); |
1328 | void (*key_free)(struct key *key); | 1329 | void (*key_free)(struct key *key); |
1329 | int (*key_permission)(key_ref_t key_ref, | 1330 | int (*key_permission)(key_ref_t key_ref, |
1330 | struct task_struct *context, | 1331 | struct task_struct *context, |
@@ -3040,9 +3041,10 @@ static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid | |||
3040 | #ifdef CONFIG_KEYS | 3041 | #ifdef CONFIG_KEYS |
3041 | #ifdef CONFIG_SECURITY | 3042 | #ifdef CONFIG_SECURITY |
3042 | static inline int security_key_alloc(struct key *key, | 3043 | static inline int security_key_alloc(struct key *key, |
3043 | struct task_struct *tsk) | 3044 | struct task_struct *tsk, |
3045 | unsigned long flags) | ||
3044 | { | 3046 | { |
3045 | return security_ops->key_alloc(key, tsk); | 3047 | return security_ops->key_alloc(key, tsk, flags); |
3046 | } | 3048 | } |
3047 | 3049 | ||
3048 | static inline void security_key_free(struct key *key) | 3050 | static inline void security_key_free(struct key *key) |
@@ -3060,7 +3062,8 @@ static inline int security_key_permission(key_ref_t key_ref, | |||
3060 | #else | 3062 | #else |
3061 | 3063 | ||
3062 | static inline int security_key_alloc(struct key *key, | 3064 | static inline int security_key_alloc(struct key *key, |
3063 | struct task_struct *tsk) | 3065 | struct task_struct *tsk, |
3066 | unsigned long flags) | ||
3064 | { | 3067 | { |
3065 | return 0; | 3068 | return 0; |
3066 | } | 3069 | } |