Lines Matching refs:key

27 static void *key_data(struct key *key)  in key_data()  argument
29 struct encrypted_key_payload *epayload = dereference_key_locked(key); in key_data()
31 lockdep_assert_held_read(&key->sem); in key_data()
36 static void nvdimm_put_key(struct key *key) in nvdimm_put_key() argument
38 if (!key) in nvdimm_put_key()
41 up_read(&key->sem); in nvdimm_put_key()
42 key_put(key); in nvdimm_put_key()
50 static struct key *nvdimm_request_key(struct nvdimm *nvdimm) in nvdimm_request_key()
52 struct key *key = NULL; in nvdimm_request_key() local
58 key = request_key(&key_type_encrypted, desc, ""); in nvdimm_request_key()
59 if (IS_ERR(key)) { in nvdimm_request_key()
60 if (PTR_ERR(key) == -ENOKEY) in nvdimm_request_key()
64 key = NULL; in nvdimm_request_key()
68 down_read(&key->sem); in nvdimm_request_key()
69 epayload = dereference_key_locked(key); in nvdimm_request_key()
71 up_read(&key->sem); in nvdimm_request_key()
72 key_put(key); in nvdimm_request_key()
73 key = NULL; in nvdimm_request_key()
77 return key; in nvdimm_request_key()
81 struct key **key) in nvdimm_get_key_payload() argument
83 *key = nvdimm_request_key(nvdimm); in nvdimm_get_key_payload()
84 if (!*key) in nvdimm_get_key_payload()
87 return key_data(*key); in nvdimm_get_key_payload()
90 static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm, in nvdimm_lookup_user_key()
94 struct key *key; in nvdimm_lookup_user_key() local
102 key = key_ref_to_ptr(keyref); in nvdimm_lookup_user_key()
103 if (key->type != &key_type_encrypted) { in nvdimm_lookup_user_key()
104 key_put(key); in nvdimm_lookup_user_key()
108 dev_dbg(dev, "%s: key found: %#x\n", __func__, key_serial(key)); in nvdimm_lookup_user_key()
110 down_read_nested(&key->sem, subclass); in nvdimm_lookup_user_key()
111 epayload = dereference_key_locked(key); in nvdimm_lookup_user_key()
113 up_read(&key->sem); in nvdimm_lookup_user_key()
114 key_put(key); in nvdimm_lookup_user_key()
115 key = NULL; in nvdimm_lookup_user_key()
117 return key; in nvdimm_lookup_user_key()
121 key_serial_t id, int subclass, struct key **key) in nvdimm_get_user_key_payload() argument
123 *key = NULL; in nvdimm_get_user_key_payload()
131 *key = nvdimm_lookup_user_key(nvdimm, id, subclass); in nvdimm_get_user_key_payload()
132 if (!*key) in nvdimm_get_user_key_payload()
135 return key_data(*key); in nvdimm_get_user_key_payload()
141 struct key *key; in nvdimm_key_revalidate() local
148 data = nvdimm_get_key_payload(nvdimm, &key); in nvdimm_key_revalidate()
156 nvdimm_put_key(key); in nvdimm_key_revalidate()
160 nvdimm_put_key(key); in nvdimm_key_revalidate()
169 struct key *key; in __nvdimm_security_unlock() local
202 data = nvdimm_get_key_payload(nvdimm, &key); in __nvdimm_security_unlock()
205 dev_dbg(dev, "key: %d unlock: %s\n", key_serial(key), in __nvdimm_security_unlock()
208 nvdimm_put_key(key); in __nvdimm_security_unlock()
246 struct key *key; in security_disable() local
262 NVDIMM_BASE_KEY, &key); in security_disable()
267 dev_dbg(dev, "key: %d disable: %s\n", key_serial(key), in security_disable()
270 nvdimm_put_key(key); in security_disable()
281 struct key *key, *newkey; in security_update() local
297 NVDIMM_BASE_KEY, &key); in security_update()
304 nvdimm_put_key(key); in security_update()
310 key_serial(key), key_serial(newkey), in security_update()
315 nvdimm_put_key(key); in security_update()
330 struct key *key = NULL; in security_erase() local
353 NVDIMM_BASE_KEY, &key); in security_erase()
358 dev_dbg(dev, "key: %d erase%s: %s\n", key_serial(key), in security_erase()
362 nvdimm_put_key(key); in security_erase()
371 struct key *key = NULL; in security_overwrite() local
392 NVDIMM_BASE_KEY, &key); in security_overwrite()
397 dev_dbg(dev, "key: %d overwrite submission: %s\n", key_serial(key), in security_overwrite()
400 nvdimm_put_key(key); in security_overwrite()
506 unsigned int key, newkey; in nvdimm_security_store() local
521 rc = kstrtouint(keystr, 0, &key); in nvdimm_security_store()
531 dev_dbg(dev, "disable %u\n", key); in nvdimm_security_store()
532 rc = security_disable(nvdimm, key); in nvdimm_security_store()
534 dev_dbg(dev, "%s %u %u\n", ops[i].name, key, newkey); in nvdimm_security_store()
535 rc = security_update(nvdimm, key, newkey, i == OP_UPDATE in nvdimm_security_store()
538 dev_dbg(dev, "%s %u\n", ops[i].name, key); in nvdimm_security_store()
543 rc = security_erase(nvdimm, key, i == OP_ERASE in nvdimm_security_store()
546 dev_dbg(dev, "overwrite %u\n", key); in nvdimm_security_store()
551 rc = security_overwrite(nvdimm, key); in nvdimm_security_store()