fix_handle_boringssl_and_openssl_incompatibilities.patch 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Wed, 12 Feb 2020 15:08:04 -0800
  4. Subject: fix: handle BoringSSL and OpenSSL incompatibilities
  5. This patch corrects for imcompatibilities between OpenSSL, which Node.js uses,
  6. and BoringSSL which Electron uses via Chromium. Each incompatibility typically has
  7. ~2 paths forward:
  8. * Upstream a shim or adapted implementation to BoringSSL
  9. * Alter Node.js functionality to something which both libraries can handle.
  10. Where possible, we should seek to make this patch as minimal as possible.
  11. Upstreams:
  12. - https://github.com/nodejs/node/pull/39054
  13. - https://github.com/nodejs/node/pull/39138
  14. - https://github.com/nodejs/node/pull/39136
  15. diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
  16. index 67cd4f2adf15e7d8511f561c54163b1842e971af..7e0e1a62289289b8362870ba4869c97494b9298a 100644
  17. --- a/src/crypto/crypto_cipher.cc
  18. +++ b/src/crypto/crypto_cipher.cc
  19. @@ -28,7 +28,8 @@ using v8::Value;
  20. namespace crypto {
  21. namespace {
  22. bool IsSupportedAuthenticatedMode(const EVP_CIPHER* cipher) {
  23. - switch (EVP_CIPHER_mode(cipher)) {
  24. + const int mode = EVP_CIPHER_mode(cipher);
  25. + switch (mode) {
  26. case EVP_CIPH_CCM_MODE:
  27. case EVP_CIPH_GCM_MODE:
  28. #ifndef OPENSSL_NO_OCB
  29. @@ -1088,7 +1089,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
  30. if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) {
  31. return ThrowCryptoError(env, ERR_get_error());
  32. }
  33. -
  34. +#ifndef OPENSSL_IS_BORINGSSL
  35. int rsa_pkcs1_implicit_rejection =
  36. EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
  37. // From the doc -2 means that the option is not supported.
  38. @@ -1104,6 +1105,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
  39. "RSA_PKCS1_PADDING is no longer supported for private decryption,"
  40. " this can be reverted with --security-revert=CVE-2023-46809");
  41. }
  42. +#endif
  43. }
  44. const EVP_MD* digest = nullptr;
  45. diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
  46. index 962018583360a137639682d4aec8b0ebad2f3070..f8ec40885905abbbe0da0f285ff9e83694c2b620 100644
  47. --- a/src/crypto/crypto_common.cc
  48. +++ b/src/crypto/crypto_common.cc
  49. @@ -166,7 +166,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
  50. const unsigned char* buf;
  51. size_t len;
  52. size_t rem;
  53. -
  54. +#ifndef OPENSSL_IS_BORINGSSL
  55. if (!SSL_client_hello_get0_ext(
  56. ssl.get(),
  57. TLSEXT_TYPE_application_layer_protocol_negotiation,
  58. @@ -179,13 +179,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
  59. len = (buf[0] << 8) | buf[1];
  60. if (len + 2 != rem) return nullptr;
  61. return reinterpret_cast<const char*>(buf + 3);
  62. +#endif
  63. + return nullptr;
  64. }
  65. const char* GetClientHelloServerName(const SSLPointer& ssl) {
  66. const unsigned char* buf;
  67. size_t len;
  68. size_t rem;
  69. -
  70. +#ifndef OPENSSL_IS_BORINGSSL
  71. if (!SSL_client_hello_get0_ext(
  72. ssl.get(),
  73. TLSEXT_TYPE_server_name,
  74. @@ -207,6 +209,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) {
  75. if (len + 2 > rem)
  76. return nullptr;
  77. return reinterpret_cast<const char*>(buf + 5);
  78. +#endif
  79. + return nullptr;
  80. }
  81. const char* GetServerName(SSL* ssl) {
  82. @@ -214,7 +218,10 @@ const char* GetServerName(SSL* ssl) {
  83. }
  84. bool SetGroups(SecureContext* sc, const char* groups) {
  85. +#ifndef OPENSSL_IS_BORINGSSL
  86. return SSL_CTX_set1_groups_list(sc->ctx().get(), groups) == 1;
  87. +#endif
  88. + return SSL_CTX_set1_curves_list(sc->ctx().get(), groups) == 1;
  89. }
  90. // When adding or removing errors below, please also update the list in the API
  91. @@ -1044,14 +1051,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
  92. Environment* env,
  93. const SSLPointer& ssl) {
  94. EscapableHandleScope scope(env->isolate());
  95. - const unsigned char* buf;
  96. - size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf);
  97. + // const unsigned char* buf = nullptr;
  98. + size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf);
  99. size_t count = len / 2;
  100. MaybeStackBuffer<Local<Value>, 16> ciphers(count);
  101. int j = 0;
  102. for (size_t n = 0; n < len; n += 2) {
  103. - const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf);
  104. - buf += 2;
  105. + const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf);
  106. + // buf += 2;
  107. Local<Object> obj = Object::New(env->isolate());
  108. if (!Set(env->context(),
  109. obj,
  110. @@ -1104,8 +1111,11 @@ MaybeLocal<Object> GetEphemeralKey(Environment* env, const SSLPointer& ssl) {
  111. EscapableHandleScope scope(env->isolate());
  112. Local<Object> info = Object::New(env->isolate());
  113. +#ifndef OPENSSL_IS_BORINGSSL
  114. if (!SSL_get_peer_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info);
  115. -
  116. +#else
  117. + if (!SSL_get_server_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info);
  118. +#endif
  119. Local<Context> context = env->context();
  120. crypto::EVPKeyPointer key(raw_key);
  121. diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc
  122. index e26e64834bee7fd9cd4e18bfe69a4f41d51fa8e9..a5b1ec5ea6284ab9892d5a2e576f369ae3bbac91 100644
  123. --- a/src/crypto/crypto_context.cc
  124. +++ b/src/crypto/crypto_context.cc
  125. @@ -63,7 +63,7 @@ inline X509_STORE* GetOrCreateRootCertStore() {
  126. // Caller responsible for BIO_free_all-ing the returned object.
  127. BIOPointer LoadBIO(Environment* env, Local<Value> v) {
  128. if (v->IsString() || v->IsArrayBufferView()) {
  129. - BIOPointer bio(BIO_new(BIO_s_secmem()));
  130. + BIOPointer bio(BIO_new(BIO_s_mem()));
  131. if (!bio) return nullptr;
  132. ByteSource bsrc = ByteSource::FromStringOrBuffer(env, v);
  133. if (bsrc.size() > INT_MAX) return nullptr;
  134. @@ -861,10 +861,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
  135. // If the user specified "auto" for dhparams, the JavaScript layer will pass
  136. // true to this function instead of the original string. Any other string
  137. // value will be interpreted as custom DH parameters below.
  138. +#ifndef OPENSSL_IS_BORINGSSL
  139. if (args[0]->IsTrue()) {
  140. CHECK(SSL_CTX_set_dh_auto(sc->ctx_.get(), true));
  141. return;
  142. }
  143. +#endif
  144. DHPointer dh;
  145. {
  146. diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
  147. index b4447102a8478639a5aa774e583834d79808603f..678be07feb394530b944c1b356265416f2d50742 100644
  148. --- a/src/crypto/crypto_dh.cc
  149. +++ b/src/crypto/crypto_dh.cc
  150. @@ -154,13 +154,11 @@ bool DiffieHellman::Init(BignumPointer&& bn_p, int g) {
  151. bool DiffieHellman::Init(const char* p, int p_len, int g) {
  152. dh_.reset(DH_new());
  153. if (p_len <= 0) {
  154. - ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
  155. - BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
  156. + OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
  157. return false;
  158. }
  159. if (g <= 1) {
  160. - ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
  161. - DH_R_BAD_GENERATOR, __FILE__, __LINE__);
  162. + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
  163. return false;
  164. }
  165. BignumPointer bn_p(
  166. @@ -176,20 +174,17 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
  167. bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
  168. dh_.reset(DH_new());
  169. if (p_len <= 0) {
  170. - ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
  171. - BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
  172. + OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
  173. return false;
  174. }
  175. if (g_len <= 0) {
  176. - ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
  177. - DH_R_BAD_GENERATOR, __FILE__, __LINE__);
  178. + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
  179. return false;
  180. }
  181. BignumPointer bn_g(
  182. BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr));
  183. if (BN_is_zero(bn_g.get()) || BN_is_one(bn_g.get())) {
  184. - ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
  185. - DH_R_BAD_GENERATOR, __FILE__, __LINE__);
  186. + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
  187. return false;
  188. }
  189. BignumPointer bn_p(
  190. @@ -219,8 +214,10 @@ typedef BignumPointer (*StandardizedGroupInstantiator)();
  191. inline StandardizedGroupInstantiator FindDiffieHellmanGroup(const char* name) {
  192. #define V(n, p) \
  193. if (StringEqualNoCase(name, n)) return InstantiateStandardizedGroup<p>
  194. +#ifndef OPENSSL_IS_BORINGSSL
  195. V("modp1", BN_get_rfc2409_prime_768);
  196. V("modp2", BN_get_rfc2409_prime_1024);
  197. +#endif
  198. V("modp5", BN_get_rfc3526_prime_1536);
  199. V("modp14", BN_get_rfc3526_prime_2048);
  200. V("modp15", BN_get_rfc3526_prime_3072);
  201. @@ -559,15 +556,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
  202. return EVPKeyCtxPointer();
  203. }
  204. +#ifndef OPENSSL_IS_BORINGSSL
  205. prime_fixed_value->release();
  206. bn_g.release();
  207. key_params = EVPKeyPointer(EVP_PKEY_new());
  208. CHECK(key_params);
  209. CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1);
  210. +#else
  211. + return EVPKeyCtxPointer();
  212. +#endif
  213. } else if (int* prime_size = std::get_if<int>(&params->params.prime)) {
  214. EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
  215. EVP_PKEY* raw_params = nullptr;
  216. +#ifndef OPENSSL_IS_BORINGSSL
  217. if (!param_ctx ||
  218. EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
  219. EVP_PKEY_CTX_set_dh_paramgen_prime_len(
  220. @@ -581,6 +583,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
  221. }
  222. key_params = EVPKeyPointer(raw_params);
  223. +#else
  224. + return EVPKeyCtxPointer();
  225. +#endif
  226. } else {
  227. UNREACHABLE();
  228. }
  229. diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc
  230. index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc72ed93b60 100644
  231. --- a/src/crypto/crypto_dsa.cc
  232. +++ b/src/crypto/crypto_dsa.cc
  233. @@ -40,7 +40,7 @@ namespace crypto {
  234. EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
  235. EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr));
  236. EVP_PKEY* raw_params = nullptr;
  237. -
  238. +#ifndef OPENSSL_IS_BORINGSSL
  239. if (!param_ctx ||
  240. EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
  241. EVP_PKEY_CTX_set_dsa_paramgen_bits(
  242. @@ -55,7 +55,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
  243. return EVPKeyCtxPointer();
  244. }
  245. }
  246. -
  247. +#else
  248. + return EVPKeyCtxPointer();
  249. +#endif
  250. if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
  251. return EVPKeyCtxPointer();
  252. diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc
  253. index a4979cf5586a7be6308a917eb020bedafa17f683..e4705482c6d45138deac84c59d8192bb2a284a76 100644
  254. --- a/src/crypto/crypto_keys.cc
  255. +++ b/src/crypto/crypto_keys.cc
  256. @@ -1241,6 +1241,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
  257. }
  258. bool KeyObjectHandle::CheckEcKeyData() const {
  259. +#ifndef OPENSSL_IS_BORINGSSL
  260. MarkPopErrorOnReturn mark_pop_error_on_return;
  261. const ManagedEVPPKey& key = data_->GetAsymmetricKey();
  262. @@ -1259,6 +1260,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
  263. #else
  264. return EVP_PKEY_public_check(ctx.get()) == 1;
  265. #endif
  266. +#else
  267. + return true;
  268. +#endif
  269. }
  270. void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) {
  271. diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc
  272. index 48154df7dc91ed7c0d65323199bc2f59dfc68135..6431e5c3062890975854780d15ecb84370b81770 100644
  273. --- a/src/crypto/crypto_random.cc
  274. +++ b/src/crypto/crypto_random.cc
  275. @@ -140,7 +140,7 @@ Maybe<bool> RandomPrimeTraits::AdditionalConfig(
  276. params->bits = bits;
  277. params->safe = safe;
  278. - params->prime.reset(BN_secure_new());
  279. + params->prime.reset(BN_new());
  280. if (!params->prime) {
  281. THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime");
  282. return Nothing<bool>();
  283. diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc
  284. index f222ab9cf5ccbc5dd3399b18d7688efda6672c93..349abd4d06e7f624a071b994271dedc31dc9229a 100644
  285. --- a/src/crypto/crypto_rsa.cc
  286. +++ b/src/crypto/crypto_rsa.cc
  287. @@ -616,10 +616,11 @@ Maybe<bool> GetRsaKeyDetail(
  288. }
  289. if (params->saltLength != nullptr) {
  290. - if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
  291. - ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
  292. - return Nothing<bool>();
  293. - }
  294. + // TODO(codebytere): Upstream a shim to BoringSSL?
  295. + // if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
  296. + // ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
  297. + // return Nothing<bool>();
  298. + // }
  299. }
  300. if (target
  301. diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
  302. index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41af7d48df 100644
  303. --- a/src/crypto/crypto_util.cc
  304. +++ b/src/crypto/crypto_util.cc
  305. @@ -517,24 +517,15 @@ Maybe<bool> Decorate(Environment* env, Local<Object> obj,
  306. V(BIO) \
  307. V(PKCS7) \
  308. V(X509V3) \
  309. - V(PKCS12) \
  310. V(RAND) \
  311. - V(DSO) \
  312. V(ENGINE) \
  313. V(OCSP) \
  314. V(UI) \
  315. V(COMP) \
  316. V(ECDSA) \
  317. V(ECDH) \
  318. - V(OSSL_STORE) \
  319. - V(FIPS) \
  320. - V(CMS) \
  321. - V(TS) \
  322. V(HMAC) \
  323. - V(CT) \
  324. - V(ASYNC) \
  325. - V(KDF) \
  326. - V(SM2) \
  327. + V(HKDF) \
  328. V(USER) \
  329. #define V(name) case ERR_LIB_##name: lib = #name "_"; break;
  330. @@ -715,7 +706,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
  331. CHECK(args[0]->IsUint32());
  332. Environment* env = Environment::GetCurrent(args);
  333. uint32_t len = args[0].As<Uint32>()->Value();
  334. - void* data = OPENSSL_secure_zalloc(len);
  335. + void* data = OPENSSL_malloc(len);
  336. if (data == nullptr) {
  337. // There's no memory available for the allocation.
  338. // Return nothing.
  339. @@ -726,7 +717,7 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
  340. data,
  341. len,
  342. [](void* data, size_t len, void* deleter_data) {
  343. - OPENSSL_secure_clear_free(data, len);
  344. + OPENSSL_clear_free(data, len);
  345. },
  346. data);
  347. Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
  348. @@ -734,10 +725,12 @@ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
  349. }
  350. void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
  351. +#ifndef OPENSSL_IS_BORINGSSL
  352. Environment* env = Environment::GetCurrent(args);
  353. if (CRYPTO_secure_malloc_initialized())
  354. args.GetReturnValue().Set(
  355. BigInt::New(env->isolate(), CRYPTO_secure_used()));
  356. +#endif
  357. }
  358. } // namespace
  359. diff --git a/src/env.h b/src/env.h
  360. index cd8db07919dc4d00675bbaae976e8fa1fcc16028..2310c89227f08cdcca6c4965cc163031af303626 100644
  361. --- a/src/env.h
  362. +++ b/src/env.h
  363. @@ -49,7 +49,7 @@
  364. #include "uv.h"
  365. #include "v8.h"
  366. -#if HAVE_OPENSSL
  367. +#if HAVE_OPENSSL && OPENSSL_VERSION_MAJOR >= 3
  368. #include <openssl/evp.h>
  369. #endif
  370. @@ -1038,7 +1038,7 @@ class Environment : public MemoryRetainer {
  371. kExitInfoFieldCount
  372. };
  373. -#if HAVE_OPENSSL
  374. +#if HAVE_OPENSSL// && !defined(OPENSSL_IS_BORINGSSL)
  375. #if OPENSSL_VERSION_MAJOR >= 3
  376. // We declare another alias here to avoid having to include crypto_util.h
  377. using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
  378. diff --git a/src/node_metadata.cc b/src/node_metadata.cc
  379. index 985d44b3cd1f1aa5c09f99e868083f2e48c7e32b..5856292b5450f697cdb57de30bafd3e907a7964d 100644
  380. --- a/src/node_metadata.cc
  381. +++ b/src/node_metadata.cc
  382. @@ -21,7 +21,7 @@
  383. #include <zlib.h>
  384. #endif // NODE_BUNDLED_ZLIB
  385. -#if HAVE_OPENSSL
  386. +#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
  387. #include <openssl/crypto.h>
  388. #if NODE_OPENSSL_HAS_QUIC
  389. #include <openssl/quic.h>
  390. diff --git a/src/node_metadata.h b/src/node_metadata.h
  391. index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f14446099 100644
  392. --- a/src/node_metadata.h
  393. +++ b/src/node_metadata.h
  394. @@ -6,7 +6,7 @@
  395. #include <string>
  396. #include "node_version.h"
  397. -#if HAVE_OPENSSL
  398. +#if 0
  399. #include <openssl/crypto.h>
  400. #if NODE_OPENSSL_HAS_QUIC
  401. #include <openssl/quic.h>
  402. diff --git a/src/node_options.cc b/src/node_options.cc
  403. index 1ba0bfcd9b3096c4bffe518ad08973edb895e8c3..28fbd93c5d4a6f379844e10e556920b7614910d8 100644
  404. --- a/src/node_options.cc
  405. +++ b/src/node_options.cc
  406. @@ -6,7 +6,7 @@
  407. #include "node_external_reference.h"
  408. #include "node_internals.h"
  409. #include "node_sea.h"
  410. -#if HAVE_OPENSSL
  411. +#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
  412. #include "openssl/opensslv.h"
  413. #endif
  414. diff --git a/src/node_options.h b/src/node_options.h
  415. index 1357e5b42869e8e3a30d2bf6db0faed565d99754..49c6d8b4162977a926e36bad7183a10502b2beaf 100644
  416. --- a/src/node_options.h
  417. +++ b/src/node_options.h
  418. @@ -11,7 +11,7 @@
  419. #include "node_mutex.h"
  420. #include "util.h"
  421. -#if HAVE_OPENSSL
  422. +#if 0
  423. #include "openssl/opensslv.h"
  424. #endif