mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-14 12:20:00 +01:00
Fix LUKS2 encryption initialization with non-zero keyslot.
Positive keyslot number was interpreted as a failure.
This commit is contained in:
@@ -1324,7 +1324,7 @@ static int _luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_
|
|||||||
if (opt_integrity && !opt_integrity_no_wipe)
|
if (opt_integrity && !opt_integrity_no_wipe)
|
||||||
r = _wipe_data_device(cd);
|
r = _wipe_data_device(cd);
|
||||||
out:
|
out:
|
||||||
if (r == 0 && r_cd && r_password && r_passwordLen) {
|
if (r >= 0 && r_cd && r_password && r_passwordLen) {
|
||||||
*r_cd = cd;
|
*r_cd = cd;
|
||||||
*r_password = password;
|
*r_password = password;
|
||||||
*r_passwordLen = passwordLen;
|
*r_passwordLen = passwordLen;
|
||||||
|
|||||||
@@ -816,7 +816,7 @@ check_hash $PWD1 $HASH6
|
|||||||
|
|
||||||
# Device activation after encryption initialization
|
# Device activation after encryption initialization
|
||||||
wipe_dev $DEV
|
wipe_dev $DEV
|
||||||
echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 --reduce-device-size 8M -q $FAST_PBKDF_ARGON $DEV_NAME >/dev/null || fail
|
echo $PWD1 | $CRYPTSETUP reencrypt $DEV --encrypt --init-only -c aes-cbc-essiv:sha256 -s 128 -S11 --reduce-device-size 8M -q $FAST_PBKDF_ARGON $DEV_NAME >/dev/null || fail
|
||||||
$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
|
$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
|
||||||
check_hash_dev /dev/mapper/$DEV_NAME $HASH5
|
check_hash_dev /dev/mapper/$DEV_NAME $HASH5
|
||||||
echo $PWD1 | $CRYPTSETUP reencrypt --resume-only $DEV -q || fail
|
echo $PWD1 | $CRYPTSETUP reencrypt --resume-only $DEV -q || fail
|
||||||
|
|||||||
Reference in New Issue
Block a user