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:
Ondrej Kozina
2018-04-05 18:02:24 +02:00
committed by Milan Broz
parent 869767a5cf
commit fee1d659cf
2 changed files with 4 additions and 2 deletions

View File

@@ -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);
if (r == -EPERM || r == -ENOENT)
log_err(cd, _("Volume key does not match the volume.\n"));
if (r > 0)
r = 0;
if (!r && (name || (flags & CRYPT_ACTIVATE_KEYRING_KEY)) &&
crypt_use_keyring_for_vk(cd)) {