"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/reencryption-compat-test" between
cryptsetup-2.0.6.tar.xz and cryptsetup-2.1.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

reencryption-compat-test  (cryptsetup-2.0.6.tar.xz):reencryption-compat-test  (cryptsetup-2.1.0.tar.xz)
skipping to change at line 19 skipping to change at line 19
IMG=reenc-data IMG=reenc-data
IMG_HDR=$IMG.hdr IMG_HDR=$IMG.hdr
ORIG_IMG=reenc-data-orig ORIG_IMG=reenc-data-orig
KEY1=key1 KEY1=key1
PWD1="93R4P4pIqAH8" PWD1="93R4P4pIqAH8"
PWD2="1cND4319812f" PWD2="1cND4319812f"
PWD3="1-9Qu5Ejfnqv" PWD3="1-9Qu5Ejfnqv"
MNT_DIR=./mnt_luks MNT_DIR=./mnt_luks
START_DIR=$(pwd) START_DIR=$(pwd)
[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/
null)
function fips_mode()
{
[ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
}
function del_scsi_device() function del_scsi_device()
{ {
rmmod scsi_debug 2>/dev/null rmmod scsi_debug 2>/dev/null
sleep 2 sleep 2
} }
function remove_mapping() function remove_mapping()
{ {
[ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2 [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove $DEV_NAME2
skipping to change at line 208 skipping to change at line 214
echo -n "[${img%.img.xz}]" echo -n "[${img%.img.xz}]"
xz -d -c $img | dd of=$SCSI_DEV bs=4k >/dev/null 2>&1 xz -d -c $img | dd of=$SCSI_DEV bs=4k >/dev/null 2>&1
mount_and_test $SCSI_DEV || return 1 mount_and_test $SCSI_DEV || return 1
done done
echo echo
} }
[ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skip ped." [ $(id -u) != 0 ] && skip "WARNING: You must be root to run this test, test skip ped."
[ ! -x "$REENC" ] && skip "Cannot find $REENC, test skipped." [ ! -x "$REENC" ] && skip "Cannot find $REENC, test skipped."
which wipefs >/dev/null 2>&1 || skip "Cannot find wipefs, test skipped." which wipefs >/dev/null 2>&1 || skip "Cannot find wipefs, test skipped."
fips_mode && skip "This test cannot be run in FIPS mode."
# REENCRYPTION tests # REENCRYPTION tests
HASH1=b69dae56a14d1a8314ed40664c4033ea0a550eea2673e04df42a66ac6b9faf2c HASH1=b69dae56a14d1a8314ed40664c4033ea0a550eea2673e04df42a66ac6b9faf2c
HASH2=d85ef2a08aeac2812a648deb875485a6e3848fc3d43ce4aa380937f08199f86b HASH2=d85ef2a08aeac2812a648deb875485a6e3848fc3d43ce4aa380937f08199f86b
HASH3=e4e5749032a5163c45125eccf3e8598ba5ed840df442c97e1d5ad4ad84359605 HASH3=e4e5749032a5163c45125eccf3e8598ba5ed840df442c97e1d5ad4ad84359605
HASH4=2daeb1f36095b44b318410b3f4e8b5d989dcc7bb023d1426c492dab0a3053e74 HASH4=2daeb1f36095b44b318410b3f4e8b5d989dcc7bb023d1426c492dab0a3053e74
HASH5=5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef
echo "[1] Reencryption" echo "[1] Reencryption"
prepare 8192 prepare 8192
echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -s 128 -c aes-cbc-plain $FAS T_PBKDF --align-payload 4096 $LOOPDEV1 || fail echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 -s 128 -c aes-cbc-plain $FAS T_PBKDF --align-payload 4096 $LOOPDEV1 || fail
wipe $PWD1 wipe $PWD1
check_hash $PWD1 $HASH1 check_hash $PWD1 $HASH1
echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF echo $PWD1 | $REENC $LOOPDEV1 -q $FAST_PBKDF
check_hash $PWD1 $HASH1 check_hash $PWD1 $HASH1
echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 $FAST_PBKDF echo $PWD1 | $REENC $LOOPDEV1 -q -s 256 $FAST_PBKDF
check_hash $PWD1 $HASH1 check_hash $PWD1 $HASH1
skipping to change at line 264 skipping to change at line 272
# FIXME echo $PWD1 | $REENC ... # FIXME echo $PWD1 | $REENC ...
echo "[4] Encryption of not yet encrypted device" echo "[4] Encryption of not yet encrypted device"
# well, movin' zeroes :-) # well, movin' zeroes :-)
OFFSET=2048 OFFSET=2048
SIZE=$(blockdev --getsz $LOOPDEV1) SIZE=$(blockdev --getsz $LOOPDEV1)
wipe_dev $LOOPDEV1 wipe_dev $LOOPDEV1
dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || fail dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" || fail
check_hash_dev /dev/mapper/$DEV_NAME2 $HASH3 check_hash_dev /dev/mapper/$DEV_NAME2 $HASH3
dmsetup remove $DEV_NAME2 || fail dmsetup remove $DEV_NAME2 || fail
echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1 --reduce-device-size "$OFFSET"S -q $FAST_PBKDF || fail
check_hash $PWD1 $HASH3 check_hash $PWD1 $HASH3
$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail $CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
# 64MiB + 1 KiB
prepare 65537
OFFSET=131072
SIZE=$(blockdev --getsz $LOOPDEV1)
wipe_dev $LOOPDEV1
dmsetup create $DEV_NAME2 --table "0 $(($SIZE - $OFFSET)) linear $LOOPDEV1 0" ||
fail
check_hash_dev /dev/mapper/$DEV_NAME2 $HASH5
dmsetup remove $DEV_NAME2 || fail
echo $PWD1 | $REENC $LOOPDEV1 -c aes-cbc-essiv:sha256 -s 128 --new --type luks1
--reduce-device-size "$OFFSET"S $FAST_PBKDF || fail
check_hash $PWD1 $HASH5
$CRYPTSETUP --type luks1 luksDump $LOOPDEV1 > /dev/null || fail
prepare 8192
echo "[5] Reencryption using specific keyslot" echo "[5] Reencryption using specific keyslot"
echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fai l echo $PWD2 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fai l
echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 1 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 1 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 2 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 2 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 3 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 3 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 4 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 4 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 5 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD1" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 5 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 6 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD2" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 6 $LOOPDEV1 || fail
echo -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 7 $LOOPDEV1 || fail echo -e "$PWD2\n$PWD3" | $CRYPTSETUP -q luksAddKey $FAST_PBKDF -S 7 $LOOPDEV1 || fail
 End of changes. 5 change blocks. 
1 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)