Skip to content

Commit 2c83aa7

Browse files
committed
[TEMP] Temporary for debugging in CI with openssl 1.1.1
1 parent defdb2f commit 2c83aa7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

deps/ncrypto/ncrypto.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,10 @@ bool setFipsEnabled(bool enable, CryptoErrorList* errors) {
235235
if (isFipsEnabled() == enable) return true;
236236
ClearErrorOnReturn clearErrorOnReturn(errors);
237237
#if OPENSSL_VERSION_MAJOR >= 3
238-
return EVP_default_properties_enable_fips(nullptr, enable ? 1 : 0) == 1;
238+
return EVP_default_properties_enable_fips(nullptr, enable ? 1 : 0) == 1 &&
239+
EVP_default_properties_is_fips_enabled(nullptr);
239240
#else
240-
return FIPS_mode_set(enable ? 1 : 0) == 1;
241+
return FIPS_mode() == 0 ? FIPS_mode_set(enable ? 1 : 0) == 1 : true;
241242
#endif
242243
}
243244

src/crypto/crypto_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ bool ProcessFipsOptions() {
8686
if (per_process::cli_options->enable_fips_crypto ||
8787
per_process::cli_options->force_fips_crypto) {
8888
if (!ncrypto::testFipsEnabled()) return false;
89-
return ncrypto::setFipsEnabled(true, nullptr) && ncrypto::isFipsEnabled();
89+
return ncrypto::setFipsEnabled(true, nullptr);
9090
}
9191
return true;
9292
}

test/parallel/test-crypto-fips.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,18 @@ function testHelper(stream, args, expectedOutput, cmd, env) {
4949
assert.notStrictEqual(response.length, 0);
5050
if (FIPS_ENABLED !== expectedOutput && FIPS_DISABLED !== expectedOutput) {
5151
// In the case of expected errors just look for a substring.
52+
try {
5253
assert.ok(response.includes(expectedOutput));
54+
} catch (err) {
55+
console.log('-----------------------------');
56+
console.log('Actual output:');
57+
console.log(response);
58+
console.log('-----------------------------');
59+
console.log('Assertion error:');
60+
console.log(err.stack);
61+
console.log('-----------------------------');
62+
throw err;
63+
}
5364
} else {
5465
const getFipsValue = Number(response);
5566
if (!Number.isNaN(getFipsValue))

0 commit comments

Comments
 (0)