GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support dynamically linking with OpenSSL 3.0 by danbev · Pull Request #37669 · nodejs/node

Conversation

@danbev

@danbev danbev commented Mar 9, 2021

Copy link
Copy Markdown
Contributor

This PR enables node to dynamically link against OpenSSL 3.0.

The motivation for opening this PR even though OpenSSL 3.0 has not been released yet is to
allow a nightly CI job to be created. This will allow us stay on top of changes required for
OpenSSL 3.0, and also to make sure that changes to node crypto do not cause issues when
linking to OpenSSL 3.0.

While most changes have been in tests, there have been updates to src/crypto as well.

Refs: #29817


Steps to build and link

During development we have been building OpenSSL upstream and linking against that and used the following commands.

Configure and build OpenSSL

We specify an prefix where this build will be installed into. This path will later be used when configuring Node's build:

$ ./config -Werror --strict-warnings --debug --prefix=/path/openssl_build_master linux-x86_64
$ make -j8 install_sw 

Configure and build Node.js

The following will configure Node to link against OpenSSl 3.0 that was configured
and built in the previous step.

$ ./configure --shared-openssl --shared-openssl-libpath=/path/openssl_build_master/lib --shared-openssl-includes=/path/openssl_build_master/include --shared-openssl-libname=crypto,ssl
$ make -j8 test   

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with eyes emoji
All reactions
  • 👀 1 reaction
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Mar 9, 2021
@nodejs-github-bot

nodejs-github-bot commented Mar 9, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36560/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Mar 9, 2021
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Mar 9, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36563/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 9, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36565/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax reviewed Mar 9, 2021
View reviewed changes
Comment thread src/crypto/crypto_keys.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/crypto/crypto_sig.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36579/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36583/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36585/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36593/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danbev
danbev force-pushed the dynamically-link-openssl-3.0 branch from 28f2c9b to 518e678 Compare March 11, 2021 11:40
@nodejs-github-bot

nodejs-github-bot commented Mar 11, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36619/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson
mhdawson approved these changes Mar 11, 2021
View reviewed changes

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@danbev
danbev force-pushed the dynamically-link-openssl-3.0 branch from 518e678 to 7da5860 Compare March 15, 2021 07:55
@nodejs-github-bot

nodejs-github-bot commented Mar 15, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36713/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danbev added 13 commits March 15, 2021 16:35
@danbev
src: fix crypto_hkdf.cc compilation error
a88e77a
Currently there are three compilation errors generated for
crypto_hkdf.cc:
./src/crypto/crypto_hkdf.cc:
In static member function ‘static bool
node::crypto::HKDFTraits::DeriveBits(node::Environment*,
    const node::crypto::HKDFConfig&, node::crypto::ByteSource*)’:
../src/crypto/crypto_hkdf.cc:113:24: error:
invalid conversion from ‘const char*’ to ‘const unsigned char*’
[-fpermissive]
  113 |         params.salt.get(),
      |         ~~~~~~~~~~~~~~~^~
      |                        |
      |                        const char*
In file included from ../src/crypto/crypto_util.h:18,
                 from ../src/crypto/crypto_keys.h:6,
                 from ../src/crypto/crypto_hkdf.h:6,
                 from ../src/crypto/crypto_hkdf.cc:1:
/openssl_build_master/include/openssl/kdf.h:130:54: note:
initializing argument 2 of ‘int EVP_PKEY_CTX_set1_hkdf_salt(
EVP_PKEY_CTX*, const unsigned char*, int)’
  130 |    const unsigned char *salt, int saltlen);
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~
@danbev
build: add OPENSSL_API_COMPAT macro
3d9a5e5
This commit adds the OPENSSL_API_COMPAT macro and sets it to version
1.0.0 of OpenSSL when linking with a shared OpenSSL library.

The motivation for this is that when linking against OpenSSL 3.x there
are a lot of deprecation warnings and this allows them to be avoided.
When we later upgrade the code base to 3.x this value can then be
updated.
@danbev
test: add hasOpenSSL3 constant
a8d117c
This commit adds a constant to identify if the version of OpenSSl is
3 or above.

The motivation for this is it allows for checking this value in tests
to make sure that they work with OpenSSL 3.x, and also with earlier
versions.
@danbev
test: fix diffie-hellman 'module to small' failures
2a68e7b
This commit fixes a number of test failures reported when using OpenSSL
3.0, for example:

Error: error:0500007E:Diffie-Hellman routines::modulus too small

