"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/device-test" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.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.

device-test  (cryptsetup-2.3.6.tar.xz):device-test  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 20 skipping to change at line 20
FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000" FAST_PBKDF_OPT="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
SKIP_COUNT=0 SKIP_COUNT=0
cleanup() { cleanup() {
[ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME
udevadm settle >/dev/null 2>&1 udevadm settle >/dev/null 2>&1
if [ -d "$MNT_DIR" ] ; then if [ -d "$MNT_DIR" ] ; then
umount -f $MNT_DIR 2>/dev/null umount -f $MNT_DIR 2>/dev/null
rmdir $MNT_DIR 2>/dev/null rmdir $MNT_DIR 2>/dev/null
fi fi
rmmod scsi_debug 2>/dev/null rmmod scsi_debug >/dev/null 2>&1
} }
fail() fail()
{ {
[ -n "$1" ] && echo "FAIL $1" [ -n "$1" ] && echo "FAIL $1"
echo "FAILED backtrace:" echo "FAILED backtrace:"
while caller $frame; do ((frame++)); done while caller $frame; do ((frame++)); done
cleanup cleanup
exit 100 exit 100
} }
skip() skip()
{ {
echo "TEST SKIPPED: $1" echo "TEST SKIPPED: $1"
cleanup cleanup
exit 77 exit 77
} }
add_device() { add_device() {
modprobe scsi_debug $@ delay=0 rmmod scsi_debug >/dev/null 2>&1
[ -d /sys/module/scsi_debug ] && skip "Cannot use scsi_debug module (in u
se or compiled-in)."
modprobe scsi_debug $@ delay=0 >/dev/null 2>&1
[ $? -ne 0 ] && skip "This kernel seems to not support proper scsi_debug module." [ $? -ne 0 ] && skip "This kernel seems to not support proper scsi_debug module."
sleep 1 sleep 1
SCSI_DEV=$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d / ) SCSI_DEV=$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d / )
[ -b "/dev/$SCSI_DEV" ] || fail "Cannot find $SCSI_DEV." [ -b "/dev/$SCSI_DEV" ] || fail "Cannot find $SCSI_DEV."
} }
function dm_crypt_features() function dm_crypt_features()
{ {
modprobe dm-crypt || fail "dm-crypt failed to load" modprobe dm-crypt >/dev/null 2>&1 || fail "dm-crypt failed to load"
VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv) VER_STR=$(dmsetup targets | grep crypt | cut -f2 -dv)
[ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version." [ -z "$VER_STR" ] && fail "Failed to parse dm-crypt version."
VER_MAJ=$(echo $VER_STR | cut -f 1 -d.) VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
VER_MIN=$(echo $VER_STR | cut -f 2 -d.) VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
VER_PTC=$(echo $VER_STR | cut -f 3 -d.) VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
[ $VER_MAJ -lt 1 ] && return [ $VER_MAJ -lt 1 ] && return
[ $VER_MAJ -gt 1 ] && { [ $VER_MAJ -gt 1 ] && {
DM_PERF_CPU=1 DM_PERF_CPU=1
skipping to change at line 313 skipping to change at line 316
echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail echo -e "$PWD1" | $CRYPTSETUP open $DEV $DEV_NAME || fail
check_sector_size $S check_sector_size $S
$CRYPTSETUP close $DEV_NAME || fail $CRYPTSETUP close $DEV_NAME || fail
done done
echo echo
fi fi
echo "[4] Disappeared device test:" echo "[4] Disappeared device test:"
KEY="000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000001" KEY="000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000001"
for F in LUKS1 LUKS2 BITLK TCRYPT; do for F in LUKS1 LUKS2 BITLK TCRYPT; do
echo -n "$F"
add_device dev_size_mb=1 sector_size=512 num_tgts=1 lbpu=1 add_device dev_size_mb=1 sector_size=512 num_tgts=1 lbpu=1
echo -n "$F"
# Fake CRYPT UUID to force code to parse type-specific path # Fake CRYPT UUID to force code to parse type-specific path
dmsetup create $DEV_NAME --uuid CRYPT-$F-$DEV_NAME --table "0 1024 crypt aes-xts-plain64 $KEY 16 /dev/$SCSI_DEV 16" dmsetup create $DEV_NAME --uuid CRYPT-$F-$DEV_NAME --table "0 1024 crypt aes-xts-plain64 $KEY 16 /dev/$SCSI_DEV 16"
$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail $CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
echo 1 > /sys/block/$SCSI_DEV/device/delete echo 1 > /sys/block/$SCSI_DEV/device/delete
udevadm settle >/dev/null 2>&1 udevadm settle >/dev/null 2>&1
$CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail $CRYPTSETUP status $DEV_NAME >/dev/null 2>&1 || fail
dmsetup remove $DEV_NAME --retry || fail dmsetup remove $DEV_NAME --retry || fail
rmmod scsi_debug rmmod scsi_debug >/dev/null 2>&1
echo -n "[OK] " echo -n "[OK] "
done done
echo echo
cleanup cleanup
exit 0 exit 0
 End of changes. 6 change blocks. 
5 lines changed or deleted 9 lines changed or added

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