int crypt_set_metadata_size(struct crypt_device *cd,
	uint64_t metadata_size,
	uint64_t keyslots_size)
{
	if (!cd)
		return -EINVAL;

	if (cd->type && !isLUKS2(cd->type))
		return -EINVAL;

	if (metadata_size && LUKS2_check_metadata_area_size(metadata_size))
		return -EINVAL;

	if (keyslots_size && LUKS2_check_keyslots_area_size(keyslots_size))
		return -EINVAL;

	cd->metadata_size = metadata_size;
	cd->keyslots_size = keyslots_size;

	return 0;
}
int crypt_set_metadata_size(struct crypt_device *cd,
	uint64_t metadata_size,
	uint64_t keyslots_size)
{
	if (!cd)
		return -EINVAL;

	if (cd->type && !isLUKS2(cd->type))
		return -EINVAL;

	if (metadata_size && LUKS2_check_metadata_area_size(metadata_size))
		return -EINVAL;

	if (keyslots_size && LUKS2_check_keyslots_area_size(keyslots_size))
		return -EINVAL;

	cd->metadata_size = metadata_size;
	cd->keyslots_size = keyslots_size;

	return 0;
}