"Fossies" - the Fresh Open Source Software Archive  

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

tcrypt-compat-test  (cryptsetup-2.3.6.tar.xz):tcrypt-compat-test  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 14 skipping to change at line 14
[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".." [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
TST_DIR=tcrypt-images TST_DIR=tcrypt-images
MAP=tctst MAP=tctst
PASSWORD="aaaaaaaaaaaa" PASSWORD="aaaaaaaaaaaa"
PASSWORD_HIDDEN="bbbbbbbbbbbb" PASSWORD_HIDDEN="bbbbbbbbbbbb"
PASSWORD_72C="aaaaaaaaaaaabbbbbbbbbbbbccccccccccccddddddddddddeeeeeeeeeeeeffffff ffffff" PASSWORD_72C="aaaaaaaaaaaabbbbbbbbbbbbccccccccccccddddddddddddeeeeeeeeeeeeffffff ffffff"
PIM=1234 PIM=1234
CRYPTSETUP_VALGRIND=../.libs/cryptsetup
CRYPTSETUP_LIB_VALGRIND=../.libs
[ -z "$srcdir" ] && srcdir="." [ -z "$srcdir" ] && srcdir="."
function remove_mapping() function remove_mapping()
{ {
[ -b /dev/mapper/$MAP ] && dmsetup remove --retry $MAP [ -b /dev/mapper/$MAP ] && dmsetup remove --retry $MAP
[ -b /dev/mapper/"$MAP"_1 ] && dmsetup remove --retry "$MAP"_1 [ -b /dev/mapper/"$MAP"_1 ] && dmsetup remove --retry "$MAP"_1
[ -b /dev/mapper/"$MAP"_2 ] && dmsetup remove --retry "$MAP"_2 [ -b /dev/mapper/"$MAP"_2 ] && dmsetup remove --retry "$MAP"_2
rm -rf $TST_DIR
} }
function fail() function fail()
{ {
[ -n "$1" ] && echo "$1" [ -n "$1" ] && echo "$1"
echo " [FAILED]" echo " [FAILED]"
echo "FAILED backtrace:" echo "FAILED backtrace:"
while caller $frame; do ((frame++)); done while caller $frame; do ((frame++)); done
remove_mapping remove_mapping
exit 2 exit 2
} }
function skip() function skip()
{ {
[ -n "$1" ] && echo "$1" [ -n "$1" ] && echo "$1"
echo "Test skipped." echo "Test skipped."
remove_mapping
exit 77 exit 77
} }
function test_one() # cipher mode keysize rm_pattern function test_one() # cipher mode keysize rm_pattern
{ {
$CRYPTSETUP benchmark -c "$1-$2" -s "$3" >/dev/null 2>&1 $CRYPTSETUP benchmark -c "$1-$2" -s "$3" >/dev/null 2>&1
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo "$1-$2 [N/A]" echo "$1-$2 [N/A]"
IMGS=$(ls $TST_DIR/[tv]c* | grep "$4") IMGS=$(ls $TST_DIR/[tv]c* | grep "$4")
[ -n "$IMGS" ] && rm $IMGS [ -n "$IMGS" ] && rm $IMGS
skipping to change at line 102 skipping to change at line 107
test_one des3_ede cbc 192 des3_ede test_one des3_ede cbc 192 des3_ede
test_one cast5 cbc 128 cast5 test_one cast5 cbc 128 cast5
test_one camellia xts 512 camellia test_one camellia xts 512 camellia
test_one kuznyechik xts 512 kuznyechik test_one kuznyechik xts 512 kuznyechik
ls $TST_DIR/[tv]c* >/dev/null 2>&1 || skip "No remaining images." ls $TST_DIR/[tv]c* >/dev/null 2>&1 || skip "No remaining images."
} }
function valgrind_setup()
{
which valgrind >/dev/null 2>&1 || fail "Cannot find valgrind."
[ ! -f $CRYPTSETUP_VALGRIND ] && fail "Unable to get location of cryptset
up executable."
export LD_LIBRARY_PATH="$CRYPTSETUP_LIB_VALGRIND:$LD_LIBRARY_PATH"
}
function valgrind_run()
{
INFOSTRING="$(basename ${BASH_SOURCE[1]})-line-${BASH_LINENO[0]}" ./valg.
sh ${CRYPTSETUP_VALGRIND} "$@"
}
export LANG=C export LANG=C
[ ! -d $TST_DIR ] && tar xJf $srcdir/tcrypt-images.tar.xz --no-same-owner [ ! -d $TST_DIR ] && tar xJf $srcdir/tcrypt-images.tar.xz --no-same-owner
[ -n "$VALG" ] && valgrind_setup && CRYPTSETUP=valgrind_run
test_required test_required
echo "HEADER CHECK" echo "HEADER CHECK"
for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do
echo -n " $file" echo -n " $file"
PIM_OPT="" PIM_OPT=""
[[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM" [[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM"
SYS_OPT="" SYS_OPT=""
[[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system" [[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system"
echo $PASSWORD | $CRYPTSETUP tcryptDump --veracrypt $SYS_OPT $PIM_OPT $fi echo $PASSWORD | $CRYPTSETUP tcryptDump $SYS_OPT $PIM_OPT $file >/dev/nul
le >/dev/null || fail l || fail
if [[ $file =~ .*-sha512-xts-aes$ ]] ; then
echo $PASSWORD | $CRYPTSETUP tcryptDump $SYS_OPT $PIM_OPT -h sha5
12 -c aes $file >/dev/null || fail
echo $PASSWORD | $CRYPTSETUP tcryptDump $SYS_OPT $PIM_OPT -h xxxx
$file 2>/dev/null && fail
echo $PASSWORD | $CRYPTSETUP tcryptDump $SYS_OPT $PIM_OPT -h sha5
12 -c xxx $file 2>/dev/null && fail
fi
echo " [OK]"
done
echo "HEADER CHECK (TCRYPT only)"
for file in $(ls $TST_DIR/vc_* $TST_DIR/vcpim_*) ; do
echo -n " $file"
PIM_OPT=""
[[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM"
echo $PASSWORD | $CRYPTSETUP tcryptDump --disable-veracrypt $PIM_OPT $fil
e >/dev/null 2>&1 && fail
echo " [OK]" echo " [OK]"
done done
echo "HEADER CHECK (HIDDEN)" echo "HEADER CHECK (HIDDEN)"
for file in $(ls $TST_DIR/[tv]c_*-hidden) ; do for file in $(ls $TST_DIR/[tv]c_*-hidden) ; do
echo -n " $file (hidden)" echo -n " $file (hidden)"
echo $PASSWORD_HIDDEN | $CRYPTSETUP tcryptDump --tcrypt-hidden --veracryp t $file >/dev/null || fail echo $PASSWORD_HIDDEN | $CRYPTSETUP tcryptDump --tcrypt-hidden $file >/de v/null || fail
echo " [OK]" echo " [OK]"
done done
echo "HEADER KEYFILES CHECK" echo "HEADER KEYFILES CHECK"
for file in $(ls $TST_DIR/[tv]ck_*) ; do for file in $(ls $TST_DIR/[tv]ck_*) ; do
echo -n " $file" echo -n " $file"
PWD=$PASSWORD PWD=$PASSWORD
[[ $file =~ vck_1_nopw.* ]] && PWD="" [[ $file =~ vck_1_nopw.* ]] && PWD=""
[[ $file =~ vck_1_pw72.* ]] && PWD=$PASSWORD_72C [[ $file =~ vck_1_pw72.* ]] && PWD=$PASSWORD_72C
echo $PWD | $CRYPTSETUP tcryptDump --veracrypt -d $TST_DIR/keyfile1 -d $T ST_DIR/keyfile2 $file >/dev/null || fail echo $PWD | $CRYPTSETUP tcryptDump -d $TST_DIR/keyfile1 -d $TST_DIR/keyfi le2 $file >/dev/null || fail
echo " [OK]" echo " [OK]"
done done
if [ $(id -u) != 0 ]; then if [ $(id -u) != 0 ]; then
echo "WARNING: You must be root to run activation part of test, test skip ped." echo "WARNING: You must be root to run activation part of test, test skip ped."
remove_mapping
exit 0 exit 0
fi fi
echo "ACTIVATION FS UUID CHECK" echo "ACTIVATION FS UUID CHECK"
for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do for file in $(ls $TST_DIR/[tv]c_* $TST_DIR/vcpim_* $TST_DIR/sys_[tv]c_*) ; do
echo -n " $file" echo -n " $file"
PIM_OPT="" PIM_OPT=""
[[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM" [[ $file =~ vcpim.* ]] && PIM_OPT="--veracrypt-pim $PIM"
SYS_OPT="" SYS_OPT=""
[[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system" [[ $file =~ sys_.* ]] && SYS_OPT="--tcrypt-system"
out=$(echo $PASSWORD | $CRYPTSETUP tcryptOpen --veracrypt $SYS_OPT $PIM_O PT -r $file $MAP 2>&1) out=$(echo $PASSWORD | $CRYPTSETUP tcryptOpen $SYS_OPT $PIM_OPT -r $file $MAP 2>&1)
ret=$? ret=$?
[ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT legacy mode" ) && ec ho " [N/A]" && continue [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT legacy mode" ) && ec ho " [N/A]" && continue
[ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT compatible mapping" ) && echo " [N/A]" && continue [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT compatible mapping" ) && echo " [N/A]" && continue
[ $ret -ne 0 ] && fail [ $ret -ne 0 ] && fail
$CRYPTSETUP status $MAP >/dev/null || fail $CRYPTSETUP status $MAP >/dev/null || fail
$CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail $CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail
UUID=$(lsblk -n -o UUID /dev/mapper/$MAP) UUID=$(lsblk -n -o UUID /dev/mapper/$MAP)
$CRYPTSETUP remove $MAP || fail $CRYPTSETUP remove $MAP || fail
[ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed." [ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed."
echo " [OK]" echo " [OK]"
done done
echo "ACTIVATION FS UUID (HIDDEN) CHECK" echo "ACTIVATION FS UUID (HIDDEN) CHECK"
for file in $(ls $TST_DIR/[tv]c_*-hidden) ; do for file in $(ls $TST_DIR/[tv]c_*-hidden) ; do
echo -n " $file" echo -n " $file"
out=$(echo $PASSWORD_HIDDEN | $CRYPTSETUP tcryptOpen --veracrypt -r $file $MAP --tcrypt-hidden 2>&1) out=$(echo $PASSWORD_HIDDEN | $CRYPTSETUP tcryptOpen -r $file $MAP --tcry pt-hidden 2>&1)
ret=$? ret=$?
[ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT legacy mode" ) && ec ho " [N/A]" && continue [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT legacy mode" ) && ec ho " [N/A]" && continue
[ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT compatible mapping" ) && echo " [N/A]" && continue [ $ret -eq 1 ] && ( echo "$out" | grep -q -e "TCRYPT compatible mapping" ) && echo " [N/A]" && continue
[ $ret -ne 0 ] && fail [ $ret -ne 0 ] && fail
UUID=$(lsblk -n -o UUID /dev/mapper/$MAP) UUID=$(lsblk -n -o UUID /dev/mapper/$MAP)
$CRYPTSETUP remove $MAP || fail $CRYPTSETUP remove $MAP || fail
[ "$UUID" != "CAFE-BABE" ] && fail "UUID check failed." [ "$UUID" != "CAFE-BABE" ] && fail "UUID check failed."
echo " [OK]" echo " [OK]"
done done
remove_mapping
exit 0
 End of changes. 12 change blocks. 
6 lines changed or deleted 47 lines changed or added

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