Skip to content

build: v24.22.1 fails with --shared-openssl on OpenSSL 3.0.x: EVP_PKEY_PRIVATE_KEY not declared (deps/ncrypto) #66926

Closed

Description

@dragos-cojocari

Version

v24.22.1 (source tarball from nodejs.org/dist)

Platform

  • Ubuntu 22.04, x86_64
  • System OpenSSL: 3.0.2 (libssl-dev 3.0.2-0ubuntu1.x)
  • Compiler: g++-12 (12.3.0)
  • Python 3.10.12

What steps will reproduce the bug?

curl -fsO https://nodejs.org/dist/v24.22.1/node-v24.22.1.tar.gz
tar zxf node-v24.22.1.tar.gz && cd node-v24.22.1
export CXX=g++-12
./configure --shared-openssl --ninja
make -j$(nproc)

What is the expected behavior?

The build ends successfully. deps/ncrypto/ncrypto.h already guards newer OpenSSL features with OPENSSL_VERSION_PREREQ(3, 0) and OPENSSL_VERSION_PREREQ(3, 2). This suggests that OpenSSL 3.0.x is a supported version for --shared-openssl.

What do you see instead?

The build stops with these errors:

../../deps/ncrypto/ncrypto.cc: In function 'ncrypto::EVPKeyPointer ncrypto::{anonymous}::NewDhPKey(const BIGNUM*, const BIGNUM*, const BIGNUM*, const BIGNUM*)':
../../deps/ncrypto/ncrypto.cc:235:18: error: 'EVP_PKEY_PRIVATE_KEY' was not declared in this scope; did you mean 'EVP_PKEY_PUBLIC_KEY'?
../../deps/ncrypto/ncrypto.cc:280:18: error: 'EVP_PKEY_PRIVATE_KEY' was not declared in this scope; did you mean 'EVP_PKEY_PUBLIC_KEY'?
../../deps/ncrypto/ncrypto.cc:3985:18: error: 'EVP_PKEY_PRIVATE_KEY' was not declared in this scope; did you mean 'EVP_PKEY_PUBLIC_KEY'?
ninja: build stopped: subcommand failed.

Additional information

  • The same build works with v24.18.1. That version does not use EVP_PKEY_PRIVATE_KEY in deps/ncrypto/ncrypto.cc. v22.23.4 does not use it either.
  • The bundled OpenSSL in deps/openssl defines the macro in evp.h:
    #define EVP_PKEY_PRIVATE_KEY \
        (EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PRIVATE_KEY)
    OpenSSL 3.0.2 has EVP_PKEY_KEY_PARAMETERS, EVP_PKEY_PUBLIC_KEY, EVP_PKEY_KEYPAIR and OSSL_KEYMGMT_SELECT_PRIVATE_KEY. It does not have EVP_PKEY_PRIVATE_KEY.
  • Workaround: this compatibility define at the top of deps/ncrypto/ncrypto.cc fixes the build:
    #ifndef EVP_PKEY_PRIVATE_KEY
    #define EVP_PKEY_PRIVATE_KEY (EVP_PKEY_KEY_PARAMETERS | OSSL_KEYMGMT_SELECT_PRIVATE_KEY)
    #endif
    With this define, the full build passes on Ubuntu 22.04 (OpenSSL 3.0.2, g++-12). We add it with sed -i '1i ...' deps/ncrypto/ncrypto.cc before ./configure. We did not run the Node test suite on the result.
  • I did not find which release first used the macro. It is between v24.18.1 and v24.22.1.
  • Context: we build Node from source with --shared-openssl on Ubuntu 22.04 base images. We need v24.22.1 for the security fixes in the 2026-10-21 release.

Proposed fix: Guard the use of EVP_PKEY_PRIVATE_KEY in deps/ncrypto/ncrypto.cc, or add the compatibility define in ncrypto.h for OpenSSL versions that lack it.

Activity

  1. richardlau commented on Oct 22, 2026

    @richardlau
    Member

    FWIW we're testing against OpenSSL 3.0.21 in the Jenkins CI and this is passing for v24, so presumably the headers were updated in an OpenSSL 3.0.x release between 3.0.2 and 3.0.21.

  2. panva commented on Oct 23, 2026

    @panva
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions