tests: fix fips mode detection contradiction in various tests.

This commit is contained in:
Ondrej Kozina
2024-03-06 13:08:46 +01:00
parent 6525b40a7b
commit 4347a01cce
5 changed files with 10 additions and 10 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"