mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Drop error message about mismatching volume key.
crypt_activate_by_keyslot_context() returns -EPERM when key was passed either by CRYPT_KC_TYPE_KEY or CRYPT_KC_TYPE_VK_KEYRING and does not match the digest stored in metadata. Sometimes caller might want to verify if the passed keyslot contexts matches the effective volume key or not without the error message. It can be printed from command line tools when needed.
This commit is contained in:
committed by
Milan Broz
parent
5f8cab5d4a
commit
79d8a8b840
@@ -5112,8 +5112,6 @@ static int _activate_reencrypt_device_by_vk(struct crypt_device *cd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
|
r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
|
||||||
if (r == -EPERM || r == -ENOENT)
|
|
||||||
log_err(cd, _("Volume key does not match the volume."));
|
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
r = LUKS2_activate(cd, name, vk, NULL, flags);
|
r = LUKS2_activate(cd, name, vk, NULL, flags);
|
||||||
goto out;
|
goto out;
|
||||||
@@ -5275,19 +5273,14 @@ static int _verify_key(struct crypt_device *cd,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
|
r = LUKS_verify_volume_key(&cd->u.luks1.hdr, vk);
|
||||||
if (r == -EPERM)
|
|
||||||
log_err(cd, _("Volume key does not match the volume."));
|
|
||||||
} else if (isLUKS2(cd->type)) {
|
} else if (isLUKS2(cd->type)) {
|
||||||
if (!vk)
|
if (!vk)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (unbound_key)
|
if (unbound_key)
|
||||||
r = LUKS2_digest_verify_by_any_matching(cd, vk);
|
r = LUKS2_digest_verify_by_any_matching(cd, vk);
|
||||||
else {
|
else
|
||||||
r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
|
r = LUKS2_digest_verify_by_segment(cd, &cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT, vk);
|
||||||
if (r == -EPERM || r == -ENOENT)
|
|
||||||
log_err(cd, _("Volume key does not match the volume."));
|
|
||||||
}
|
|
||||||
} else if (isVERITY(cd->type))
|
} else if (isVERITY(cd->type))
|
||||||
r = KEY_VERIFIED;
|
r = KEY_VERIFIED;
|
||||||
else if (isTCRYPT(cd->type))
|
else if (isTCRYPT(cd->type))
|
||||||
|
|||||||
Reference in New Issue
Block a user