Skip to content

Commit

Permalink
[TEMP] Temporary for debugging in CI with openssl 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Mar 6, 2025
1 parent defdb2f commit 2c83aa7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 3 additions & 2 deletions deps/ncrypto/ncrypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,10 @@ bool setFipsEnabled(bool enable, CryptoErrorList* errors) {
if (isFipsEnabled() == enable) return true;
ClearErrorOnReturn clearErrorOnReturn(errors);
#if OPENSSL_VERSION_MAJOR >= 3
return EVP_default_properties_enable_fips(nullptr, enable ? 1 : 0) == 1;
return EVP_default_properties_enable_fips(nullptr, enable ? 1 : 0) == 1 &&
EVP_default_properties_is_fips_enabled(nullptr);
#else
return FIPS_mode_set(enable ? 1 : 0) == 1;
return FIPS_mode() == 0 ? FIPS_mode_set(enable ? 1 : 0) == 1 : true;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/crypto_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool ProcessFipsOptions() {
if (per_process::cli_options->enable_fips_crypto ||
per_process::cli_options->force_fips_crypto) {
if (!ncrypto::testFipsEnabled()) return false;
return ncrypto::setFipsEnabled(true, nullptr) && ncrypto::isFipsEnabled();
return ncrypto::setFipsEnabled(true, nullptr);
}
return true;
}
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-crypto-fips.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ function testHelper(stream, args, expectedOutput, cmd, env) {
assert.notStrictEqual(response.length, 0);
if (FIPS_ENABLED !== expectedOutput && FIPS_DISABLED !== expectedOutput) {
// In the case of expected errors just look for a substring.
try {

Check failure on line 52 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 6 spaces but found 0
assert.ok(response.includes(expectedOutput));

Check failure on line 53 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 6
} catch (err) {

Check failure on line 54 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 6 spaces but found 0
console.log('-----------------------------');

Check failure on line 55 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log('Actual output:');

Check failure on line 56 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log(response);

Check failure on line 57 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log('-----------------------------');

Check failure on line 58 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log('Assertion error:');

Check failure on line 59 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log(err.stack);

Check failure on line 60 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
console.log('-----------------------------');

Check failure on line 61 in test/parallel/test-crypto-fips.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected indentation of 8 spaces but found 2
throw err;
}
} else {
const getFipsValue = Number(response);
if (!Number.isNaN(getFipsValue))
Expand Down

0 comments on commit 2c83aa7

Please sign in to comment.