Commit 456ab38c authored by Milan Broz's avatar Milan Broz

Allow to set CRYPTSETUP_PATH in tests for system installed cryptsetup tools.

Run: make check CRYPTSETUP_PATH=/sbin
parent c71b5c04
#!/bin/bash #!/bin/bash
[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
function pversion() {
if [ ! -x $CRYPTSETUP_PATH/$1 ] ; then
return
fi
echo -n "$CRYPTSETUP_PATH/"
$CRYPTSETUP_PATH/$1 --version
}
echo "Cryptsetup test environment ($(date))" echo "Cryptsetup test environment ($(date))"
uname -a uname -a
...@@ -8,10 +19,10 @@ if [ -f /etc/os-release ] ; then ...@@ -8,10 +19,10 @@ if [ -f /etc/os-release ] ; then
echo "$PRETTY_NAME ($NAME) $VERSION" echo "$PRETTY_NAME ($NAME) $VERSION"
fi fi
[ -x ../cryptsetup ] && ../cryptsetup --version pversion cryptsetup
[ -x ../veritysetup ] && ../veritysetup --version pversion veritysetup
[ -x ../integritysetup ] && ../integritysetup --version pversion integritysetup
[ -x ../cryptsetup-reencrypt ] && ../cryptsetup-reencrypt --version pversion cryptsetup-reencrypt
[ $(id -u) != 0 ] && exit 77 [ $(id -u) != 0 ] && exit 77
......
#!/bin/bash #!/bin/bash
CRYPTSETUP="../cryptsetup" [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV="" DEV=""
DEV_STACKED="luks0xbabe" DEV_STACKED="luks0xbabe"
DEV_NAME="dummyalign" DEV_NAME="dummyalign"
......
#!/bin/bash #!/bin/bash
CRYPTSETUP="../cryptsetup" [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV="" DEV=""
DEV_STACKED="luks0xbabe" DEV_STACKED="luks0xbabe"
DEV_NAME="dummyalign" DEV_NAME="dummyalign"
......
...@@ -3500,6 +3500,11 @@ int main(int argc, char *argv[]) ...@@ -3500,6 +3500,11 @@ int main(int argc, char *argv[])
exit(77); exit(77);
} }
if (getenv("CRYPTSETUP_PATH")) {
printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
exit(77);
}
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i])) if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i]))
_verbose = 1; _verbose = 1;
......
...@@ -1879,6 +1879,11 @@ int main(int argc, char *argv[]) ...@@ -1879,6 +1879,11 @@ int main(int argc, char *argv[])
exit(77); exit(77);
} }
if (getenv("CRYPTSETUP_PATH")) {
printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
exit(77);
}
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i])) if (!strcmp("-v", argv[i]) || !strcmp("--verbose", argv[i]))
_verbose = 1; _verbose = 1;
......
...@@ -304,6 +304,8 @@ run_all() { ...@@ -304,6 +304,8 @@ run_all() {
RUN "$BD_FAIL" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE)) RUN "$BD_FAIL" $1 write_lseek_blockwise $((BSIZE+1)) $BSIZE $((DEVSIZE-BSIZE))
} }
[ -n "$CRYPTSETUP_PATH" ] && skip "Cannot run this test with CRYPTSETUP_PATH set."
which $STRACE > /dev/null 2>&1 || unset STRACE which $STRACE > /dev/null 2>&1 || unset STRACE
test -x $BW_UNIT || skip "Run \"make `basename $BW_UNIT`\" first" test -x $BW_UNIT || skip "Run \"make `basename $BW_UNIT`\" first"
......
#!/bin/bash #!/bin/bash
PS4='$LINENO:' PS4='$LINENO:'
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
CRYPTSETUP_VALGRIND=../.libs/cryptsetup CRYPTSETUP_VALGRIND=../.libs/cryptsetup
CRYPTSETUP_LIB_VALGRIND=../.libs CRYPTSETUP_LIB_VALGRIND=../.libs
......
#!/bin/bash #!/bin/bash
PS4='$LINENO:' PS4='$LINENO:'
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
CRYPTSETUP_VALGRIND=../.libs/cryptsetup CRYPTSETUP_VALGRIND=../.libs/cryptsetup
CRYPTSETUP_LIB_VALGRIND=../.libs CRYPTSETUP_LIB_VALGRIND=../.libs
......
...@@ -893,6 +893,11 @@ static void __attribute__((noreturn)) exit_test(const char *msg, int r) ...@@ -893,6 +893,11 @@ static void __attribute__((noreturn)) exit_test(const char *msg, int r)
int main(__attribute__ ((unused)) int argc, __attribute__ ((unused))char *argv[]) int main(__attribute__ ((unused)) int argc, __attribute__ ((unused))char *argv[])
{ {
if (getenv("CRYPTSETUP_PATH")) {
printf("Cannot run this test with CRYPTSETUP_PATH set.\n");
exit(77);
}
if (crypt_backend_init(NULL)) if (crypt_backend_init(NULL))
exit_test("Crypto backend init error.", EXIT_FAILURE); exit_test("Crypto backend init error.", EXIT_FAILURE);
......
#!/bin/bash #!/bin/bash
CRYPTSETUP="../cryptsetup" [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
MNT_DIR="./mnt_luks" MNT_DIR="./mnt_luks"
DEV_NAME="dummy" DEV_NAME="dummy"
DEV_NAME2="ymmud" DEV_NAME2="ymmud"
......
#!/bin/bash #!/bin/bash
CRYPTSETUP="../cryptsetup" [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV_NAME="discard-t3st" DEV_NAME="discard-t3st"
DEV="" DEV=""
PWD1="93R4P4pIqAH8" PWD1="93R4P4pIqAH8"
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
# #
# Test integritysetup compatibility. # Test integritysetup compatibility.
# #
INTSETUP=../integritysetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
INTSETUP=$CRYPTSETUP_PATH/integritysetup
INTSETUP_VALGRIND=../.libs/integritysetup INTSETUP_VALGRIND=../.libs/integritysetup
INTSETUP_LIB_VALGRIND=../.libs INTSETUP_LIB_VALGRIND=../.libs
......
...@@ -22,7 +22,9 @@ CHKS_DMCRYPT=vk_in_dmcrypt.chk ...@@ -22,7 +22,9 @@ CHKS_DMCRYPT=vk_in_dmcrypt.chk
CHKS_KEYRING=vk_in_keyring.chk CHKS_KEYRING=vk_in_keyring.chk
PWD="aaa" PWD="aaa"
CRYPTSETUP=../cryptsetup
[ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
function remove_mapping() function remove_mapping()
{ {
......
#!/bin/bash #!/bin/bash
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
# try to validate using loop-AES losetup/kernel if available # try to validate using loop-AES losetup/kernel if available
LOSETUP_AES=/losetup-aes.old LOSETUP_AES=/losetup-aes.old
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
# that you are not using old gcrypt with flawed whirlpool # that you are not using old gcrypt with flawed whirlpool
# (see cryptsetup debug output) # (see cryptsetup debug output)
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
TST_DIR=luks1-images TST_DIR=luks1-images
MAP=luks1tst MAP=luks1tst
KEYFILE=keyfile1 KEYFILE=keyfile1
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# #
# Test cryptsetup/authenticated encryption compatibility. # Test cryptsetup/authenticated encryption compatibility.
# #
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV_NAME=dmi_test DEV_NAME=dmi_test
DEV=mode-test.img DEV=mode-test.img
PWD1=nHjJHjI23JK PWD1=nHjJHjI23JK
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
#turn on debug mode by following env. variable _DEBUG=1 #turn on debug mode by following env. variable _DEBUG=1
PS4='$LINENO:' PS4='$LINENO:'
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
CRYPTSETUP_VALGRIND=../.libs/cryptsetup CRYPTSETUP_VALGRIND=../.libs/cryptsetup
CRYPTSETUP_LIB_VALGRIND=../.libs CRYPTSETUP_LIB_VALGRIND=../.libs
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# #
# Test mode compatibility, check input + kernel and cryptsetup cipher status # Test mode compatibility, check input + kernel and cryptsetup cipher status
# #
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV_NAME=dmc_test DEV_NAME=dmc_test
HEADER_IMG=mode-test.img HEADER_IMG=mode-test.img
PASSWORD=3xrododenron PASSWORD=3xrododenron
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# check hash processing in create command # check hash processing in create command
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
DEV_NAME=dmc_test DEV_NAME=dmc_test
KEY_FILE=keyfile KEY_FILE=keyfile
......
#!/bin/bash #!/bin/bash
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
REENC=../cryptsetup-reencrypt CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
REENC=$CRYPTSETUP_PATH/cryptsetup-reencrypt
FAST_PBKDF="--pbkdf-force-iterations 1000" FAST_PBKDF="--pbkdf-force-iterations 1000"
DEV_NAME=reenc9768 DEV_NAME=reenc9768
...@@ -185,7 +186,14 @@ function mount_and_test() { ...@@ -185,7 +186,14 @@ function mount_and_test() {
} }
rm $MNT_DIR/* 2>/dev/null rm $MNT_DIR/* 2>/dev/null
cd $MNT_DIR cd $MNT_DIR
echo $PWD2 | $START_DIR/$REENC $LOOPDEV1 -q --use-fsync --use-directio --write-log $FAST_PBKDF || return 1
if [ "${REENC:0:1}" != "/" ] ; then
MNT_REENC=$START_DIR/$REENC
else
MNT_REENC=$REENC
fi
echo $PWD2 | $MNT_REENC $LOOPDEV1 -q --use-fsync --use-directio --write-log $FAST_PBKDF || return 1
cd $START_DIR cd $START_DIR
umount $MNT_DIR umount $MNT_DIR
echo -n [OK] echo -n [OK]
......
#!/bin/bash #!/bin/bash
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
REENC=../cryptsetup-reencrypt CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
REENC=$CRYPTSETUP_PATH/cryptsetup-reencrypt
FAST_PBKDF_ARGON="--pbkdf-force-iterations 4 --pbkdf-memory 32 --pbkdf-parallel 1" FAST_PBKDF_ARGON="--pbkdf-force-iterations 4 --pbkdf-memory 32 --pbkdf-parallel 1"
FAST_PBKDF_PBKDF2="--pbkdf-force-iterations 1000 --pbkdf pbkdf2" FAST_PBKDF_PBKDF2="--pbkdf-force-iterations 1000 --pbkdf pbkdf2"
DEFAULT_ARGON="argon2i" DEFAULT_ARGON="argon2i"
...@@ -193,7 +194,13 @@ function mount_and_test() { ...@@ -193,7 +194,13 @@ function mount_and_test() {
} }
rm $MNT_DIR/* 2>/dev/null rm $MNT_DIR/* 2>/dev/null
cd $MNT_DIR cd $MNT_DIR
echo $PWD2 | $START_DIR/$REENC $START_DIR/$IMG -q --use-fsync --use-directio --write-log $FAST_PBKDF_ARGON || return 1
if [ "${REENC:0:1}" != "/" ] ; then
MNT_REENC=$START_DIR/$REENC
else
MNT_REENC=$REENC
fi
echo $PWD2 | $MNT_REENC $START_DIR/$IMG -q --use-fsync --use-directio --write-log $FAST_PBKDF_ARGON || return 1
cd $START_DIR cd $START_DIR
umount $MNT_DIR umount $MNT_DIR
echo -n [OK] echo -n [OK]
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# check tcrypt images parsing # check tcrypt images parsing
CRYPTSETUP=../cryptsetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
CRYPTSETUP=$CRYPTSETUP_PATH/cryptsetup
TST_DIR=tcrypt-images TST_DIR=tcrypt-images
MAP=tctst MAP=tctst
PASSWORD="aaaaaaaaaaaa" PASSWORD="aaaaaaaaaaaa"
......
#!/bin/bash #!/bin/bash
VERITYSETUP=../veritysetup [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
VERITYSETUP=$CRYPTSETUP_PATH/veritysetup
VERITYSETUP_VALGRIND=../.libs/veritysetup VERITYSETUP_VALGRIND=../.libs/veritysetup
VERITYSETUP_LIB_VALGRIND=../.libs VERITYSETUP_LIB_VALGRIND=../.libs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment