summaryrefslogtreecommitdiff
path: root/include/linux/key.h
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /include/linux/key.h
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'include/linux/key.h')
-rw-r--r--include/linux/key.h52
1 files changed, 15 insertions, 37 deletions
diff --git a/include/linux/key.h b/include/linux/key.h
index 80d6774..4dfde11 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -22,7 +22,6 @@
#include <linux/sysctl.h>
#include <linux/rwsem.h>
#include <linux/atomic.h>
-#include <linux/assoc_array.h>
#ifdef __KERNEL__
#include <linux/uidgid.h>
@@ -83,12 +82,6 @@ struct key_owner;
struct keyring_list;
struct keyring_name;
-struct keyring_index_key {
- struct key_type *type;
- const char *description;
- size_t desc_len;
-};
-
/*****************************************************************************/
/*
* key reference with possession attribute handling
@@ -106,7 +99,7 @@ struct keyring_index_key {
typedef struct __key_reference_with_attributes *key_ref_t;
static inline key_ref_t make_key_ref(const struct key *key,
- bool possession)
+ unsigned long possession)
{
return (key_ref_t) ((unsigned long) key | possession);
}
@@ -116,7 +109,7 @@ static inline struct key *key_ref_to_ptr(const key_ref_t key_ref)
return (struct key *) ((unsigned long) key_ref & ~1UL);
}
-static inline bool is_key_possessed(const key_ref_t key_ref)
+static inline unsigned long is_key_possessed(const key_ref_t key_ref)
{
return (unsigned long) key_ref & 1UL;
}
@@ -136,6 +129,7 @@ struct key {
struct list_head graveyard_link;
struct rb_node serial_node;
};
+ struct key_type *type; /* type of key */
struct rw_semaphore sem; /* change vs change sem */
struct key_user *user; /* owner of this key */
void *security; /* security data for this key */
@@ -168,21 +162,13 @@ struct key {
#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
-#define KEY_FLAG_TRUSTED 8 /* set if key is trusted */
-#define KEY_FLAG_TRUSTED_ONLY 9 /* set if keyring only accepts links to trusted keys */
- /* the key type and key description string
- * - the desc is used to match a key against search criteria
- * - it should be a printable string
+ /* the description string
+ * - this is used to match a key against search criteria
+ * - this should be a printable string
* - eg: for krb5 AFS, this might be "afs@REDHAT.COM"
*/
- union {
- struct keyring_index_key index_key;
- struct {
- struct key_type *type; /* type of key */
- char *description;
- };
- };
+ char *description;
/* type specific data
* - this is used by the keyring type to index the name
@@ -199,14 +185,11 @@ struct key {
* whatever
*/
union {
- union {
- unsigned long value;
- void __rcu *rcudata;
- void *data;
- void *data2[2];
- } payload;
- struct assoc_array keys;
- };
+ unsigned long value;
+ void __rcu *rcudata;
+ void *data;
+ struct keyring_list __rcu *subscriptions;
+ } payload;
};
extern struct key *key_alloc(struct key_type *type,
@@ -220,21 +203,16 @@ extern struct key *key_alloc(struct key_type *type,
#define KEY_ALLOC_IN_QUOTA 0x0000 /* add to quota, reject if would overrun */
#define KEY_ALLOC_QUOTA_OVERRUN 0x0001 /* add to quota, permit even if overrun */
#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
-#define KEY_ALLOC_TRUSTED 0x0004 /* Key should be flagged as trusted */
extern void key_revoke(struct key *key);
extern void key_invalidate(struct key *key);
extern void key_put(struct key *key);
-static inline struct key *__key_get(struct key *key)
-{
- atomic_inc(&key->usage);
- return key;
-}
-
static inline struct key *key_get(struct key *key)
{
- return key ? __key_get(key) : key;
+ if (key)
+ atomic_inc(&key->usage);
+ return key;
}
static inline void key_ref_put(key_ref_t key_ref)