int crypt_serialize_lock(struct crypt_device *cd)
{
	if (!cd->memory_hard_pbkdf_lock_enabled)
		return 0;

	log_dbg(cd, "Taking global memory-hard access serialization lock.");
	if (crypt_write_lock(cd, "memory-hard-access", true, &cd->pbkdf_memory_hard_lock)) {
		log_err(cd, _("Failed to acquire global memory-hard access serialization lock."));
		cd->pbkdf_memory_hard_lock = NULL;
		return -EINVAL;
	}

	return 0;
}
int crypt_serialize_lock(struct crypt_device *cd)
{
	if (!cd->memory_hard_pbkdf_lock_enabled)
		return 0;

	log_dbg(cd, "Taking global memory-hard access serialization lock.");
	if (crypt_write_lock(cd, "memory-hard-access", true, &cd->pbkdf_memory_hard_lock)) {
		log_err(cd, _("Failed to acquire global memory-hard access serialization lock."));
		cd->pbkdf_memory_hard_lock = NULL;
		return -EINVAL;
	}

	return 0;
}