Lines Matching refs:ret
139 int ret;
175 ret = SET_ERROR(EINVAL);
183 ret = SET_ERROR(EINVAL);
191 ret = SET_ERROR(EINVAL);
198 ret = SET_ERROR(EINVAL);
207 ret = SET_ERROR(EINVAL);
240 return (ret);
360 int ret;
363 ret = dsl_dir_get_encryption_version(dd, &version);
364 if (ret != 0)
374 int ret;
386 ret = SET_ERROR(ENOENT);
398 return (ret);
405 int ret;
416 ret = dsl_dir_get_encryption_root_ddobj(dd, &rddobj);
417 if (ret != 0)
421 ret = spa_keystore_wkey_hold_ddobj_impl(spa, rddobj, tag, &wkey);
422 if (ret != 0)
437 return (ret);
443 int ret = 0;
449 ret = dsl_pool_hold(dsname, FTAG, &dp);
450 if (ret != 0)
453 ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
454 if (ret != 0) {
462 ret = SET_ERROR(EACCES);
466 ret = 0;
472 ret = SET_ERROR(EINVAL);
477 ret = dsl_dir_get_encryption_root_ddobj(dd, &rddobj);
478 if (ret != 0)
482 ret = SET_ERROR(EACCES);
497 return (ret);
528 int ret;
540 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_CRYPTO_SUITE, 8, 1,
542 if (ret != 0)
545 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_GUID, 8, 1, &guid);
546 if (ret != 0)
549 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_MASTER_KEY, 1,
551 if (ret != 0)
554 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_HMAC_KEY, 1,
556 if (ret != 0)
559 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_IV, 1, WRAPPING_IV_LEN,
561 if (ret != 0)
564 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_MAC, 1, WRAPPING_MAC_LEN,
566 if (ret != 0)
576 ret = zio_crypt_key_unwrap(&wkey->wk_key, crypt, version, guid,
578 if (ret != 0) {
579 ret = SET_ERROR(EACCES);
600 return (ret);
607 int ret;
619 ret = SET_ERROR(ENOENT);
631 return (ret);
638 int ret;
646 ret = spa_keystore_dsl_key_hold_impl(spa, dckobj, tag, &dck_ks);
648 if (ret == 0) {
654 ret = spa_keystore_wkey_hold_dd(spa, dd, FTAG, &wkey);
655 if (ret != 0) {
661 ret = dsl_crypto_key_open(spa->spa_meta_objset, wkey, dckobj,
663 if (ret != 0) {
666 return (ret);
675 ret = spa_keystore_dsl_key_hold_impl(spa, dckobj, tag, &dck_ks);
676 if (ret != 0) {
708 int ret;
717 ret = SET_ERROR(EEXIST);
728 return (ret);
735 int ret;
752 ret = dsl_pool_hold(dsname, FTAG, &dp);
753 if (ret != 0)
757 ret = SET_ERROR(ENOTSUP);
762 ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
763 if (ret != 0) {
769 ret = dsl_dir_get_encryption_root_ddobj(dd, &rddobj);
770 if (ret != 0 || rddobj != dd->dd_object) {
771 ret = SET_ERROR(EINVAL);
779 ret = dsl_crypto_key_open(dp->dp_meta_objset, wkey,
781 if (ret != 0)
785 ret = zap_lookup(dp->dp_meta_objset, dd->dd_crypto_obj,
787 if (ret != 0)
790 ret = zap_lookup(dp->dp_meta_objset, dd->dd_crypto_obj,
792 if (ret != 0)
795 ret = zap_lookup(dp->dp_meta_objset, dd->dd_crypto_obj,
797 if (ret != 0)
820 ret = spa_keystore_load_wkey_impl(dp->dp_spa, wkey);
821 if (ret != 0)
841 return (ret);
847 int ret;
860 ret = SET_ERROR(EACCES);
863 ret = SET_ERROR(EBUSY);
877 return (ret);
883 int ret = 0;
888 ret = spa_open(dsname, &spa, FTAG);
889 if (ret != 0)
890 return (ret);
902 ret = dsl_pool_hold(dsname, FTAG, &dp);
903 if (ret != 0)
907 ret = (SET_ERROR(ENOTSUP));
911 ret = dsl_dir_hold(dp, dsname, FTAG, &dd, NULL);
912 if (ret != 0) {
918 ret = spa_keystore_unload_wkey_impl(dp->dp_spa, dd->dd_object);
919 if (ret != 0)
936 return (ret);
991 int ret;
1000 ret = spa_keystore_dsl_key_hold_dd(spa, ds->ds_dir, km, &km->km_key);
1001 if (ret != 0) {
1007 return (ret);
1049 int ret;
1062 ret = SET_ERROR(ENOENT);
1074 return (ret);
1088 int ret;
1104 ret = SET_ERROR(ENOENT);
1122 return (ret);
1128 int ret;
1131 ret = spa_keystore_wkey_hold_dd(dd->dd_pool->dp_spa, dd, FTAG,
1133 if (ret != 0)
1224 int ret;
1233 ret = SET_ERROR(ENOTSUP);
1242 ret = SET_ERROR(EINVAL);
1247 ret = dsl_dir_hold(dp, skcka->skcka_dsname, FTAG, &dd, NULL);
1248 if (ret != 0) {
1255 ret = SET_ERROR(EINVAL);
1261 ret = SET_ERROR(EINVAL);
1266 ret = dsl_dir_get_encryption_root_ddobj(dd, &rddobj);
1267 if (ret != 0)
1277 ret = SET_ERROR(EINVAL);
1283 ret = SET_ERROR(EINVAL);
1289 ret = SET_ERROR(EINVAL);
1295 ret = dmu_objset_check_wkey_loaded(dd);
1296 if (ret != 0)
1299 ret = dmu_objset_check_wkey_loaded(dd->dd_parent);
1300 if (ret != 0)
1314 ret = SET_ERROR(EINVAL);
1320 ret = SET_ERROR(EINVAL);
1330 ret = SET_ERROR(EINVAL);
1336 ret = SET_ERROR(EINVAL);
1343 ret = SET_ERROR(EINVAL);
1353 ret = SET_ERROR(EINVAL);
1360 ret = SET_ERROR(EINVAL);
1368 ret = SET_ERROR(EINVAL);
1373 ret = SET_ERROR(EINVAL);
1379 ret = dmu_objset_check_wkey_loaded(dd);
1380 if (ret != 0)
1391 return (ret);
1406 int ret;
1425 ret = dsl_dir_get_encryption_root_ddobj(dd, &curr_rddobj);
1426 VERIFY(ret == 0 || ret == ENOENT);
1432 if (ret == ENOENT ||
1618 int ret;
1624 ret = dsl_dir_get_encryption_root_ddobj(dd, &curr_rddobj);
1625 if (ret != 0)
1633 ret = dsl_dir_get_encryption_root_ddobj(newparent,
1635 if (ret != 0)
1639 ret = SET_ERROR(EACCES);
1647 return (ret);
1657 int ret;
1675 ret = dsl_dir_get_encryption_root_ddobj(origin, &rddobj);
1676 if (ret != 0)
1677 return (ret);
1686 ret = dsl_dir_get_encryption_root_ddobj(origin->dd_parent, &op_rddobj);
1687 if (ret == ENOENT)
1689 else if (ret != 0)
1690 return (ret);
1692 ret = dsl_dir_get_encryption_root_ddobj(target->dd_parent, &tp_rddobj);
1693 if (ret == ENOENT)
1695 else if (ret != 0)
1696 return (ret);
1759 int ret;
1773 ret = dsl_dir_get_crypt(parentdd, &pcrypt);
1774 if (ret != 0)
1775 return (ret);
1830 ret = dmu_objset_check_wkey_loaded(parentdd);
1831 if (ret != 0)
1832 return (ret);
1960 int ret;
1972 ret = nvlist_lookup_uint64(nvl, "mdn_compress", &intval);
1973 if (ret != 0 || intval >= ZIO_COMPRESS_LEGACY_FUNCTIONS)
1976 ret = nvlist_lookup_uint64(nvl, "mdn_checksum", &intval);
1977 if (ret != 0 || intval >= ZIO_CHECKSUM_LEGACY_FUNCTIONS)
1980 ret = nvlist_lookup_uint64(nvl, "mdn_nlevels", &nlevels);
1981 if (ret != 0 || nlevels > DN_MAX_LEVELS)
1984 ret = nvlist_lookup_uint64(nvl, "mdn_blksz", &blksz);
1985 if (ret != 0 || blksz < SPA_MINBLOCKSIZE)
1990 ret = nvlist_lookup_uint64(nvl, "mdn_indblkshift", &ibs);
1991 if (ret != 0 || ibs < DN_MIN_INDBLKSHIFT || ibs > DN_MAX_INDBLKSHIFT)
1994 ret = nvlist_lookup_uint64(nvl, "mdn_nblkptr", &nblkptr);
1995 if (ret != 0 || nblkptr != DN_MAX_NBLKPTR)
1998 ret = nvlist_lookup_uint64(nvl, "mdn_maxblkid", &maxblkid);
1999 if (ret != 0)
2002 ret = nvlist_lookup_uint8_array(nvl, "portable_mac", &buf, &len);
2003 if (ret != 0 || len != ZIO_OBJSET_MAC_LEN)
2006 ret = dmu_objset_from_ds(ds, &os);
2007 if (ret != 0)
2008 return (ret);
2140 int ret;
2154 ret = nvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_CRYPTO_SUITE, &intval);
2155 if (ret != 0 || intval >= ZIO_CRYPT_FUNCTIONS ||
2159 ret = nvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_GUID, &intval);
2160 if (ret != 0)
2168 ret = zap_lookup(mos, ds->ds_dir->dd_crypto_obj,
2170 if (ret != 0)
2171 return (ret);
2176 ret = nvlist_lookup_uint8_array(nvl, DSL_CRYPTO_KEY_MASTER_KEY,
2178 if (ret != 0 || len != MASTER_KEY_MAX_LEN)
2181 ret = nvlist_lookup_uint8_array(nvl, DSL_CRYPTO_KEY_HMAC_KEY,
2183 if (ret != 0 || len != SHA512_HMAC_KEYLEN)
2186 ret = nvlist_lookup_uint8_array(nvl, DSL_CRYPTO_KEY_IV, &buf, &len);
2187 if (ret != 0 || len != WRAPPING_IV_LEN)
2190 ret = nvlist_lookup_uint8_array(nvl, DSL_CRYPTO_KEY_MAC, &buf, &len);
2191 if (ret != 0 || len != WRAPPING_MAC_LEN)
2200 ret = nvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_VERSION, &version);
2201 if (ret != 0 || version != ZIO_CRYPT_KEY_CURRENT_VERSION)
2204 ret = nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_KEYFORMAT),
2206 if (ret != 0 || intval >= ZFS_KEYFORMAT_FORMATS ||
2216 ret = nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_PBKDF2_ITERS),
2218 if (ret != 0 || (is_passphrase == (intval == 0)))
2221 ret = nvlist_lookup_uint64(nvl, zfs_prop_to_name(ZFS_PROP_PBKDF2_SALT),
2223 if (ret != 0 || (is_passphrase == (intval == 0)))
2306 int ret;
2310 ret = dsl_dataset_hold_obj(tx->tx_pool, dcrka->dcrka_dsobj,
2312 if (ret != 0)
2316 ret = dsl_dataset_hold_obj(tx->tx_pool, dcrka->dcrka_fromobj,
2318 if (ret != 0)
2322 ret = dsl_crypto_recv_raw_objset_check(ds, fromds,
2324 if (ret != 0)
2332 ret = dsl_crypto_recv_raw_key_check(ds, dcrka->dcrka_nvl, tx);
2333 if (ret != 0)
2341 return (ret);
2384 int ret;
2408 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_CRYPTO_SUITE, 8, 1,
2410 if (ret != 0)
2413 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_GUID, 8, 1, &key_guid);
2414 if (ret != 0)
2417 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_MASTER_KEY, 1,
2419 if (ret != 0)
2422 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_HMAC_KEY, 1,
2424 if (ret != 0)
2427 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_IV, 1, WRAPPING_IV_LEN,
2429 if (ret != 0)
2432 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_MAC, 1, WRAPPING_MAC_LEN,
2434 if (ret != 0)
2438 ret = zap_lookup(mos, ds->ds_object, DS_FIELD_IVSET_GUID, 8, 1,
2440 if (ret != 0)
2447 ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_VERSION, 8, 1, &version);
2448 if (ret != 0 || version != ZIO_CRYPT_KEY_CURRENT_VERSION) {
2450 ret = SET_ERROR(ENOTSUP);
2461 ret = dsl_dir_get_encryption_root_ddobj(ds->ds_dir, &rddobj);
2462 if (ret != 0)
2467 ret = dsl_dir_hold_obj(dp, rddobj, NULL, FTAG, &rdd);
2468 if (ret != 0)
2471 ret = zap_lookup(dp->dp_meta_objset, rdd->dd_crypto_obj,
2473 if (ret != 0)
2477 ret = zap_lookup(dp->dp_meta_objset, rdd->dd_crypto_obj,
2479 if (ret != 0)
2482 ret = zap_lookup(dp->dp_meta_objset, rdd->dd_crypto_obj,
2484 if (ret != 0)
2528 return (ret);
2645 int ret;
2649 ret = spa_keystore_lookup_key(spa, dsobj, FTAG, &dck);
2650 if (ret != 0)
2653 ret = zio_crypt_key_get_salt(&dck->dck_key, salt);
2654 if (ret != 0)
2663 return (ret);
2676 int ret;
2684 ret = spa_keystore_lookup_key(spa, dsobj, FTAG, &dck);
2685 if (ret != 0)
2689 ret = zio_crypt_do_objset_hmacs(&dck->dck_key, buf, datalen,
2691 if (ret != 0)
2718 return (ret);
2725 int ret;
2731 ret = spa_keystore_lookup_key(spa, dsobj, FTAG, &dck);
2732 if (ret != 0)
2736 ret = zio_crypt_do_hmac(&dck->dck_key, buf, datalen,
2738 if (ret != 0)
2762 return (ret);
2777 int ret;
2784 ret = spa_keystore_lookup_key(spa, zb->zb_objset, FTAG, &dck);
2785 if (ret != 0) {
2786 ret = SET_ERROR(EACCES);
2787 return (ret);
2808 ret = zio_crypt_key_get_salt(&dck->dck_key, salt);
2809 if (ret != 0)
2812 ret = zio_crypt_generate_iv(iv);
2813 if (ret != 0)
2816 ret = zio_crypt_generate_iv_salt_dedup(&dck->dck_key,
2818 if (ret != 0)
2823 ret = zio_do_crypt_data(encrypt, &dck->dck_key, ot, bswap, salt, iv,
2832 if (zio_injection_enabled && !encrypt && ot != DMU_OT_DNODE && ret == 0)
2833 ret = zio_handle_decrypt_injection(spa, zb, ot, ECKSUM);
2834 if (ret != 0)
2864 return (ret);