aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2024-03-06 13:08:46 +0100
committerOndrej Kozina <okozina@redhat.com>2024-03-06 13:08:50 +0100
commit4347a01cce5af36bada81e8382e1e31bfd3619e2 (patch)
treee4312eece36608be8db5dbaef326d680d9dc0780
parent6525b40a7bec47ad0c2f1b3783977248fa24d261 (diff)
downloadcryptsetup-4347a01cce5af36bada81e8382e1e31bfd3619e2.tar.gz
tests: fix fips mode detection contradiction in various tests.
-rwxr-xr-xtests/align-test2
-rwxr-xr-xtests/compat-test6
-rwxr-xr-xtests/compat-test-opal4
-rwxr-xr-xtests/compat-test22
-rwxr-xr-xtests/reencryption-compat-test6
5 files changed, 10 insertions, 10 deletions
diff --git a/tests/align-test b/tests/align-test
index d2932ae4..cc502a8f 100755
--- a/tests/align-test
+++ b/tests/align-test
@@ -292,7 +292,7 @@ format_plain_fail 4096
cleanup
# skip tests using empty passphrase (LUKS1 cipher_null)
-if [ ! fips_mode ]; then
+if ! fips_mode; then
echo "# Offset check: 512B sector drive"
add_device dev_size_mb=16 sector_size=512 num_tgts=1
# |k| expO reqO expected slot offsets
diff --git a/tests/compat-test b/tests/compat-test
index 433beb2a..2dd39d55 100755
--- a/tests/compat-test
+++ b/tests/compat-test
@@ -331,7 +331,7 @@ $CRYPTSETUP -q luksClose $DEV_NAME || fail
$CRYPTSETUP luksHeaderRestore -q $IMG --header-backup-file $HEADER_IMG || fail
# Repeat for V1.0 header - not aligned first keyslot
-if [ ! fips_mode ] ; then
+if ! fips_mode; then
echo $PWD0 | $CRYPTSETUP luksOpen $IMG10 $DEV_NAME || fail
check_exists
ORG_SHA1=$(sha1sum -b /dev/mapper/$DEV_NAME | cut -f 1 -d' ')
@@ -459,7 +459,7 @@ if [ -d /dev/disk/by-uuid ] ; then
$CRYPTSETUP -q luksClose $DEV_NAME || fail
fi
# skip tests using empty passphrase
-if [ ! fips_mode ]; then
+if ! fips_mode; then
# empty keyfile
$CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF_OPT $LOOPDEV $KEYE || fail
$CRYPTSETUP luksOpen -d $KEYE $LOOPDEV $DEV_NAME || fail
@@ -740,7 +740,7 @@ echo $PWDW | $CRYPTSETUP luksResume $DEV_NAME 2>/dev/null && fail
echo $PWD1 | $CRYPTSETUP luksResume $DEV_NAME || fail
$CRYPTSETUP -q luksClose $DEV_NAME || fail
# skip tests using empty passphrase
-if [ ! fips_mode ]; then
+if ! fips_mode; then
echo | $CRYPTSETUP -q luksFormat -c null $FAST_PBKDF_OPT --type luks1 $LOOPDEV || fail
echo | $CRYPTSETUP -q luksOpen $LOOPDEV $DEV_NAME || fail
$CRYPTSETUP luksSuspend $DEV_NAME || fail
diff --git a/tests/compat-test-opal b/tests/compat-test-opal
index 0b8a8802..4cce664a 100755
--- a/tests/compat-test-opal
+++ b/tests/compat-test-opal
@@ -536,7 +536,7 @@ if [ -d /dev/disk/by-uuid ] ; then
$CRYPTSETUP -q luksClose $DEV_NAME || fail
fi
# skip tests using empty passphrases
-if [ ! fips_mode ]; then
+if ! fips_mode; then
# empty passphrase (OPAL admin pin cannot be empty)
echo -e "\n$OPAL2_ADMIN_PIN" | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 --hw-opal $OPAL2_DEV || fail
$CRYPTSETUP luksOpen -d $KEYE $OPAL2_DEV $DEV_NAME || fail
@@ -555,7 +555,7 @@ if [ -d /dev/disk/by-uuid ] ; then
$CRYPTSETUP -q luksClose $DEV_NAME || fail
fi
# skip tests using empty passphrases
-if [ ! fips_mode ]; then
+if ! fips_mode; then
# empty passphrase (OPAL admin pin cannot be empty)
echo -e "\n$OPAL2_ADMIN_PIN" | $CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 --hw-opal-only $OPAL2_DEV || fail
$CRYPTSETUP luksOpen -d $KEYE $OPAL2_DEV $DEV_NAME || fail
diff --git a/tests/compat-test2 b/tests/compat-test2
index b54a509c..96d51602 100755
--- a/tests/compat-test2
+++ b/tests/compat-test2
@@ -630,7 +630,7 @@ if [ -d /dev/disk/by-uuid ] ; then
$CRYPTSETUP -q luksClose $DEV_NAME || fail
fi
# skip tests using empty passphrases
-if [ ! fips_mode ]; then
+if ! fips_mode; then
# empty keyfile
$CRYPTSETUP -q luksFormat $FAST_PBKDF_OPT --type luks2 $LOOPDEV $KEYE || fail
$CRYPTSETUP luksOpen -d $KEYE $LOOPDEV $DEV_NAME || fail
diff --git a/tests/reencryption-compat-test b/tests/reencryption-compat-test
index b23c360f..18a23b1d 100755
--- a/tests/reencryption-compat-test
+++ b/tests/reencryption-compat-test
@@ -328,7 +328,7 @@ ln -s $IMG $DEV_LINK || fail
echo $PWD1 | $REENC $IMG --type luks1 --new --header $DEV_LINK -q $FAST_PBKDF_ARGON 2>/dev/null && fail
$CRYPTSETUP isLUKS $IMG 2>/dev/null && fail
-if [ ! fips_mode ]; then
+if ! fips_mode; then
# well, movin' zeroes :-)
OFFSET=2048
SIZE=$(blockdev --getsz $LOOPDEV1)
@@ -428,7 +428,7 @@ add_scsi_device sector_size=512 dev_size_mb=32 physblk_exp=3
test_logging "[4096/512 sector]" || fail
test_logging_tmpfs || fail
-if [ ! fips_mode ]; then
+if ! fips_mode; then
echo "[10] Removal of encryption"
prepare 8192
echo $PWD1 | $CRYPTSETUP -q luksFormat --type luks1 $FAST_PBKDF $LOOPDEV1 || fail
@@ -493,7 +493,7 @@ if [ "$HAVE_BLKID" -gt 0 ]; then
echo $PWD1 | $REENC --header $IMG_HDR $HEADER_LUKS2_PV -q $FAST_PBKDF --new --type luks1 2>/dev/null && fail
test -f $IMG_HDR && fail
fi
-fi # if [ ! fips_mode ]
+fi # if ! fips_mode
# Only test if the LUKS1 decryption can be resumed with provided --uuid
echo "[14] Resume LUKS1 decryption"