Check have been added for OpenSSL 3 and use the larger sizes only for
OpenSSL 3.0 as these sizes seem to cause timeouts when using
OpenSSL 1.1.1.
@danbev
test: add OpenSSL3 error message check test-tls-key-mismatch.js
dbd2206
@danbev
test: add OpenSSL3 error message check test-tls-client-renegotiation-…
b8e7c2d
…13.js
@danbev
test: add OpenSSL3 error message check test-crypto-stream.js
b1b268b
@danbev
test: add OpenSSL3 specific version regex test-process-versions.js
5ecbb48
@danbev
test: add OpenSSL3 error message check test-crypto-private-decrypt-gh…
470fc73
…32240.js
@danbev
test: add OpenSSL3 error message check test-tls-alert-handling.js
80834e2
@danbev
test: add OpenSSL3 error message check test-crypto-padding.js
d6eae6d
@danbev
test: add OpenSSL3 error message check test-crypto-sign-verify.js
e27bde8
@danbev
test: add OpenSSL3 error message check test-crypto-key-objects.js
f879b9c
danbev added 7 commits March 15, 2021 16:37
@danbev
test: remove OpenSSL3 specific sizes test-crypto-keygen.js
4aff4cb
@danbev
test: add OpenSSL3 check for empty passphrase test test-crypto-keygen.js
7d59871
@danbev
test: add OpenSSL 3.0 checks in test-crypto-dh-stateless.js
d92e224
@danbev
src: use EVP_default_properties_is_fips_enabled
ec3237a
This commit adds a macro check for OpenSSL 3 and used
EVP_default_properties_is_fips_enabled instead of FIPS_mode which has
been removed in OpenSSL 3.
@danbev
test: add OpenSSL 3.x checks to test-tls-min-max-version.js
8efd22a
@danbev
src: aquire mutex lock in ManagedEVPPKey::operator=
23b653f
This commit aquires the Mutex in ManagedEVPPKey::operator= to avoid
multiple threads updating the underlying EVP_PKEY in OpenSSL 3.0.
There are additional changes to the code to avoid dead locks, making
sure to release the lock before aquiring a new lock.

Refs: nodejs@79d44baae2
@danbev
src: use const for EVP_PKEY legacy function calls
6b8c504
This commit add const to EC_KEY, DSA, RSA pointer to avoid compilation
errors when linking against OpenSSL 3.0.

Refs: openssl/openssl@7bc0fdd
@danbev
danbev force-pushed the dynamically-link-openssl-3.0 branch from 7da5860 to 6b8c504 Compare March 15, 2021 17:20
@nodejs-github-bot

nodejs-github-bot commented Mar 15, 2021

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/36725/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danbev

danbev commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

Re-run of failing node-test-linux-linked-debug ✔️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danbev added a commit that referenced this pull request Mar 16, 2021
@danbev
src,test: support dynamically linking OpenSSL 3.0
640fe94
This commit enables node to dynamically link against OpenSSL 3.0.

The motivation for opening this PR even though OpenSSL 3.0 has not been
released yet is to allow a nightly CI job to be created. This will
allow us stay on top of changes required for OpenSSL 3.0, and also to
make sure that changes to node crypto do not cause issues when linking
to OpenSSL 3.0.

PR-URL: #37669
Refs: #29817
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@danbev

danbev commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

Landed in 640fe94.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danbev danbev closed this Mar 16, 2021
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
@danbev @danielleadams
src,test: support dynamically linking OpenSSL 3.0
bcbdcfc
This commit enables node to dynamically link against OpenSSL 3.0.

The motivation for opening this PR even though OpenSSL 3.0 has not been
released yet is to allow a nightly CI job to be created. This will
allow us stay on top of changes required for OpenSSL 3.0, and also to
make sure that changes to node crypto do not cause issues when linking
to OpenSSL 3.0.

PR-URL: #37669
Refs: #29817
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@danielleadams danielleadams mentioned this pull request Mar 16, 2021
v15.12.0 proposal #37766
Merged
danielleadams pushed a commit that referenced this pull request Mar 16, 2021
@danbev @danielleadams
src,test: support dynamically linking OpenSSL 3.0
30c62de
This commit enables node to dynamically link against OpenSSL 3.0.

The motivation for opening this PR even though OpenSSL 3.0 has not been
released yet is to allow a nightly CI job to be created. This will
allow us stay on top of changes required for OpenSSL 3.0, and also to
make sure that changes to node crypto do not cause issues when linking
to OpenSSL 3.0.

PR-URL: #37669
Refs: #29817
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@danbev danbev mentioned this pull request Mar 22, 2021
CI job for OpenSSL 3.0 nodejs/build#2584
Closed
codebytere added a commit to electron/electron that referenced this pull request May 20, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
5ed05eb
nodejs/node#37669
@targos targos added the dont-land-on-v14.x label May 30, 2021
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
86a8ec1
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
bca21fb
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 2, 2021
@codebytere
test: disable test-tls-getprotocol
a7737cf
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 2, 2021
@codebytere
test: disable test-tls-getprotocol
32ba704
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 2, 2021
@codebytere
test: disable test-tls-getprotocol
7c3feb7
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 8, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
54c6389
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 8, 2021
@codebytere
test: disable test-tls-getprotocol
21f7141
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 9, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
577cf84
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 9, 2021
@codebytere
test: disable test-tls-getprotocol
e015b91
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 10, 2021
@codebytere
src,test: support dynamically linking with OpenSSL 3.0
3a9b7ac
nodejs/node#37669
codebytere added a commit to electron/electron that referenced this pull request Jun 10, 2021
@codebytere
test: disable test-tls-getprotocol
3c2c9a4
nodejs/node#37669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax left review comments
@jasnell jasnell jasnell approved these changes
+1 more reviewer
@mhdawson mhdawson mhdawson approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@danbev @nodejs-github-bot @jasnell @addaleax @mhdawson @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.