/security/keys/ |
D | key.c | 39 void __key_check(const struct key *key) in __key_check() argument 42 key, key->magic, KEY_DEBUG_MAGIC); in __key_check() 134 static inline void key_alloc_serial(struct key *key) in key_alloc_serial() argument 137 struct key *xkey; in key_alloc_serial() 142 get_random_bytes(&key->serial, sizeof(key->serial)); in key_alloc_serial() 144 key->serial >>= 1; /* negative numbers are not permitted */ in key_alloc_serial() 145 } while (key->serial < 3); in key_alloc_serial() 155 xkey = rb_entry(parent, struct key, serial_node); in key_alloc_serial() 157 if (key->serial < xkey->serial) in key_alloc_serial() 159 else if (key->serial > xkey->serial) in key_alloc_serial() [all …]
|
D | request_key.c | 22 static struct key *check_cached_key(struct keyring_search_context *ctx) in check_cached_key() 25 struct key *key = current->cached_requested_key; in check_cached_key() local 27 if (key && in check_cached_key() 28 ctx->match_data.cmp(key, &ctx->match_data) && in check_cached_key() 29 !(key->flags & ((1 << KEY_FLAG_INVALIDATED) | in check_cached_key() 31 return key_get(key); in check_cached_key() 36 static void cache_requested_key(struct key *key) in cache_requested_key() argument 44 t->cached_requested_key = key_get(key); in cache_requested_key() 59 void complete_request_key(struct key *authkey, int error) in complete_request_key() 62 struct key *key = rka->target_key; in complete_request_key() local [all …]
|
D | gc.c | 72 void key_set_expiry(struct key *key, time64_t expiry) in key_set_expiry() argument 74 key->expiry = expiry; in key_set_expiry() 76 if (!(key->type->flags & KEY_TYPE_INSTANT_REAP)) in key_set_expiry() 138 struct key *key = in key_gc_unused_keys() local 139 list_entry(keys->next, struct key, graveyard_link); in key_gc_unused_keys() 140 short state = key->state; in key_gc_unused_keys() 142 list_del(&key->graveyard_link); in key_gc_unused_keys() 144 kdebug("- %u", key->serial); in key_gc_unused_keys() 145 key_check(key); in key_gc_unused_keys() 148 remove_watch_list(key->watchers, key->serial); in key_gc_unused_keys() [all …]
|
D | keyring.c | 40 static inline struct key *keyring_ptr_to_key(const struct assoc_array_ptr *x) in keyring_ptr_to_key() 43 return (struct key *)((unsigned long)object & ~KEYRING_PTR_SUBTYPE); in keyring_ptr_to_key() 45 static inline void *keyring_key_to_ptr(struct key *key) in keyring_key_to_ptr() argument 47 if (key->type == &key_type_keyring) in keyring_key_to_ptr() 48 return (void *)((unsigned long)key | KEYRING_PTR_SUBTYPE); in keyring_key_to_ptr() 49 return key; in keyring_key_to_ptr() 76 static int keyring_instantiate(struct key *keyring, 78 static void keyring_revoke(struct key *keyring); 79 static void keyring_destroy(struct key *keyring); 80 static void keyring_describe(const struct key *keyring, struct seq_file *m); [all …]
|
D | internal.h | 95 extern int __key_link_lock(struct key *keyring, 97 extern int __key_move_lock(struct key *l_keyring, struct key *u_keyring, 99 extern int __key_link_begin(struct key *keyring, 102 extern int __key_link_check_live_key(struct key *keyring, struct key *key); 103 extern void __key_link(struct key *keyring, struct key *key, 105 extern void __key_link_end(struct key *keyring, 112 extern struct key *keyring_search_instkey(struct key *keyring, 115 extern int iterate_over_keyring(const struct key *keyring, 116 int (*func)(const struct key *key, void *data), 141 extern bool key_default_cmp(const struct key *key, [all …]
|
D | proc.c | 70 struct key *key = rb_entry(n, struct key, serial_node); in key_serial_next() local 71 if (kuid_has_mapping(user_ns, key->user->uid)) in key_serial_next() 78 static struct key *find_ge_key(struct seq_file *p, key_serial_t id) in find_ge_key() 82 struct key *minkey = NULL; in find_ge_key() 85 struct key *key = rb_entry(n, struct key, serial_node); in find_ge_key() local 86 if (id < key->serial) { in find_ge_key() 87 if (!minkey || minkey->serial > key->serial) in find_ge_key() 88 minkey = key; in find_ge_key() 90 } else if (id > key->serial) { in find_ge_key() 93 minkey = key; in find_ge_key() [all …]
|
D | request_key_auth.c | 20 static int request_key_auth_instantiate(struct key *, 22 static void request_key_auth_describe(const struct key *, struct seq_file *); 23 static void request_key_auth_revoke(struct key *); 24 static void request_key_auth_destroy(struct key *); 25 static long request_key_auth_read(const struct key *, char *, size_t); 54 static int request_key_auth_instantiate(struct key *key, in request_key_auth_instantiate() argument 57 rcu_assign_keypointer(key, (struct request_key_auth *)prep->data); in request_key_auth_instantiate() 64 static void request_key_auth_describe(const struct key *key, in request_key_auth_describe() argument 67 struct request_key_auth *rka = dereference_key_rcu(key); in request_key_auth_describe() 73 seq_puts(m, key->description); in request_key_auth_describe() [all …]
|
D | user_defined.c | 101 int user_update(struct key *key, struct key_preparsed_payload *prep) in user_update() argument 107 ret = key_payload_reserve(key, prep->datalen); in user_update() 112 key->expiry = prep->expiry; in user_update() 113 if (key_is_positive(key)) in user_update() 114 zap = dereference_key_locked(key); in user_update() 115 rcu_assign_keypointer(key, prep->payload.data[0]); in user_update() 128 void user_revoke(struct key *key) in user_revoke() argument 130 struct user_key_payload *upayload = user_key_payload_locked(key); in user_revoke() 133 key_payload_reserve(key, 0); in user_revoke() 136 rcu_assign_keypointer(key, NULL); in user_revoke() [all …]
|
D | permission.c | 29 struct key *key; in key_task_permission() local 51 key = key_ref_to_ptr(key_ref); in key_task_permission() 54 if (uid_eq(key->uid, cred->fsuid)) { in key_task_permission() 55 kperm = key->perm >> 16; in key_task_permission() 61 if (gid_valid(key->gid) && key->perm & KEY_GRP_ALL) { in key_task_permission() 62 if (gid_eq(key->gid, cred->fsgid)) { in key_task_permission() 63 kperm = key->perm >> 8; in key_task_permission() 67 ret = groups_search(cred->group_info, key->gid); in key_task_permission() 69 kperm = key->perm >> 8; in key_task_permission() 75 kperm = key->perm; in key_task_permission() [all …]
|
D | keyctl.c | 173 struct key *key; in SYSCALL_DEFINE4() local 222 key = request_key_and_link(ktype, description, NULL, callout_info, in SYSCALL_DEFINE4() 225 if (IS_ERR(key)) { in SYSCALL_DEFINE4() 226 ret = PTR_ERR(key); in SYSCALL_DEFINE4() 231 ret = wait_for_key_construction(key, 1); in SYSCALL_DEFINE4() 235 ret = key->serial; in SYSCALL_DEFINE4() 238 key_put(key); in SYSCALL_DEFINE4() 382 struct key *key; in keyctl_revoke_key() local 397 key = key_ref_to_ptr(key_ref); in keyctl_revoke_key() 399 if (test_bit(KEY_FLAG_KEEP, &key->flags)) in keyctl_revoke_key() [all …]
|
D | big_key.c | 165 void big_key_revoke(struct key *key) in big_key_revoke() argument 167 struct big_key_payload *payload = to_big_key_payload(key->payload); in big_key_revoke() 170 key_payload_reserve(key, 0); in big_key_revoke() 171 if (key_is_positive(key) && payload->length > BIG_KEY_FILE_THRESHOLD) in big_key_revoke() 178 void big_key_destroy(struct key *key) in big_key_destroy() argument 180 struct big_key_payload *payload = to_big_key_payload(key->payload); in big_key_destroy() 194 int big_key_update(struct key *key, struct key_preparsed_payload *prep) in big_key_update() argument 198 ret = key_payload_reserve(key, prep->datalen); in big_key_update() 202 if (key_is_positive(key)) in big_key_update() 203 big_key_destroy(key); in big_key_update() [all …]
|
D | process_keys.c | 38 static struct key *get_user_register(struct user_namespace *user_ns) in get_user_register() 40 struct key *reg_keyring = READ_ONCE(user_ns->user_keyring_register); in get_user_register() 74 int look_up_user_keyrings(struct key **_user_keyring, in look_up_user_keyrings() 75 struct key **_user_session_keyring) in look_up_user_keyrings() 79 struct key *reg_keyring, *uid_keyring, *session_keyring; in look_up_user_keyrings() 185 struct key *get_user_session_keyring_rcu(const struct cred *cred) in get_user_session_keyring_rcu() 187 struct key *reg_keyring = READ_ONCE(cred->user_ns->user_keyring_register); in get_user_session_keyring_rcu() 223 struct key *keyring; in install_thread_keyring_to_cred() 270 struct key *keyring; in install_process_keyring_to_cred() 317 int install_session_keyring_to_cred(struct cred *cred, struct key *keyring) in install_session_keyring_to_cred() [all …]
|
D | dh.c | 20 struct key *key; in dh_data_from_key() local 31 key = key_ref_to_ptr(key_ref); in dh_data_from_key() 34 if (key->type == &key_type_user) { in dh_data_from_key() 35 down_read(&key->sem); in dh_data_from_key() 36 status = key_validate(key); in dh_data_from_key() 41 payload = user_key_payload_locked(key); in dh_data_from_key() 52 up_read(&key->sem); in dh_data_from_key() 55 key_put(key); in dh_data_from_key() 62 kfree_sensitive(dh->key); in dh_free_data() 209 dlen = dh_data_from_key(pcopy.private, &dh_inputs.key); in __keyctl_dh_compute()
|
D | keyctl_pkey.c | 20 key_put(params->key); in keyctl_pkey_params_free() 101 params->key = key_ref_to_ptr(key_ref); in keyctl_pkey_params_get() 103 if (!params->key->type->asym_query) in keyctl_pkey_params_get() 132 ret = params->key->type->asym_query(params, &info); in keyctl_pkey_params_get_2() 181 ret = params.key->type->asym_query(¶ms, &res); in keyctl_pkey_query() 227 if (!params.key->type->asym_eds_op) in keyctl_pkey_e_d_s() 255 ret = params.key->type->asym_eds_op(¶ms, in, out); in keyctl_pkey_e_d_s() 303 if (!params.key->type->asym_verify_signature) in keyctl_pkey_verify() 319 ret = params.key->type->asym_verify_signature(¶ms, in, in2); in keyctl_pkey_verify()
|
/security/selinux/ss/ |
D | avtab.c | 71 const struct avtab_key *key, const struct avtab_datum *datum) in avtab_insert_node() argument 78 newnode->key = *key; in avtab_insert_node() 80 if (key->specified & AVTAB_XPERMS) { in avtab_insert_node() 106 static int avtab_insert(struct avtab *h, const struct avtab_key *key, in avtab_insert() argument 111 u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD); in avtab_insert() 116 hvalue = avtab_hash(key, h->mask); in avtab_insert() 120 if (key->source_type == cur->key.source_type && in avtab_insert() 121 key->target_type == cur->key.target_type && in avtab_insert() 122 key->target_class == cur->key.target_class && in avtab_insert() 123 (specified & cur->key.specified)) { in avtab_insert() [all …]
|
D | hashtab.h | 21 u32 (*hash)(const void *key); /* hash function */ 27 void *key; member 51 void *key, void *datum); 61 static inline int hashtab_insert(struct hashtab *h, void *key, void *datum, in hashtab_insert() argument 72 hvalue = key_params.hash(key) & (h->size - 1); in hashtab_insert() 76 int cmp = key_params.cmp(key, cur->key); in hashtab_insert() 87 key, datum); in hashtab_insert() 96 static inline void *hashtab_search(struct hashtab *h, const void *key, in hashtab_search() argument 105 hvalue = key_params.hash(key) & (h->size - 1); in hashtab_search() 108 int cmp = key_params.cmp(key, cur->key); in hashtab_search()
|
D | conditional.c | 107 avnode->key.specified &= ~AVTAB_ENABLED; in evaluate_cond_node() 109 avnode->key.specified |= AVTAB_ENABLED; in evaluate_cond_node() 116 avnode->key.specified &= ~AVTAB_ENABLED; in evaluate_cond_node() 118 avnode->key.specified |= AVTAB_ENABLED; in evaluate_cond_node() 177 int cond_destroy_bool(void *key, void *datum, void *p) in cond_destroy_bool() argument 179 kfree(key); in cond_destroy_bool() 184 int cond_index_bool(void *key, void *datum, void *datap) in cond_index_bool() argument 195 p->sym_val_to_name[SYM_BOOLS][booldatum->value - 1] = key; in cond_index_bool() 210 char *key = NULL; in cond_read_bool() local 236 key = kmalloc(len + 1, GFP_KERNEL); in cond_read_bool() [all …]
|
D | policydb.c | 180 static int perm_destroy(void *key, void *datum, void *p) in perm_destroy() argument 182 kfree(key); in perm_destroy() 187 static int common_destroy(void *key, void *datum, void *p) in common_destroy() argument 191 kfree(key); in common_destroy() 214 static int cls_destroy(void *key, void *datum, void *p) in cls_destroy() argument 220 kfree(key); in cls_destroy() 256 static int role_destroy(void *key, void *datum, void *p) in role_destroy() argument 260 kfree(key); in role_destroy() 270 static int type_destroy(void *key, void *datum, void *p) in type_destroy() argument 272 kfree(key); in type_destroy() [all …]
|
D | conditional.h | 68 int cond_destroy_bool(void *key, void *datum, void *p); 70 int cond_index_bool(void *key, void *datum, void *datap); 74 int cond_write_bool(void *key, void *datum, void *ptr); 77 void cond_compute_av(struct avtab *ctab, struct avtab_key *key, 79 void cond_compute_xperms(struct avtab *ctab, struct avtab_key *key,
|
/security/integrity/ |
D | digsig_asymmetric.c | 22 static struct key *request_asymmetric_key(struct key *keyring, uint32_t keyid) in request_asymmetric_key() 24 struct key *key; in request_asymmetric_key() local 31 key = get_ima_blacklist_keyring(); in request_asymmetric_key() 32 if (key) { in request_asymmetric_key() 35 kref = keyring_search(make_key_ref(key, 1), in request_asymmetric_key() 50 key = ERR_CAST(kref); in request_asymmetric_key() 52 key = key_ref_to_ptr(kref); in request_asymmetric_key() 54 key = request_key(&key_type_asymmetric, name, NULL); in request_asymmetric_key() 57 if (IS_ERR(key)) { in request_asymmetric_key() 61 PTR_ERR(key)); in request_asymmetric_key() [all …]
|
D | digsig.c | 22 static struct key *keyring[INTEGRITY_KEYRING_MAX]; 42 static struct key *integrity_keyring_from_id(const unsigned int id) in integrity_keyring_from_id() 64 struct key *keyring; in integrity_digsig_verify() 89 struct key *keyring; in integrity_modsig_verify() 167 key_ref_t key; in integrity_add_key() local 173 key = key_create_or_update(make_key_ref(keyring[id], 1), "asymmetric", in integrity_add_key() 176 if (IS_ERR(key)) { in integrity_add_key() 177 rc = PTR_ERR(key); in integrity_add_key() 181 key_ref_to_ptr(key)->description); in integrity_add_key() 182 key_ref_put(key); in integrity_add_key()
|
/security/keys/trusted-keys/ |
D | trusted_core.c | 120 static struct trusted_key_payload *trusted_payload_alloc(struct key *key) in trusted_payload_alloc() argument 125 ret = key_payload_reserve(key, sizeof(*p)); in trusted_payload_alloc() 146 static int trusted_instantiate(struct key *key, in trusted_instantiate() argument 165 payload = trusted_payload_alloc(key); in trusted_instantiate() 188 ret = static_call(trusted_key_get_random)(payload->key, in trusted_instantiate() 209 rcu_assign_keypointer(key, payload); in trusted_instantiate() 226 static int trusted_update(struct key *key, struct key_preparsed_payload *prep) in trusted_update() argument 234 if (key_is_negative(key)) in trusted_update() 236 p = key->payload.data[0]; in trusted_update() 246 new_p = trusted_payload_alloc(key); in trusted_update() [all …]
|
D | trusted_tee.c | 73 reg_shm = tee_shm_register_kernel_buf(pvt_data.ctx, p->key, in trusted_tee_seal() 74 sizeof(p->key) + sizeof(p->blob)); in trusted_tee_seal() 91 param[1].u.memref.shm_offs = sizeof(p->key); in trusted_tee_seal() 120 reg_shm = tee_shm_register_kernel_buf(pvt_data.ctx, p->key, in trusted_tee_unseal() 121 sizeof(p->key) + sizeof(p->blob)); in trusted_tee_unseal() 134 param[0].u.memref.shm_offs = sizeof(p->key); in trusted_tee_unseal() 137 param[1].u.memref.size = sizeof(p->key); in trusted_tee_unseal() 157 static int trusted_tee_get_random(unsigned char *key, size_t key_len) in trusted_tee_get_random() argument 167 reg_shm = tee_shm_register_kernel_buf(pvt_data.ctx, key, key_len); in trusted_tee_get_random()
|
/security/keys/encrypted-keys/ |
D | encrypted.c | 307 static struct key *request_user_key(const char *master_desc, const u8 **master_key, in request_user_key() 311 struct key *ukey; in request_user_key() 332 static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen, in calc_hmac() argument 345 err = crypto_shash_setkey(tfm, key, keylen); in calc_hmac() 383 static struct skcipher_request *init_skcipher_req(const u8 *key, in init_skcipher_req() argument 397 ret = crypto_skcipher_setkey(tfm, key, key_len); in init_skcipher_req() 416 static struct key *request_master_key(struct encrypted_key_payload *epayload, in request_master_key() 419 struct key *mkey = ERR_PTR(-EINVAL); in request_master_key() 601 static struct encrypted_key_payload *encrypted_key_alloc(struct key *key, in encrypted_key_alloc() argument 665 ret = key_payload_reserve(key, payload_datalen + datablob_len in encrypted_key_alloc() [all …]
|
/security/integrity/ima/ |
D | ima_asymmetric_keys.c | 29 void ima_post_key_create_or_update(struct key *keyring, struct key *key, in ima_post_key_create_or_update() argument 36 if (key->type != &key_type_asymmetric) in ima_post_key_create_or_update()
|