mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Fix luksAddKey return code if master key is used.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@421 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
2011-01-29 Milan Broz <mbroz@redhat.com>
|
||||
* Fix mapping removal if device disappeared but node still exists.
|
||||
* Fix luksAddKey return code if master key is used.
|
||||
|
||||
2011-01-25 Milan Broz <mbroz@redhat.com>
|
||||
* Add loop-AES handling (loopaesOpen and loopaesClose commands).
|
||||
|
||||
@@ -643,9 +643,10 @@ static int action_luksAddKey(int arg)
|
||||
crypt_set_iterarion_time(cd, opt_iteration_time);
|
||||
|
||||
if (opt_master_key_file) {
|
||||
if (_read_mk(opt_master_key_file, &key, keysize) < 0)
|
||||
r = _read_mk(opt_master_key_file, &key, keysize);
|
||||
if (r < 0)
|
||||
goto out;
|
||||
|
||||
//FIXME: process keyfile arg
|
||||
r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot,
|
||||
key, keysize, NULL, 0);
|
||||
} else if (opt_key_file || opt_new_key_file) {
|
||||
|
||||
@@ -197,7 +197,13 @@ $CRYPTSETUP -q luksFormat --master-key-file /dev/urandom -s 128 --uuid $TEST_UUI
|
||||
$CRYPTSETUP luksOpen -d $KEY1 $LOOPDEV $DEV_NAME || fail
|
||||
$CRYPTSETUP -q luksClose $DEV_NAME || fail
|
||||
|
||||
prepare "[17] AddKey passphrase and keyfile" wipe
|
||||
prepare "[17] AddKey volume key, passphrase and keyfile" wipe
|
||||
# masterkey
|
||||
echo "key0" | $CRYPTSETUP -q luksFormat $LOOPDEV --master-key-file /dev/zero --key-slot 3 || fail
|
||||
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: ENABLED" || fail
|
||||
echo "key1" | $CRYPTSETUP luksAddKey $LOOPDEV --master-key-file /dev/zero --key-slot 4 || fail
|
||||
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 4: ENABLED" || fail
|
||||
echo "key2" | $CRYPTSETUP luksAddKey $LOOPDEV --master-key-file /dev/null --key-slot 5 2>/dev/null && fail
|
||||
# [0]key0 [1]key1 [2]$KEY1/1 [3]$KEY1 [4]$KEY2
|
||||
$CRYPTSETUP -q luksFormat $LOOPDEV $KEY1 --key-slot 3 || fail
|
||||
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 3: ENABLED" || fail
|
||||
|
||||
Reference in New Issue
Block a user