mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-09 18:00:01 +01:00
Speed up tests using faster hash and PBKDF options.
Use faster SHA1 instead of SHA256 in reencryption test and pass fast PBKDF options in mode-test.
This commit is contained in:
committed by
Milan Broz
parent
81c56a8395
commit
395beb635c
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
PS4='$LINENO:'
|
||||
#PS4='$LINENO:'
|
||||
[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
|
||||
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
|
||||
|
||||
@@ -222,7 +222,7 @@ function preparebig() # $1 dev1_siz
|
||||
|
||||
function check_hash_dev() # $1 dev, $2 hash
|
||||
{
|
||||
HASH=$(sha256sum $1 | cut -d' ' -f 1)
|
||||
HASH=$(sha1sum $1 | cut -d' ' -f 1)
|
||||
[ $HASH != "$2" ] && fail "HASH differs (expected: $2) (result $HASH)"
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ function check_hash() # $1 pwd, $2 hash, $3 hdr
|
||||
|
||||
function check_hash_dev_head() # $1 dev, $2 len, $3 hash
|
||||
{
|
||||
local hash=$(dd if=$1 bs=512 count=$2 2>/dev/null | sha256sum | cut -d' ' -f1)
|
||||
local hash=$(dd if=$1 bs=512 count=$2 2>/dev/null | sha1sum | cut -d' ' -f1)
|
||||
[ $hash != "$3" ] && fail "HASH differs (expected: $3) (result $hash)"
|
||||
}
|
||||
|
||||
@@ -855,25 +855,25 @@ export LANG=C
|
||||
# REENCRYPTION tests
|
||||
|
||||
# 28 MiBs of zeros (32MiBs - 4MiB LUKS2 header)
|
||||
HASH1=f8280c81b347b01405277bf9e8bf0685ae8be863ff104797c65b7169f8203fd2
|
||||
HASH1=4da90c0638bd7d29ce3d0ace3df5ee99706c23da
|
||||
# 1 MiB of zeros
|
||||
HASH2=30e14955ebf1352266dc2ff8067e68104607e750abb9d3b36582b8af909fcb58
|
||||
HASH2=3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
|
||||
# 256 MiBs of zeros
|
||||
HASH3=a6d72ac7690f53be6ae46ba88506bd97302a093f7108472bd9efc3cefda06484
|
||||
HASH3=7b91dbdc56c5781edf6c8847b4aa6965566c5c75
|
||||
# 64 MiBs of zeroes
|
||||
HASH4=3b6a07d0d404fab4e23b6d34bc6696a6a312dd92821332385e5af7c01c421351
|
||||
HASH4=44fac4bedde4df04b9572ac665d3ac2c5cd00c7d
|
||||
# 56 MiBs of zeroes
|
||||
HASH5=8afcb7e7189ce4d112fd245eaa60c3cfcf5a5d5e1d6bf4eb85941d73ef8cfbd5
|
||||
HASH5=bcd8ce9b30a43b2dacdf479493c93e167ef60946
|
||||
# 43 MiBs of zeroes
|
||||
HASH6=39f7c6d38af574fe2c90ef400dfaba8ef8edccd11bdac998a3f8143a86837331
|
||||
HASH6=2cf8a5f40a2ab5373c5425d6071da480f1ce08e8
|
||||
# 31 MiBs of zeroes
|
||||
HASH7=18a393d1a505e22ccf3e29effe3005ea8627e4c36b7cca0e53f58121f49b67e1
|
||||
HASH7=7ed56dd14d2841cf169fe503d097be04192666bd
|
||||
# 60 MiBs of zeroes
|
||||
HASH8=cf5ac69ca412f9b3b1a8b8de27d368c5c05ed4b1b6aa40e6c38d9cbf23711342
|
||||
HASH8=233ba936226a3ac499e67babaebd0d4aafb9761a
|
||||
# 240 MiBs of zeroes (256MiBs - 16MiBs default LUKS2 header size)
|
||||
HASH9=17088b031491a37e0ee9e1025a3938f55ee94ae27653370ad2fe5b0b32e35334
|
||||
HASH9=045eebed703cce308e049deb019b877f0445862f
|
||||
# 16 MiBs of zeroes
|
||||
HASH10=080acf35a507ac9849cfcba47dc2ad83e01b75663a516279c8b9d243b719643e
|
||||
HASH10=3b4417fc421cee30a9ad0fd9319220a8dae32da2
|
||||
|
||||
prepare dev_size_mb=32
|
||||
setup_luks2_env
|
||||
|
||||
@@ -8,6 +8,7 @@ DEV_NAME=dmc_test
|
||||
HEADER_IMG=mode-test.img
|
||||
PASSWORD=3xrododenron
|
||||
PASSWORD1=$PASSWORD
|
||||
FAST_PBKDF2="--pbkdf pbkdf2 --pbkdf-force-iterations 1000"
|
||||
|
||||
# cipher-chainmode-ivopts:ivmode
|
||||
CIPHERS="aes twofish serpent"
|
||||
@@ -126,14 +127,14 @@ dmcrypt()
|
||||
echo -n "[n/a]"
|
||||
fi
|
||||
|
||||
echo $PASSWORD | $CRYPTSETUP luksFormat --type luks1 -i 1 -c $1 -s 256 /dev/mapper/$DEV_NAME >/dev/null 2>&1
|
||||
echo $PASSWORD | $CRYPTSETUP luksFormat --type luks1 $FAST_PBKDF2 -c $1 -s 256 /dev/mapper/$DEV_NAME >/dev/null 2>&1
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo -n -e " LUKS1:"
|
||||
echo $PASSWORD | $CRYPTSETUP luksOpen /dev/mapper/$DEV_NAME "$DEV_NAME"_tstdev >/dev/null 2>&1 || fail
|
||||
dmcrypt_check "$DEV_NAME"_tstdev $OUT
|
||||
fi
|
||||
|
||||
echo $PASSWORD | $CRYPTSETUP luksFormat --type luks2 --pbkdf pbkdf2 -i 1 -c $1 -s 256 --offset 8192 /dev/mapper/$DEV_NAME >/dev/null 2>&1
|
||||
echo $PASSWORD | $CRYPTSETUP luksFormat --type luks2 --pbkdf pbkdf2 $FAST_PBKDF2 -c $1 -s 256 --offset 8192 /dev/mapper/$DEV_NAME >/dev/null 2>&1
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo -n -e " LUKS2:"
|
||||
echo $PASSWORD | $CRYPTSETUP luksOpen /dev/mapper/$DEV_NAME "$DEV_NAME"_tstdev >/dev/null 2>&1 || fail
|
||||
|
||||
Reference in New Issue
Block a user