Add --without-activation option for luksOpen (check passphrase only).
[platform/upstream/cryptsetup.git] / tests / align-test
index 57d8c07..a764a44 100755 (executable)
@@ -43,20 +43,34 @@ format() # key_bits expected [forced]
 {
        if [ -z "$3" ] ; then
                echo -n "Formatting using topology info ($1 bits key)...."
-               echo xxx| $CRYPTSETUP luksFormat $DEV -q -i1 -s $1
+               echo xxx| $CRYPTSETUP luksFormat $DEV -q -i1 -c aes-cbc-essiv:sha256 -s $1
        else
                echo -n "Formatting using forced sector alignment $3 ($1 bits key)..."
-               echo xxx| $CRYPTSETUP luksFormat $DEV -q -i1 -s $1 --align-payload=$2
+               echo xxx| $CRYPTSETUP luksFormat $DEV -q -i1 -s $1 -c aes-cbc-essiv:sha256 --align-payload=$2
        fi
 
        ALIGN=$($CRYPTSETUP luksDump $DEV |grep "Payload offset" | sed -e s/.*\\t//)
        #echo "ALIGN = $ALIGN"
 
-       if [ $ALIGN -ne $2 ] ; then
+       if [ -z "$ALIGN" ] ; then
+               fail "FAIL"
+       elif [ $ALIGN -ne $2 ] ; then
                echo "FAIL"
-               echo "Expected alignment differs: expected $2 != detected $ALIGN"
-               fail
+               fail "Expected alignment differs: expected $2 != detected $ALIGN"
        fi
+
+       # test some operation, just in case
+       echo -e "xxx\naaa" | $CRYPTSETUP luksAddKey $DEV -i1 --key-slot 1
+       if [ $? -ne 0 ] ; then
+               echo "FAIL"
+               fail "Keyslot add failed."
+       fi
+       $CRYPTSETUP -q luksKillSlot $DEV 1
+       if [ $? -ne 0 ] ; then
+               echo "FAIL"
+               fail "Keyslot removal failed."
+       fi
+
        echo "PASSED"
 }