aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2016-09-09 18:11:02 +0100
committerMagnus Henoch <[email protected]>2016-09-28 15:09:42 +0100
commit481be8b29d75570cf2b60f86f2e4ead79ceea2bb (patch)
tree6912956b2ec95cc725f6db3c204e7031f2e844f7
parent01222faf161cf656062144d01d0f93146215736b (diff)
downloadotp-481be8b29d75570cf2b60f86f2e4ead79ceea2bb.tar.gz
otp-481be8b29d75570cf2b60f86f2e4ead79ceea2bb.tar.bz2
otp-481be8b29d75570cf2b60f86f2e4ead79ceea2bb.zip
Skip FIPS tests if we cannot enable FIPS mode
Even if Erlang/OTP has been built with --enable-fips, it's possible that the OpenSSL library we're linked to doesn't support FIPS mode. In that case, it will fail to enable it at run time. Let's handle that in crypto_SUITE, by skipping the tests instead of failing.
-rw-r--r--lib/crypto/test/blowfish_SUITE.erl10
-rw-r--r--lib/crypto/test/crypto_SUITE.erl10
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/crypto/test/blowfish_SUITE.erl b/lib/crypto/test/blowfish_SUITE.erl
index c45aae6916..a78f8fe39a 100644
--- a/lib/crypto/test/blowfish_SUITE.erl
+++ b/lib/crypto/test/blowfish_SUITE.erl
@@ -119,9 +119,13 @@ init_per_group(fips, Config) ->
enabled ->
Config;
not_enabled ->
- true = crypto:enable_fips_mode(true),
- enabled = crypto:info_fips(),
- Config;
+ case crypto:enable_fips_mode(true) of
+ true ->
+ enabled = crypto:info_fips(),
+ Config;
+ false ->
+ {skip, "Failed to enable FIPS mode"}
+ end;
not_supported ->
{skip, "FIPS mode not supported"}
end;
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index ec8c157d37..02b25ce62f 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -197,9 +197,13 @@ init_per_group(fips, Config) ->
enabled ->
FIPSConfig;
not_enabled ->
- true = crypto:enable_fips_mode(true),
- enabled = crypto:info_fips(),
- FIPSConfig;
+ case crypto:enable_fips_mode(true) of
+ true ->
+ enabled = crypto:info_fips(),
+ FIPSConfig;
+ false ->
+ {skip, "Failed to enable FIPS mode"}
+ end;
not_supported ->
{skip, "FIPS mode not supported"}
end;