Skip to content

Commit

Permalink
src: load OpenSSL 3.0 Legacy provider
Browse files Browse the repository at this point in the history
Load OpenSSL 3.0 Legacy provider if OpenSSL major version isn't below 3
to be inline with older OpenSSL major versions and support the default
hashFunction MD4 of webpack.

Fixes: nodejs#40948
Refs: https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html
Refs: https://webpack.js.org/plugins/hashed-module-ids-plugin/
  • Loading branch information
herbrechtsmeier committed Mar 11, 2022
1 parent 5386c6a commit 6b9ad77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crypto/crypto_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ void InitCryptoOnce() {
const char* conf = per_process::cli_options->openssl_config.c_str();
OPENSSL_INIT_set_config_filename(settings, conf);
}
else
OSSL_PROVIDER* legacy_provider = OSSL_PROVIDER_load(nullptr, "legacy");
if (legacy_provider == nullptr) {
fprintf(stderr, "Unable to load legacy provider.\n");
}
#endif

OPENSSL_init_ssl(0, settings);
Expand Down

0 comments on commit 6b9ad77

Please sign in to comment.