Lines Matching defs:key
26 ut_keyring_add_key(struct spdk_key *key, void *ctx)
29 struct ut_key *utkey = spdk_key_get_ctx(key);
37 /* Use spdk_json_val's start/len to pass a buffer with the key */
47 ut_keyring_remove_key(struct spdk_key *key)
49 struct ut_key *utkey = spdk_key_get_ctx(key);
56 ut_keyring_get_key(struct spdk_key *key, void *buf, int len)
58 struct ut_key *utkey = spdk_key_get_ctx(key);
85 struct spdk_key *key;
91 /* Add a key */
100 /* Get a reference to that key */
101 key = spdk_keyring_get_key("key0");
102 CU_ASSERT_PTR_NOT_NULL(key);
105 rc = spdk_key_get_key(key, rcvbuf, UT_KEY_SIZE);
113 /* Now that the key has been remove spdk_key_get_key() should result in an -ENOKEY error */
114 rc = spdk_key_get_key(key, rcvbuf, UT_KEY_SIZE);
118 spdk_keyring_put_key(key);
123 key = spdk_keyring_get_key(":key0");
124 CU_ASSERT_PTR_NOT_NULL(key);
127 rc = spdk_key_get_key(key, rcvbuf, UT_KEY_SIZE);
131 spdk_keyring_put_key(key);
133 /* Remove the key without explicitly specifying global keyring */
138 /* Try to create a key with the same name twice */
153 /* Try to remove a key owned by a different module */
164 /* Remove an already removed key */
185 struct spdk_key *key, *tmp;
197 /* Get multiple references to the same key */
198 key = spdk_keyring_get_key("key0");
199 CU_ASSERT_PTR_NOT_NULL(key);
203 CU_ASSERT_PTR_EQUAL(key, tmp);
206 /* Remove the key and verify (relying on the address sanitizer to catch any use-after-free
210 CU_ASSERT_EQUAL(strcmp(spdk_key_get_name(key), "key0"), 0);
216 spdk_keyring_put_key(key);
217 CU_ASSERT_EQUAL(strcmp(spdk_key_get_name(key), "key0"), 0);
220 /* Release the last reference - this should also free the key */
221 spdk_keyring_put_key(key);