X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fpassword-hash-test;h=0fb58b3bfbe23b10e4cacc953d9dc3479a23ecc7;hb=refs%2Ftags%2Fupstream%2F2.3.3;hp=a03af50538a69b15c29d48538408bb396643b911;hpb=a3777a6b2cde2c7133141474dd4c428220a3e9cc;p=platform%2Fupstream%2Fcryptsetup.git diff --git a/tests/password-hash-test b/tests/password-hash-test index a03af50..0fb58b3 100755 --- a/tests/password-hash-test +++ b/tests/password-hash-test @@ -2,7 +2,8 @@ # check hash processing in create command -CRYPTSETUP=../src/cryptsetup +[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".." +CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup DEV_NAME=dmc_test KEY_FILE=keyfile @@ -10,7 +11,7 @@ DEV2=$DEV_NAME"_x" dmremove() { # device udevadm settle >/dev/null 2>&1 - dmsetup remove $1 >/dev/null 2>&1 + dmsetup remove --retry $1 >/dev/null 2>&1 } cleanup() { @@ -23,7 +24,9 @@ cleanup() { function fail() { echo " $1 [FAILED]" - cleanup 2 + echo "FAILED backtrace:" + while caller $frame; do ((frame++)); done + cleanup 2 } crypt_key() # hash keysize pwd/file name outkey [limit] [offset] @@ -72,7 +75,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset] esac # ignore these cases, not all libs/kernel supports it - if [ "$1" == "ripemd160" -o $2 -gt 256 ] ; then + if [ "$1" != "sha1" -a "$1" != "sha256" ] || [ $2 -gt 256 ] ; then if [ $ret -ne 0 ] ; then echo " [N/A] ($ret, SKIPPED)" return @@ -94,7 +97,7 @@ crypt_key() # hash keysize pwd/file name outkey [limit] [offset] if [ $(id -u) != 0 ]; then echo "WARNING: You must be root to run this test, test skipped." - exit 0 + exit 77 fi dmsetup create $DEV_NAME --table "0 10240 zero" >/dev/null 2>&1 @@ -131,6 +134,7 @@ echo -n -e "0123456789abcdef\n\x01\x00\x03\xff\xff\r\xff\xff\n\r" \ "2352j3rkjhadcfasc823rqaw7e1 3dq sdq3d 2dkjqw3h2=====" >$KEY_FILE KEY_FILE_HEX="303132333435363738396162636465660a010003ffff0dffff0a0d20323335326a33726b6a686164636661736338323372716177376531203364712073647133" + # ignore hash if keyfile is specified crypt_key ripemd160 256 file $KEY_FILE ${KEY_FILE_HEX:0:64} crypt_key sha256 256 file $KEY_FILE ${KEY_FILE_HEX:0:64} @@ -168,4 +172,19 @@ crypt_key sha256 128 pwd "0123456789abcdef" 9f9f5111f7b27a781f1f1ddde5ebc2dd crypt_key sha256 128 pwd "0123456789abcdef" 1be2e452b46d7a0d9656bbb1f768e824 4 crypt_key sha256 128 pwd "0123" 1be2e452b46d7a0d9656bbb1f768e824 4 +# Test list of various hash algorithms +crypt_key sha1 256 pwd "0123456789abcdef" fe5567e8d769550852182cdf69d74bb16dff8e295e4b6077d6d3fc73e7fe33b0 +crypt_key sha224 256 pwd "0123456789abcdef" 7330215f6741fd2bacbd3658681a70f65e2e90a02887989018974ce83775a568 +crypt_key sha256 256 pwd "0123456789abcdef" 9f9f5111f7b27a781f1f1ddde5ebc2dd2b796bfc7365c9c28b548e564176929f +crypt_key sha384 256 pwd "0123456789abcdef" fc6304023487cb6f85ac80e47817760c6b153c02da46c6429649e963b031e525 +crypt_key sha512 256 pwd "0123456789abcdef" 1c043fbe4bca7c7920dae536c680fd44c15d71ec12cd82a2a9491b0043b57f4d +crypt_key ripemd160 256 pwd "0123456789abcdef" edf4e38018cd71dd489b9c1e54b32054eb42dfad9fdcc22d629d756391a24982 +crypt_key whirlpool 256 pwd "0123456789abcdef" b21fc274d47d79ba45f94d67077f0846f75a7acc1a4dc560eacca300179cc142 +crypt_key sha3-224 256 pwd "0123456789abcdef" bbb7d56cc80a8c80e907f7d9240edc0be264aa173266b30918bc1065d59a9388 +crypt_key sha3-256 256 pwd "0123456789abcdef" a5df4caae9fdb5dbacf667075b709a2f30a115c43168af332062b42d4b0da01f +crypt_key sha3-384 256 pwd "0123456789abcdef" 56f351f754c418892eab4009e5f85c8d5436a591014503563e9395b895526413 +crypt_key sha3-512 256 pwd "0123456789abcdef" 59d06155d25dffdb982729de8dce9d7855ca094d8bab8124b347c40668477056 +crypt_key sm3 256 pwd "0123456789abcdef" a34fdd8e843802b31a262dce5b1f501bed68ef81520de14b39657aecffaf8a86 +crypt_key stribog512 256 pwd "0123456789abcdef" ab1284a64c2325c0ad52494e696df9aa9b92e701605a9a1258b58be08e8240ea + cleanup 0