Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions tests/crypto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ def _luks_format(self, device, passphrase, keyfile=None, luks_version=BlockDev.C
def _luks2_format(self, device, passphrase, keyfile=None):
return self._luks_format(device, passphrase, keyfile, BlockDev.CryptoLUKSVersion.LUKS2)

def _is_fips_enabled(self):
if not os.path.exists("/proc/sys/crypto/fips_enabled"):
# if the file doesn't exist, we are definitely not in FIPS mode
return False

with open("/proc/sys/crypto/fips_enabled", "r") as f:
enabled = f.read()
return enabled.strip() == "1"

class CryptoNoDevTestCase(CryptoTestCase):
def setUp(self):
# we don't need block devices for this test
Expand Down Expand Up @@ -214,15 +223,6 @@ def test_luks2_format(self):
self.fail("Failed to get pbkdf information from:\n%s %s" % (out, err))
self.assertEqual(m.group(1), "pbkdf2")

def _is_fips_enabled(self):
if not os.path.exists("/proc/sys/crypto/fips_enabled"):
# if the file doesn't exist, we are definitely not in FIPS mode
return False

with open("/proc/sys/crypto/fips_enabled", "r") as f:
enabled = f.read()
return enabled.strip() == "1"

@tag_test(TestTags.SLOW, TestTags.CORE)
def test_luks2_format_pbkdf_options(self):
"""Verify that formatting device as LUKS 2 works"""
Expand Down Expand Up @@ -704,8 +704,7 @@ class CryptoTestEscrow(CryptoTestCase):
def setUp(self):
# I am not able to generate a self-signed certificate that would work in FIPS
# so let's just skip this for now
fips = read_file("/proc/sys/crypto/fips_enabled")
if int(fips) == 1:
if self._is_fips_enabled():
self.skipTest("Skipping escrow tests in FIPS mode")

super(CryptoTestEscrow, self).setUp()
Expand Down
2 changes: 1 addition & 1 deletion tests/skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@
- test: mdraid_test.MDTestNominateDenominate.test_nominate_denominate
skip_on:
- distro: "centos"
version: "10"
version: ["9", "10"]
reason: "Race condition in denominate with latest mdadm v4.4"