diff --git a/crypto/rsa_extra/rsa_test.cc b/crypto/rsa_extra/rsa_test.cc index 4fb628be3fb..dc1b9877018 100644 --- a/crypto/rsa_extra/rsa_test.cc +++ b/crypto/rsa_extra/rsa_test.cc @@ -1198,18 +1198,13 @@ TEST(RSATest, KeygenFailOnce) { // GTEST issue: https://github.com/google/googletest/issues/1496. #if !defined(OPENSSL_ANDROID) -static bool set_env(const std::string& name, const std::string& value) { -#if defined(OPENSSL_WINDOWS) - return SetEnvironmentVariableA(name.c_str(), value.c_str()) != 0; -#else - return setenv(name.c_str(), value.c_str(), 1) == 0; -#endif -} - // In the case of a FIPS build, expect abort() when |RSA_generate_key_fips| // fails. TEST(RSADeathTest, KeygenFailAndDie) { - ASSERT_TRUE(set_env("BORINGSSL_FIPS_BREAK_TEST", "RSA_PWCT")); + const char *const value = getenv("BORINGSSL_FIPS_BREAK_TEST"); + if (!value || strcmp(value, "RSA_PWCT") != 0) { + GTEST_SKIP() << "Skipping BORINGSSL_FIPS_BREAK_TESTS RSA_PWCT Test."; + } // Test that all supported key lengths abort when PWCTs fail. for (const size_t bits : {2048, 3072, 4096}) { diff --git a/tests/ci/run_fips_tests.sh b/tests/ci/run_fips_tests.sh index a5d555d700f..f722ee3e097 100755 --- a/tests/ci/run_fips_tests.sh +++ b/tests/ci/run_fips_tests.sh @@ -32,7 +32,11 @@ if static_linux_supported || static_openbsd_supported; then fips_build_and_test -DCMAKE_BUILD_TYPE=Release echo "Testing AWS-LC static breakable release build" - fips_build_and_test -DFIPS=1 -DCMAKE_C_FLAGS="-DBORINGSSL_FIPS_BREAK_TESTS" + run_build -DFIPS=1 -DCMAKE_C_FLAGS="-DBORINGSSL_FIPS_BREAK_TESTS" + export BORINGSSL_FIPS_BREAK_TEST="RSA_PWCT" + ${BUILD_ROOT}/crypto/crypto_test --gtest_filter="RSADeathTest.KeygenFailAndDie" + unset BORINGSSL_FIPS_BREAK_TEST + cd $SRC_ROOT MODULE_HASH=$(./util/fipstools/test-break-kat.sh |\ (egrep "Hash of module was:.* ([a-f0-9]*)" || true))