Skip to content

Commit ac5ad7e

Browse files
committed
fixup! crypto: split OpenSSL 3, BoringSSL, and legacy backends
1 parent e293cf6 commit ac5ad7e

4 files changed

Lines changed: 26 additions & 10 deletions

File tree

deps/ncrypto/ncrypto.gyp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
'OPENSSL_API_COMPAT=30000',
1414
'OPENSSL_NO_DEPRECATED',
1515
],
16+
'ncrypto_legacy_openssl_defines': [
17+
'OPENSSL_API_COMPAT=0x10100000L',
18+
],
1619
'ncrypto_engine_defines': [
1720
'OPENSSL_API_COMPAT=30000',
1821
'OPENSSL_SUPPRESS_DEPRECATED',
@@ -53,13 +56,15 @@
5356
],
5457
'conditions': [
5558
['openssl_is_boringssl=="false" and openssl_version >= 0x3000000f', {
59+
'defines!': [ '<@(ncrypto_legacy_openssl_defines)' ],
5660
'defines': [ '<@(ncrypto_strict_defines)' ],
5761
}],
5862
],
5963
},
6064
'sources': [ '<@(ncrypto_sources)' ],
6165
'conditions': [
6266
['openssl_is_boringssl=="false" and openssl_version >= 0x3000000f', {
67+
'defines!': [ '<@(ncrypto_legacy_openssl_defines)' ],
6368
'defines': [ '<@(ncrypto_strict_defines)' ],
6469
'dependencies': [
6570
'ncrypto_engine',

deps/ncrypto/ncrypto.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@
146146
#define EVP_PKEY_ML_KEM_512 NID_ML_KEM_512
147147
#define EVP_PKEY_ML_KEM_768 NID_ML_KEM_768
148148
#define EVP_PKEY_ML_KEM_1024 NID_ML_KEM_1024
149-
#include <openssl/core_names.h>
150149
#elif OPENSSL_WITH_BORINGSSL_PQC
151150
#define EVP_PKEY_ML_KEM_768 NID_ML_KEM_768
152151
#define EVP_PKEY_ML_KEM_1024 NID_ML_KEM_1024
@@ -546,7 +545,9 @@ class Dsa final {
546545
NCRYPTO_DISALLOW_COPY_AND_MOVE(Dsa)
547546

548547
#if NCRYPTO_USE_OPENSSL3_PROVIDER
549-
inline operator bool() const { return dsa_; }
548+
inline operator bool() const {
549+
return dsa_;
550+
}
550551
#else
551552
inline operator bool() const { return dsa_ != nullptr; }
552553
#endif
@@ -583,7 +584,9 @@ class Rsa final {
583584
NCRYPTO_DISALLOW_COPY_AND_MOVE(Rsa)
584585

585586
#if NCRYPTO_USE_OPENSSL3_PROVIDER
586-
inline operator bool() const { return rsa_; }
587+
inline operator bool() const {
588+
return rsa_;
589+
}
587590
#else
588591
inline operator bool() const { return rsa_ != nullptr; }
589592
#endif
@@ -1179,8 +1182,12 @@ class DHPointer final {
11791182
~DHPointer();
11801183

11811184
#if NCRYPTO_USE_OPENSSL3_PROVIDER
1182-
inline bool operator==(std::nullptr_t) noexcept { return !operator bool(); }
1183-
inline operator bool() const { return dh_ != nullptr || (p_ && g_); }
1185+
inline bool operator==(std::nullptr_t) noexcept {
1186+
return !operator bool();
1187+
}
1188+
inline operator bool() const {
1189+
return dh_ != nullptr || (p_ && g_);
1190+
}
11841191
#else
11851192
inline bool operator==(std::nullptr_t) noexcept { return dh_ == nullptr; }
11861193
inline operator bool() const { return dh_ != nullptr; }
@@ -1190,7 +1197,9 @@ class DHPointer final {
11901197
void reset(DH* dh = nullptr);
11911198
DH* release();
11921199
#else
1193-
inline EVP_PKEY* get() const { return dh_.get(); }
1200+
inline EVP_PKEY* get() const {
1201+
return dh_.get();
1202+
}
11941203
void reset(EVP_PKEY* dh = nullptr);
11951204
EVP_PKEY* release();
11961205
#endif
@@ -1575,8 +1584,12 @@ class ECKeyPointer final {
15751584
~ECKeyPointer();
15761585

15771586
#if NCRYPTO_USE_OPENSSL3_PROVIDER
1578-
inline bool operator==(std::nullptr_t) noexcept { return group_ == nullptr; }
1579-
inline operator bool() const { return group_ != nullptr; }
1587+
inline bool operator==(std::nullptr_t) noexcept {
1588+
return group_ == nullptr;
1589+
}
1590+
inline operator bool() const {
1591+
return group_ != nullptr;
1592+
}
15801593
#else
15811594
inline bool operator==(std::nullptr_t) noexcept { return key_ == nullptr; }
15821595
inline operator bool() const { return key_ != nullptr; }

src/crypto/crypto_context.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
namespace node {
3333

34-
using ncrypto::BignumPointer;
3534
using ncrypto::BIOPointer;
3635
using ncrypto::Cipher;
3736
using ncrypto::ClearErrorOnReturn;

src/crypto/crypto_x509.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ using ncrypto::BIOPointer;
2020
using ncrypto::ClearErrorOnReturn;
2121
using ncrypto::DataPointer;
2222
using ncrypto::Digest;
23-
using ncrypto::ECKeyPointer;
2423
using ncrypto::SSLPointer;
2524
using ncrypto::X509Name;
2625
using ncrypto::X509Pointer;

0 commit comments

Comments
 (0)