Skip to content

Commit

Permalink
Add two new patches
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed May 27, 2020
1 parent 48e43e3 commit 9e89d7f
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
2 changes: 2 additions & 0 deletions patches/node/.patches
Expand Up @@ -35,3 +35,5 @@ weakrefs_rename_finalizationgroup_to_finalizationregistry_for_js.patch
weakrefs_split_out_finalizationregistry_cleanupsome.patch
fix_window_c-ares_incompatibilities.patch
chore_sethostcleanupfinalizationgroupcallback_has_been_removed_from.patch
fix_remove_bad_semicolon_outside_fn.patch
fix_comment_out_incompatible_crypto_modules.patch
80 changes: 80 additions & 0 deletions patches/node/fix_comment_out_incompatible_crypto_modules.patch
@@ -0,0 +1,80 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 27 May 2020 13:02:13 -0700
Subject: fix: comment out incompatible crypto modules

Node.js introduced some functionality in https://github.com/nodejs/node/pull/32739
and https://github.com/nodejs/node/pull/31178 that is not currently compatible
with what's exposed through BoringSSL. I plan to upstream parts of this or
otherwise introduce shims to reduce friction.

diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index ce48e608c07ca3d9dd717f92566c71c2a77cbcbc..a144d570d21cadccbb02349dc2f4ef44f6e7d79a 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -5142,6 +5142,7 @@ bool DiffieHellman::Init(int primeLength, int g) {

bool DiffieHellman::Init(const char* p, int p_len, int g) {
dh_.reset(DH_new());
+#if 0
if (p_len <= 0) {
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
return false;
@@ -5150,6 +5151,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
return false;
}
+#endif
BIGNUM* bn_p =
BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, nullptr);
BIGNUM* bn_g = BN_new();
@@ -5165,6 +5167,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {

bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
dh_.reset(DH_new());
+#if 0
if (p_len <= 0) {
BNerr(BN_F_BN_GENERATE_PRIME_EX, BN_R_BITS_TOO_SMALL);
return false;
@@ -5187,6 +5190,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
BN_free(bn_g);
return false;
}
+#endif
return VerifyContext();
}

@@ -6154,6 +6158,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
EVPKeyCtxPointer Setup() override {
EVPKeyPointer params;
if (prime_info_.fixed_value_) {
+#if 0
DHPointer dh(DH_new());
if (!dh)
return nullptr;
@@ -6170,6 +6175,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
params = EVPKeyPointer(EVP_PKEY_new());
CHECK(params);
EVP_PKEY_assign_DH(params.get(), dh.release());
+#endif
} else {
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
if (!param_ctx)
@@ -6177,7 +6183,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {

if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
return nullptr;
-
+#if 0
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(param_ctx.get(),
prime_info_.prime_size_) <= 0)
return nullptr;
@@ -6185,7 +6191,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
if (EVP_PKEY_CTX_set_dh_paramgen_generator(param_ctx.get(),
generator_) <= 0)
return nullptr;
-
+#endif
EVP_PKEY* raw_params = nullptr;
if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
return nullptr;
19 changes: 19 additions & 0 deletions patches/node/fix_remove_bad_semicolon_outside_fn.patch
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 27 May 2020 12:57:43 -0700
Subject: fix: remove bad semicolon outside fn

Node.js introduced a bad semicolon style in
https://github.com/nodejs/node/pull/29207. Upstreamed in
https://github.com/nodejs/node/pull/33592.

diff --git a/src/node_watchdog.cc b/src/node_watchdog.cc
index 107a25bc977bd38e97a2310b272e495d09847ecb..3ed390678962890d90d385cf2bca9deaca023c89 100644
--- a/src/node_watchdog.cc
+++ b/src/node_watchdog.cc
@@ -432,4 +432,4 @@ static void Initialize(Local<Object> target,

} // namespace node

-NODE_MODULE_CONTEXT_AWARE_INTERNAL(watchdog, node::watchdog::Initialize);
+NODE_MODULE_CONTEXT_AWARE_INTERNAL(watchdog, node::watchdog::Initialize)

0 comments on commit 9e89d7f

Please sign in to comment.