if (err != 0)
fatal(
"couldn't load encryption key for %s: %s",
- encroot, strerror(err));
+ encroot, err == ZFS_ERR_CRYPTO_NOTSUP ?
+ "crypto params not supported" : strerror(err));
ASSERT3U(dsl_dataset_get_keystatus(dd), ==, ZFS_KEYSTATUS_AVAILABLE);
'ZFS_ERR_VDEV_NOTSUP',
'ZFS_ERR_NOT_USER_NAMESPACE',
'ZFS_ERR_RESUME_EXISTS',
+ 'ZFS_ERR_CRYPTO_NOTSUP',
],
{}
)
ZFS_ERR_VDEV_NOTSUP,
ZFS_ERR_NOT_USER_NAMESPACE,
ZFS_ERR_RESUME_EXISTS,
+ ZFS_ERR_CRYPTO_NOTSUP,
} zfs_errno_t;
/*
"Incorrect key provided for '%s'."),
zfs_get_name(zhp));
break;
+ case ZFS_ERR_CRYPTO_NOTSUP:
+ zfs_error_aux(zhp->zfs_hdl, dgettext(TEXT_DOMAIN,
+ "'%s' uses an unsupported encryption suite."),
+ zfs_get_name(zhp));
+ break;
}
goto error;
}
"stream."));
(void) zfs_error(hdl, EZFS_BADVERSION, errbuf);
break;
+ case ZFS_ERR_CRYPTO_NOTSUP:
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "stream uses crypto parameters not compatible with "
+ "this pool"));
+ (void) zfs_error(hdl, EZFS_BADSTREAM, errbuf);
+ break;
case EDQUOT:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"destination %s space quota exceeded."), name);
if (ret != 0)
goto error;
+ /* handle a future crypto suite that we don't support */
+ if (crypt >= ZIO_CRYPT_FUNCTIONS) {
+ ret = (SET_ERROR(ZFS_ERR_CRYPTO_NOTSUP));
+ goto error;
+ }
+
ret = zap_lookup(mos, dckobj, DSL_CRYPTO_KEY_GUID, 8, 1, &guid);
if (ret != 0)
goto error;
* wrapping key.
*/
ret = nvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_CRYPTO_SUITE, &intval);
- if (ret != 0 || intval >= ZIO_CRYPT_FUNCTIONS ||
- intval <= ZIO_CRYPT_OFF)
+ if (ret != 0 || intval <= ZIO_CRYPT_OFF)
return (SET_ERROR(EINVAL));
+ /*
+ * Flag a future crypto suite that we don't support differently, so
+ * we can return a more useful error to the user.
+ */
+ if (intval >= ZIO_CRYPT_FUNCTIONS)
+ return (SET_ERROR(ZFS_ERR_CRYPTO_NOTSUP));
+
ret = nvlist_lookup_uint64(nvl, DSL_CRYPTO_KEY_GUID, &intval);
if (ret != 0)
return (SET_ERROR(EINVAL));