• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/contrib/openzfs/module/zfs/

Lines Matching refs:wkey

49  * The wrapping key (wkey) tree stores the user's keys that are fed into the
51 * parent's wkey by default, so these structures are refcounted. The wrapping
83 dsl_wrapping_key_hold(dsl_wrapping_key_t *wkey, void *tag)
85 (void) zfs_refcount_add(&wkey->wk_refcnt, tag);
89 dsl_wrapping_key_rele(dsl_wrapping_key_t *wkey, void *tag)
91 (void) zfs_refcount_remove(&wkey->wk_refcnt, tag);
95 dsl_wrapping_key_free(dsl_wrapping_key_t *wkey)
97 ASSERT0(zfs_refcount_count(&wkey->wk_refcnt));
99 if (wkey->wk_key.ck_data) {
100 bzero(wkey->wk_key.ck_data,
101 CRYPTO_BITS2BYTES(wkey->wk_key.ck_length));
102 kmem_free(wkey->wk_key.ck_data,
103 CRYPTO_BITS2BYTES(wkey->wk_key.ck_length));
106 zfs_refcount_destroy(&wkey->wk_refcnt);
107 kmem_free(wkey, sizeof (dsl_wrapping_key_t));
114 dsl_wrapping_key_t *wkey;
117 wkey = kmem_alloc(sizeof (dsl_wrapping_key_t), KM_SLEEP);
120 wkey->wk_key.ck_data = kmem_alloc(WRAPPING_KEY_LEN, KM_SLEEP);
122 wkey->wk_key.ck_format = CRYPTO_KEY_RAW;
123 wkey->wk_key.ck_length = CRYPTO_BYTES2BITS(WRAPPING_KEY_LEN);
124 bcopy(wkeydata, wkey->wk_key.ck_data, WRAPPING_KEY_LEN);
127 zfs_refcount_create(&wkey->wk_refcnt);
128 wkey->wk_keyformat = keyformat;
129 wkey->wk_salt = salt;
130 wkey->wk_iters = iters;
132 *wkey_out = wkey;
144 dsl_wrapping_key_t *wkey = NULL;
219 iters, &wkey);
220 dcp->cp_wkey = wkey;
315 dsl_wrapping_key_t *wkey;
321 while ((wkey = avl_destroy_nodes(&sk->sk_wkeys, &cookie)) != NULL)
322 dsl_wrapping_key_free(wkey);
406 dsl_wrapping_key_t *wkey;
420 /* lookup the wkey in the avl tree */
421 ret = spa_keystore_wkey_hold_ddobj_impl(spa, rddobj, tag, &wkey);
425 /* unlock the wkey tree if we locked it */
429 *wkey_out = wkey;
525 dsl_crypto_key_open(objset_t *mos, dsl_wrapping_key_t *wkey,
576 ret = zio_crypt_key_unwrap(&wkey->wk_key, crypt, version, guid,
585 dsl_wrapping_key_hold(wkey, dck);
586 dck->dck_wkey = wkey;
641 dsl_wrapping_key_t *wkey = NULL;
654 ret = spa_keystore_wkey_hold_dd(spa, dd, FTAG, &wkey);
661 ret = dsl_crypto_key_open(spa->spa_meta_objset, wkey, dckobj,
664 dsl_wrapping_key_rele(wkey, FTAG);
686 dsl_wrapping_key_rele(wkey, FTAG);
706 spa_keystore_load_wkey_impl(spa_t *spa, dsl_wrapping_key_t *wkey)
715 found_wkey = avl_find(&spa->spa_keystore.sk_wkeys, wkey, &where);
720 avl_insert(&spa->spa_keystore.sk_wkeys, wkey, where);
738 dsl_wrapping_key_t *wkey = dcp->cp_wkey;
775 /* initialize the wkey's ddobj */
776 wkey->wk_ddobj = dd->dd_object;
778 /* verify that the wkey is correct by opening its dsl key */
779 ret = dsl_crypto_key_open(dp->dp_meta_objset, wkey,
784 /* initialize the wkey encryption parameters from the DSL Crypto Key */
807 wkey->wk_keyformat = keyformat;
808 wkey->wk_salt = salt;
809 wkey->wk_iters = iters;
812 * At this point we have verified the wkey and confirmed that it can
820 ret = spa_keystore_load_wkey_impl(dp->dp_spa, wkey);
894 * remaining references on the wkey.
917 /* unload the wkey */
1129 dsl_wrapping_key_t *wkey = NULL;
1132 &wkey);
1136 dsl_wrapping_key_rele(wkey, FTAG);
1196 dsl_wrapping_key_t *wkey = dck->dck_wkey;
1211 key->zk_crypt, wkey->wk_ddobj, key->zk_guid, iv, mac, keydata,
1212 hmac_keydata, wkey->wk_keyformat, wkey->wk_salt, wkey->wk_iters,
1334 /* we are not inheritting our parent's wkey so we need one ourselves */
1378 /* make sure the dd's wkey is loaded */
1403 uint64_t new_rddobj, dsl_wrapping_key_t *wkey, boolean_t skip,
1444 if (wkey == NULL) {
1452 dsl_wrapping_key_hold(wkey, dck);
1454 dck->dck_wkey = wkey;
1469 za->za_first_integer, new_rddobj, wkey, B_FALSE, tx);
1488 clone->ds_dir->dd_object, new_rddobj, wkey, B_TRUE, tx);
1508 dsl_wrapping_key_t *wkey = NULL, *found_wkey;
1520 * We are changing to a new wkey. Set additional properties
1526 wkey = dcp->cp_wkey;
1527 wkey->wk_ddobj = ds->ds_dir->dd_object;
1543 * We are inheritting the parent's wkey. Unset any local
1544 * keylocation and grab a reference to the wkey.
1548 ds->ds_dir->dd_parent, FTAG, &wkey));
1560 if (wkey == NULL) {
1569 new_rddobj, wkey, B_FALSE, tx);
1572 * All references to the old wkey should be released now (if it
1584 avl_find(&spa->spa_keystore.sk_wkeys, wkey, &where);
1585 avl_insert(&spa->spa_keystore.sk_wkeys, wkey, where);
1586 } else if (wkey != NULL) {
1587 dsl_wrapping_key_rele(wkey, FTAG);
1871 dsl_wrapping_key_t *wkey;
1904 wkey = dcp->cp_wkey;
1919 if (wkey == NULL) {
1921 dd->dd_parent, FTAG, &wkey));
1923 wkey->wk_ddobj = dd->dd_object;
1926 ASSERT3P(wkey, !=, NULL);
1929 dd->dd_crypto_obj = dsl_crypto_key_create_sync(crypt, wkey, tx);
1942 dsl_wrapping_key_rele(wkey, FTAG);
1944 VERIFY0(spa_keystore_load_wkey_impl(dp->dp_spa, wkey));
2532 dsl_crypto_key_create_sync(uint64_t crypt, dsl_wrapping_key_t *wkey,
2548 dck.dck_wkey = wkey;