Lines Matching full:dcp

142 	dsl_crypto_params_t *dcp = NULL;  in dsl_crypto_params_create_nvlist()  local
148 dcp = kmem_zalloc(sizeof (dsl_crypto_params_t), KM_SLEEP); in dsl_crypto_params_create_nvlist()
149 dcp->cp_cmd = cmd; in dsl_crypto_params_create_nvlist()
164 dcp->cp_crypt = crypt; in dsl_crypto_params_create_nvlist()
173 if (dcp->cp_cmd >= DCP_CMD_MAX) { in dsl_crypto_params_create_nvlist()
177 dcp->cp_cmd = cmd; in dsl_crypto_params_create_nvlist()
181 if (dcp->cp_crypt >= ZIO_CRYPT_FUNCTIONS) { in dsl_crypto_params_create_nvlist()
185 dcp->cp_crypt = crypt; in dsl_crypto_params_create_nvlist()
201 dcp->cp_keylocation = spa_strdup(keylocation); in dsl_crypto_params_create_nvlist()
211 if (dcp->cp_crypt == ZIO_CRYPT_ON) in dsl_crypto_params_create_nvlist()
212 dcp->cp_crypt = ZIO_CRYPT_ON_VALUE; in dsl_crypto_params_create_nvlist()
219 dcp->cp_wkey = wkey; in dsl_crypto_params_create_nvlist()
232 *dcp_out = dcp; in dsl_crypto_params_create_nvlist()
237 kmem_free(dcp, sizeof (dsl_crypto_params_t)); in dsl_crypto_params_create_nvlist()
243 dsl_crypto_params_free(dsl_crypto_params_t *dcp, boolean_t unload) in dsl_crypto_params_free() argument
245 if (dcp == NULL) in dsl_crypto_params_free()
248 if (dcp->cp_keylocation != NULL) in dsl_crypto_params_free()
249 spa_strfree(dcp->cp_keylocation); in dsl_crypto_params_free()
250 if (unload && dcp->cp_wkey != NULL) in dsl_crypto_params_free()
251 dsl_wrapping_key_free(dcp->cp_wkey); in dsl_crypto_params_free()
253 kmem_free(dcp, sizeof (dsl_crypto_params_t)); in dsl_crypto_params_free()
771 spa_keystore_load_wkey(const char *dsname, dsl_crypto_params_t *dcp, in spa_keystore_load_wkey() argument
777 dsl_wrapping_key_t *wkey = dcp->cp_wkey; in spa_keystore_load_wkey()
785 if (dcp->cp_wkey == NULL || in spa_keystore_load_wkey()
786 dcp->cp_cmd != DCP_CMD_NONE || in spa_keystore_load_wkey()
787 dcp->cp_crypt != ZIO_CRYPT_INHERIT || in spa_keystore_load_wkey()
788 dcp->cp_keylocation != NULL) in spa_keystore_load_wkey()
1267 dsl_crypto_params_t *dcp = skcka->skcka_cp; in spa_keystore_change_key_check() local
1277 if (dcp->cp_cmd != DCP_CMD_NEW_KEY && in spa_keystore_change_key_check()
1278 dcp->cp_cmd != DCP_CMD_INHERIT && in spa_keystore_change_key_check()
1279 dcp->cp_cmd != DCP_CMD_FORCE_NEW_KEY && in spa_keystore_change_key_check()
1280 dcp->cp_cmd != DCP_CMD_FORCE_INHERIT) { in spa_keystore_change_key_check()
1310 if (dcp->cp_cmd == DCP_CMD_INHERIT || in spa_keystore_change_key_check()
1311 dcp->cp_cmd == DCP_CMD_FORCE_INHERIT) { in spa_keystore_change_key_check()
1313 if (dcp->cp_crypt != ZIO_CRYPT_INHERIT || in spa_keystore_change_key_check()
1314 dcp->cp_keylocation != NULL || in spa_keystore_change_key_check()
1315 dcp->cp_wkey != NULL) { in spa_keystore_change_key_check()
1333 if (dcp->cp_cmd == DCP_CMD_INHERIT) { in spa_keystore_change_key_check()
1348 if (dcp->cp_cmd == DCP_CMD_FORCE_NEW_KEY) { in spa_keystore_change_key_check()
1350 if (dcp->cp_crypt != ZIO_CRYPT_INHERIT || in spa_keystore_change_key_check()
1351 dcp->cp_keylocation != NULL || in spa_keystore_change_key_check()
1352 dcp->cp_wkey != NULL) { in spa_keystore_change_key_check()
1368 if (dcp->cp_crypt != ZIO_CRYPT_INHERIT) { in spa_keystore_change_key_check()
1374 if (dcp->cp_wkey == NULL) { in spa_keystore_change_key_check()
1380 if (dcp->cp_wkey->wk_keyformat >= ZFS_KEYFORMAT_FORMATS || in spa_keystore_change_key_check()
1381 dcp->cp_wkey->wk_keyformat == ZFS_KEYFORMAT_NONE) { in spa_keystore_change_key_check()
1391 if (dd->dd_object != rddobj && dcp->cp_keylocation == NULL) { in spa_keystore_change_key_check()
1397 if (dcp->cp_keylocation != NULL && in spa_keystore_change_key_check()
1398 !zfs_prop_valid_keylocation(dcp->cp_keylocation, B_TRUE)) { in spa_keystore_change_key_check()
1404 if (dcp->cp_wkey->wk_keyformat == ZFS_KEYFORMAT_PASSPHRASE) { in spa_keystore_change_key_check()
1405 if (dcp->cp_wkey->wk_salt == 0 || in spa_keystore_change_key_check()
1406 dcp->cp_wkey->wk_iters < MIN_PBKDF2_ITERATIONS) { in spa_keystore_change_key_check()
1411 if (dcp->cp_wkey->wk_salt != 0 || dcp->cp_wkey->wk_iters != 0) { in spa_keystore_change_key_check()
1546 dsl_crypto_params_t *dcp = skcka->skcka_cp; in spa_keystore_change_key_sync() local
1549 const char *keylocation = dcp->cp_keylocation; in spa_keystore_change_key_sync()
1556 if (dcp->cp_cmd == DCP_CMD_NEW_KEY || in spa_keystore_change_key_sync()
1557 dcp->cp_cmd == DCP_CMD_FORCE_NEW_KEY) { in spa_keystore_change_key_sync()
1564 if (dcp->cp_cmd == DCP_CMD_NEW_KEY) { in spa_keystore_change_key_sync()
1565 wkey = dcp->cp_wkey; in spa_keystore_change_key_sync()
1585 if (dcp->cp_cmd == DCP_CMD_INHERIT) { in spa_keystore_change_key_sync()
1600 ASSERT(dcp->cp_cmd == DCP_CMD_FORCE_INHERIT || in spa_keystore_change_key_sync()
1601 dcp->cp_cmd == DCP_CMD_FORCE_NEW_KEY); in spa_keystore_change_key_sync()
1622 if (dcp->cp_cmd == DCP_CMD_NEW_KEY) { in spa_keystore_change_key_sync()
1635 spa_keystore_change_key(const char *dsname, dsl_crypto_params_t *dcp) in spa_keystore_change_key() argument
1641 skcka.skcka_cp = dcp; in spa_keystore_change_key()
1795 dmu_objset_create_crypt_check(dsl_dir_t *parentdd, dsl_crypto_params_t *dcp, in dmu_objset_create_crypt_check() argument
1805 if (dcp == NULL) in dmu_objset_create_crypt_check()
1806 dcp = &dummy_dcp; in dmu_objset_create_crypt_check()
1808 if (dcp->cp_cmd != DCP_CMD_NONE) in dmu_objset_create_crypt_check()
1819 crypt = (dcp->cp_crypt == ZIO_CRYPT_INHERIT) ? pcrypt : dcp->cp_crypt; in dmu_objset_create_crypt_check()
1824 /* check for valid dcp with no encryption (inherited or local) */ in dmu_objset_create_crypt_check()
1827 if (dcp->cp_wkey != NULL || in dmu_objset_create_crypt_check()
1828 (dcp->cp_keylocation != NULL && in dmu_objset_create_crypt_check()
1829 strcmp(dcp->cp_keylocation, "none") != 0)) in dmu_objset_create_crypt_check()
1857 if (dcp->cp_wkey == NULL) { in dmu_objset_create_crypt_check()
1861 if (dcp->cp_keylocation != NULL) in dmu_objset_create_crypt_check()
1877 if (dcp->cp_keylocation == NULL || in dmu_objset_create_crypt_check()
1878 !zfs_prop_valid_keylocation(dcp->cp_keylocation, B_TRUE)) in dmu_objset_create_crypt_check()
1882 switch (dcp->cp_wkey->wk_keyformat) { in dmu_objset_create_crypt_check()
1886 if (dcp->cp_wkey->wk_salt != 0 || dcp->cp_wkey->wk_iters != 0) in dmu_objset_create_crypt_check()
1891 if (dcp->cp_wkey->wk_salt == 0 || in dmu_objset_create_crypt_check()
1892 dcp->cp_wkey->wk_iters < MIN_PBKDF2_ITERATIONS) in dmu_objset_create_crypt_check()
1906 dsl_dataset_t *origin, dsl_crypto_params_t *dcp, dmu_tx_t *tx) in dsl_dataset_create_crypt_sync() argument
1914 ASSERT3P(dcp, ==, NULL); in dsl_dataset_create_crypt_sync()
1935 * A NULL dcp at this point indicates this is the origin dataset in dsl_dataset_create_crypt_sync()
1939 if (dcp == NULL || dcp->cp_cmd == DCP_CMD_RAW_RECV) in dsl_dataset_create_crypt_sync()
1942 crypt = dcp->cp_crypt; in dsl_dataset_create_crypt_sync()
1943 wkey = dcp->cp_wkey; in dsl_dataset_create_crypt_sync()
1980 if (dcp->cp_wkey == NULL) { in dsl_dataset_create_crypt_sync()