mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
crypto: split OpenSSL 3, BoringSSL, and legacy backends
This separates the native crypto backend paths for OpenSSL >= 3, BoringSSL, and legacy OpenSSL. The OpenSSL >= 3 path now builds with `OPENSSL_API_COMPAT=30000` and `OPENSSL_NO_DEPRECATED`, moving normal crypto/TLS code away from APIs that OpenSSL 3.0.0 marks deprecated. BoringSSL remains on its own branch, and OpenSSL < 3 remains the legacy fallback. The exception is ENGINE support. ENGINE APIs are isolated into a dedicated compatibility target so they can remain available while the JS-facing engine APIs are runtime-deprecated in 27.x. That gives us a clear removal point for 28.x, without letting ENGINE usage leak back into the strict OpenSSL 3 path. The split also makes the eventual OpenSSL 1.1.1 removal easier to reason about. Once support for OpenSSL < 3 is dropped, the legacy branch can be removed in a focused follow-up, possibly targeting 27.x, instead of untangling mixed version guards throughout the crypto implementation. No public crypto or TLS API behavior is intentionally changed. Assisted-by: Codex:gpt-5 Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/64211 Refs: https://github.com/nodejs/node/issues/56733 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
d2c8acd764
commit
195f103e87
23 files changed
+2456
-206
No files matched your search
@@ -39,8 +39,58 @@
|
||||
#if HAVE_OPENSSL
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ssl.h>
|
||||
#if !defined(RSA_PKCS1_PADDING)
|
||||
#define RSA_PKCS1_PADDING 1
|
||||
#endif
|
||||
#if !defined(RSA_SSLV23_PADDING)
|
||||
#define RSA_SSLV23_PADDING 2
|
||||
#endif
|
||||
#if !defined(RSA_NO_PADDING)
|
||||
#define RSA_NO_PADDING 3
|
||||
#endif
|
||||
#if !defined(RSA_PKCS1_OAEP_PADDING)
|
||||
#define RSA_PKCS1_OAEP_PADDING 4
|
||||
#endif
|
||||
#if !defined(RSA_X931_PADDING)
|
||||
#define RSA_X931_PADDING 5
|
||||
#endif
|
||||
#if !defined(RSA_PKCS1_PSS_PADDING)
|
||||
#define RSA_PKCS1_PSS_PADDING 6
|
||||
#endif
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && OPENSSL_VERSION_MAJOR >= 3
|
||||
// OpenSSL hides these deprecated DH check constants under
|
||||
// OPENSSL_NO_DEPRECATED, but the numeric verifyError values remain public API.
|
||||
#if !defined(DH_CHECK_P_NOT_PRIME)
|
||||
#define DH_CHECK_P_NOT_PRIME 0x01
|
||||
#endif
|
||||
#if !defined(DH_CHECK_P_NOT_SAFE_PRIME)
|
||||
#define DH_CHECK_P_NOT_SAFE_PRIME 0x02
|
||||
#endif
|
||||
#if !defined(DH_UNABLE_TO_CHECK_GENERATOR)
|
||||
#define DH_UNABLE_TO_CHECK_GENERATOR 0x04
|
||||
#endif
|
||||
#if !defined(DH_NOT_SUITABLE_GENERATOR)
|
||||
#define DH_NOT_SUITABLE_GENERATOR 0x08
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
#if !defined(OPENSSL_IS_BORINGSSL) && OPENSSL_VERSION_MAJOR >= 3
|
||||
// Engine constants remain public API while engine implementation lives in the
|
||||
// dedicated compatibility target.
|
||||
#define ENGINE_METHOD_RSA (unsigned int)0x0001
|
||||
#define ENGINE_METHOD_DSA (unsigned int)0x0002
|
||||
#define ENGINE_METHOD_DH (unsigned int)0x0004
|
||||
#define ENGINE_METHOD_RAND (unsigned int)0x0008
|
||||
#define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
|
||||
#define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
|
||||
#define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200
|
||||
#define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400
|
||||
#define ENGINE_METHOD_EC (unsigned int)0x0800
|
||||
#define ENGINE_METHOD_ALL (unsigned int)0xFFFF
|
||||
#define ENGINE_METHOD_NONE (unsigned int)0x0000
|
||||
#else
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#endif // !OPENSSL_NO_ENGINE
|
||||
#endif // HAVE_OPENSSL
|
||||
|
||||
|
||||
Reference in new issue
Block a user