"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/compat-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.

compat-test  (cryptsetup-2.3.6.tar.xz):compat-test  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 56 skipping to change at line 56
LOOPDEV=$(losetup -f 2>/dev/null) LOOPDEV=$(losetup -f 2>/dev/null)
[ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/ null) [ -f /etc/system-fips ] && FIPS_MODE=$(cat /proc/sys/crypto/fips_enabled 2>/dev/ null)
function remove_mapping() function remove_mapping()
{ {
[ -b /dev/mapper/$DEV_NAME3 ] && dmsetup remove --retry $DEV_NAME3 >/dev/ null 2>&1 [ -b /dev/mapper/$DEV_NAME3 ] && dmsetup remove --retry $DEV_NAME3 >/dev/ null 2>&1
[ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2 >/dev/ null 2>&1 [ -b /dev/mapper/$DEV_NAME2 ] && dmsetup remove --retry $DEV_NAME2 >/dev/ null 2>&1
[ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/nu ll 2>&1 [ -b /dev/mapper/$DEV_NAME ] && dmsetup remove --retry $DEV_NAME >/dev/nu ll 2>&1
losetup -d $LOOPDEV >/dev/null 2>&1 losetup -d $LOOPDEV >/dev/null 2>&1
rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $VK_FILE missing-file >/dev/null 2>&1 rm -f $ORIG_IMG $IMG $IMG10 $KEY1 $KEY2 $KEY5 $KEYE $HEADER_IMG $VK_FILE missing-file >/dev/null 2>&1
rmmod scsi_debug 2> /dev/null rmmod scsi_debug >/dev/null 2>&1
scsi_debug_teardown $DEV scsi_debug_teardown $DEV
} }
function force_uevent() function force_uevent()
{ {
DNAME=$(echo $LOOPDEV | cut -f3 -d /) DNAME=$(echo $LOOPDEV | cut -f3 -d /)
echo "change" >/sys/block/$DNAME/uevent echo "change" >/sys/block/$DNAME/uevent
} }
function fail() function fail()
skipping to change at line 82 skipping to change at line 82
exit 2 exit 2
} }
function fips_mode() function fips_mode()
{ {
[ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ] [ -n "$FIPS_MODE" ] && [ "$FIPS_MODE" -gt 0 ]
} }
function can_fail_fips() function can_fail_fips()
{ {
# Ignore this fail if running in FIPS mode # Ignore this fail if running in FIPS mode
fips_mode || fail $1 fips_mode || fail $1
} }
function skip() function skip()
{ {
[ -n "$1" ] && echo "$1" [ -n "$1" ] && echo "$1"
remove_mapping remove_mapping
[ -z "$2" ] && exit $2 [ -z "$2" ] && exit $2
exit 77 exit 77
} }
skipping to change at line 130 skipping to change at line 130
if [ ! -e $IMG ]; then if [ ! -e $IMG ]; then
xz -cd compatimage.img.xz > $IMG xz -cd compatimage.img.xz > $IMG
losetup $LOOPDEV $IMG losetup $LOOPDEV $IMG
fi fi
[ ! -e $IMG10 ] && xz -cd compatv10image.img.xz > $IMG10 [ ! -e $IMG10 ] && xz -cd compatv10image.img.xz > $IMG10
;; ;;
esac esac
if [ ! -e $KEY1 ]; then if [ ! -e $KEY1 ]; then
#dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1 #dd if=/dev/urandom of=$KEY1 count=1 bs=32 >/dev/null 2>&1
echo -n $'\x48\xc6\x74\x4f\x41\x4e\x50\xc0\x79\xc2\x2d\x5b\x5f\x echo -n $'\x48\xc6\x74\x4f\x41\x4e\x50\xc0\x79\xc2\x2d\x5b\x5f\x6
68\x84\x17' >$KEY1 8\x84\x17' >$KEY1
echo -n $'\x9c\x03\x5e\x1b\x4d\x0f\x9a\x75\xb3\x90\x70\x32\x0a\x echo -n $'\x9c\x03\x5e\x1b\x4d\x0f\x9a\x75\xb3\x90\x70\x32\x0a\xf
f8\xae\xc4'>>$KEY1 8\xae\xc4'>>$KEY1
fi fi
if [ ! -e $KEY2 ]; then if [ ! -e $KEY2 ]; then
dd if=/dev/urandom of=$KEY2 count=1 bs=16 >/dev/null 2>&1 dd if=/dev/urandom of=$KEY2 count=1 bs=16 >/dev/null 2>&1
fi fi
if [ ! -e $KEY5 ]; then if [ ! -e $KEY5 ]; then
dd if=/dev/urandom of=$KEY5 count=1 bs=16 >/dev/null 2>&1 dd if=/dev/urandom of=$KEY5 count=1 bs=16 >/dev/null 2>&1
fi fi
skipping to change at line 168 skipping to change at line 168
{ {
[ -b /dev/mapper/$DEV_NAME ] || fail [ -b /dev/mapper/$DEV_NAME ] || fail
check $1 check $1
} }
# $1 path to scsi debug bdev # $1 path to scsi debug bdev
scsi_debug_teardown() { scsi_debug_teardown() {
local _tries=15; local _tries=15;
while [ -b "$1" -a $_tries -gt 0 ]; do while [ -b "$1" -a $_tries -gt 0 ]; do
rmmod scsi_debug 2> /dev/null rmmod scsi_debug >/dev/null 2>&1
if [ -b "$1" ]; then if [ -b "$1" ]; then
sleep .1 sleep .1
_tries=$((_tries-1)) _tries=$((_tries-1))
fi fi
done done
test ! -b "$1" || rmmod scsi_debug 2> /dev/null test ! -b "$1" || rmmod scsi_debug >/dev/null 2>&1
} }
function add_scsi_device() { function add_scsi_device() {
scsi_debug_teardown $DEV scsi_debug_teardown $DEV
modprobe scsi_debug $@ delay=0 if [ -d /sys/module/scsi_debug ] ; then
if [ $? -ne 0 ] ; then echo "Cannot use scsi_debug module (in use or compiled-in), test
echo "This kernel seems to not support proper scsi_debug module, skipped."
test skipped." exit 77
exit 77 fi
fi modprobe scsi_debug $@ delay=0 >/dev/null 2>&1
if [ $? -ne 0 ] ; then
sleep 1 echo "This kernel seems to not support proper scsi_debug module,
DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 - test skipped."
d /) exit 77
[ -b $DEV ] || fail "Cannot find $DEV." fi
sleep 1
DEV="/dev/"$(grep -l -e scsi_debug /sys/block/*/device/model | cut -f4 -d
/)
[ -b $DEV ] || fail "Cannot find $DEV."
} }
function valgrind_setup() function valgrind_setup()
{ {
[ -n "$VALG" ] || return [ -n "$VALG" ] || return
which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind." which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
[ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptset up executable." [ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptset up executable."
export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
CRYPTSETUP=valgrind_run CRYPTSETUP=valgrind_run
CRYPTSETUP_RAW="./valg.sh ${CRYPTSETUP_VALGRIND}" CRYPTSETUP_RAW="./valg.sh ${CRYPTSETUP_VALGRIND}"
skipping to change at line 804 skipping to change at line 808
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 1: DISABLED" || fail
$CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: DISABLED" || fail $CRYPTSETUP luksDump $LOOPDEV | grep -q "Key Slot 5: DISABLED" || fail
prepare "[31] Deferred removal of device" wipe prepare "[31] Deferred removal of device" wipe
echo $PWD1 | $CRYPTSETUP open --type plain --hash sha256 $LOOPDEV $DEV_NAME || f ail echo $PWD1 | $CRYPTSETUP open --type plain --hash sha256 $LOOPDEV $DEV_NAME || f ail
echo $PWD2 | $CRYPTSETUP open --type plain --hash sha256 /dev/mapper/$DEV_NAME $ DEV_NAME2 || fail echo $PWD2 | $CRYPTSETUP open --type plain --hash sha256 /dev/mapper/$DEV_NAME $ DEV_NAME2 || fail
$CRYPTSETUP close $DEV_NAME >/dev/null 2>&1 && fail $CRYPTSETUP close $DEV_NAME >/dev/null 2>&1 && fail
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail $CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
$CRYPTSETUP close --deferred $DEV_NAME >/dev/null 2>&1 $CRYPTSETUP close --deferred $DEV_NAME >/dev/null 2>&1
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
dmsetup info $DEV_NAME | grep -q "DEFERRED REMOVE" || fail dmsetup info $DEV_NAME | grep -q "DEFERRED REMOVE" || fail
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail $CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 || fail
$CRYPTSETUP close $DEV_NAME2 || fail $CRYPTSETUP close --cancel-deferred $DEV_NAME >/dev/null 2>&1
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 && fail dmsetup info $DEV_NAME | grep -q "DEFERRED REMOVE" >/dev/null 2>&1 && fai
l
$CRYPTSETUP close --deferred $DEV_NAME >/dev/null 2>&1
$CRYPTSETUP close $DEV_NAME2 || fail
$CRYPTSETUP -q status $DEV_NAME >/dev/null 2>&1 && fail
else else
$CRYPTSETUP close $DEV_NAME2 >/dev/null 2>&1 $CRYPTSETUP close $DEV_NAME2 >/dev/null 2>&1
$CRYPTSETUP close $DEV_NAME >/dev/null 2>&1 $CRYPTSETUP close $DEV_NAME >/dev/null 2>&1
fi fi
# Interactive tests # Interactive tests
# Do not remove sleep 0.1 below, the password query flushes TTY buffer (so the c ode is racy). # Do not remove sleep 0.1 below, the password query flushes TTY buffer (so the c ode is racy).
which expect >/dev/null 2>&1 || skip "WARNING: expect tool missing, interactive test will be skipped." 0 which expect >/dev/null 2>&1 || skip "WARNING: expect tool missing, interactive test will be skipped." 0
prepare "[32] Interactive password retry from terminal." new prepare "[32] Interactive password retry from terminal." new
EXPECT_DEV=$(losetup $LOOPDEV | sed -e "s/.*(\(.*\))/\1/") EXPECT_DEV=$(losetup $LOOPDEV | sed -e "s/.*(\(.*\))/\1/")
EXPECT_TIMEOUT=10 EXPECT_TIMEOUT=10
[ -n "$VALG" ] && EXPECT_TIMEOUT=60 [ -n "$VALG" ] && EXPECT_TIMEOUT=60
 End of changes. 8 change blocks. 
25 lines changed or deleted 34 lines changed or added

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