diff options
author | Milan Broz <gmazyland@gmail.com> | 2011-03-22 20:51:50 +0000 |
---|---|---|
committer | Milan Broz <gmazyland@gmail.com> | 2011-03-22 20:51:50 +0000 |
commit | 2072adf7054606ad826807686fe4b71ecc55866b (patch) | |
tree | 8a4e4b9313ee16cefc47f274c09a1c912bba919b /tests | |
parent | 49ea1b69fe4b53777e4c3ac35151f7fcaa0400e6 (diff) | |
download | cryptsetup-2072adf7054606ad826807686fe4b71ecc55866b.tar.gz cryptsetup-2072adf7054606ad826807686fe4b71ecc55866b.tar.bz2 cryptsetup-2072adf7054606ad826807686fe4b71ecc55866b.zip |
Also support --skip option for loopaesOpen.
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@481 36d66b0a-2a48-0410-832c-cd162a569da5
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/loopaes-test | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/loopaes-test b/tests/loopaes-test index 603f2f4..6c3b596 100755 --- a/tests/loopaes-test +++ b/tests/loopaes-test @@ -60,16 +60,26 @@ function check_exists() [ -b /dev/mapper/$DEV_NAME ] || fail } +function get_offset_params() # $offset +{ + offset=$1 + if [ "${offset:0:1}" = "@" ] ; then + echo "-o $((${offset:1} / 512)) -p 0" + else + echo "-o $((offset / 512))" + fi +} + function get_expsum() # $offset { case $1 in 0) echo "31e00e0e4c233c89051cd748122fde2c98db0121ca09ba93a3820817ea037bc5" ;; - 8192) + @8192 | 8192) echo "bfd94392d1dd8f5d477251d21b3c736e177a4945cd4937847fc7bace82996aed" ;; - 8388608) + @8388608 | 8388608) echo "33838fe36928a929bd7971bed7e82bd426c88193fcd692c2e6f1b9c9bfecd4d6" ;; *) fail @@ -84,8 +94,8 @@ function check_sum() # $key $keysize $offset sync dmremove $DEV_NAME - EXPSUM=$(get_expsum $offset) - $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $2 --key-file $1 -o $3 >/dev/null 2>&1 + EXPSUM=$(get_expsum $3) + $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $2 --key-file $1 $(get_offset_params $offset) >/dev/null 2>&1 ret=$? VSUM=$(sha256sum /dev/mapper/$DEV_NAME | cut -d' ' -f 1) if [ $ret -eq 0 -a "$VSUM" = "$EXPSUM" ] ; then @@ -136,16 +146,15 @@ check_version || skip "Probably old kernel, test skipped." # loop-AES tests KEY_SIZES="128 256" KEY_FILES="$KEYv1 $KEYv2 $KEYv3" -DEV_OFFSET="0 8192 8388608" +DEV_OFFSET="0 8192 @8192 8388608 @8388608" for key_size in $KEY_SIZES ; do for key in $KEY_FILES ; do for offset in $DEV_OFFSET ; do - offset_sec=$(($offset / 512)) prepare "Open loop-AES $key / AES-$key_size / offset $offset" - $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $key_size --key-file $key -o $offset_sec || fail + $CRYPTSETUP loopaesOpen $LOOPDEV $DEV_NAME -s $key_size --key-file $key $(get_offset_params $offset) || fail check_exists - check_sum $key $key_size $offset_sec + check_sum $key $key_size $offset $CRYPTSETUP loopaesClose $DEV_NAME || fail check_sum_losetup $key AES$key_size $offset done |