mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Fix wrong digest assignment to new LUKS2 (volume key) keyslot.
All new LUKS2 keyslots added by passphrase or by volume key were assigned to digest 0 despite the fact segment was assigned to different digest.
This commit is contained in:
committed by
Milan Broz
parent
869767a5cf
commit
fee1d659cf
@@ -135,7 +135,7 @@ int LUKS2_digest_verify(struct crypt_device *cd,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LUKS2_digest_dump(struct crypt_device *cd, int digest)
|
int LUKS2_digest_dump(struct crypt_device *cd, int digest)
|
||||||
@@ -172,7 +172,7 @@ int LUKS2_digest_verify_by_segment(struct crypt_device *cd,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LUKS2_digest_by_segment(struct crypt_device *cd,
|
int LUKS2_digest_by_segment(struct crypt_device *cd,
|
||||||
|
|||||||
@@ -3164,6 +3164,8 @@ int crypt_activate_by_volume_key(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)
|
if (r == -EPERM || r == -ENOENT)
|
||||||
log_err(cd, _("Volume key does not match the volume.\n"));
|
log_err(cd, _("Volume key does not match the volume.\n"));
|
||||||
|
if (r > 0)
|
||||||
|
r = 0;
|
||||||
|
|
||||||
if (!r && (name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) &&
|
if (!r && (name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) &&
|
||||||
crypt_use_keyring_for_vk(cd)) {
|
crypt_use_keyring_for_vk(cd)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user