|
@@ -17,15 +17,10 @@ Upstreams:
|
|
|
- https://github.com/nodejs/node/pull/39136
|
|
|
|
|
|
diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
|
|
|
-index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824ca574106 100644
|
|
|
+index ac2d771555126a4f43b8c3a3fd299d40019e6622..769fe636ef2b5d02ecc9ff753e64d93ea5075700 100644
|
|
|
--- a/deps/ncrypto/ncrypto.cc
|
|
|
+++ b/deps/ncrypto/ncrypto.cc
|
|
|
-@@ -6,13 +6,11 @@
|
|
|
- #include <openssl/evp.h>
|
|
|
- #include <openssl/hmac.h>
|
|
|
- #include <openssl/pkcs12.h>
|
|
|
-+#include <openssl/rand.h>
|
|
|
- #include <openssl/x509v3.h>
|
|
|
+@@ -11,9 +11,6 @@
|
|
|
#if OPENSSL_VERSION_MAJOR >= 3
|
|
|
#include <openssl/provider.h>
|
|
|
#endif
|
|
@@ -35,7 +30,7 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
|
|
|
namespace ncrypto {
|
|
|
namespace {
|
|
|
-@@ -694,7 +692,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
|
|
+@@ -708,7 +705,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
@@ -43,8 +38,8 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
+ for (size_t i = 0; i < sk_GENERAL_NAME_num(names); i++) {
|
|
|
GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i);
|
|
|
|
|
|
- if (i != 0)
|
|
|
-@@ -720,7 +718,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
|
|
+ if (i != 0) BIO_write(out.get(), ", ", 2);
|
|
|
+@@ -732,7 +729,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) {
|
|
|
|
|
|
bool ok = true;
|
|
|
|
|
@@ -52,13 +47,14 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
+ for (size_t i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) {
|
|
|
ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i);
|
|
|
|
|
|
- if (i != 0)
|
|
|
-@@ -857,13 +855,17 @@ BIOPointer X509View::getValidTo() const {
|
|
|
+ if (i != 0) BIO_write(out.get(), "\n", 1);
|
|
|
+@@ -874,13 +871,17 @@ BIOPointer X509View::getValidTo() const {
|
|
|
|
|
|
int64_t X509View::getValidToTime() const {
|
|
|
struct tm tp;
|
|
|
+- ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
|
|
+#ifndef OPENSSL_IS_BORINGSSL
|
|
|
- ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
|
|
++ ASN1_TIME_to_tm(X509_get0_notAfter(cert_), &tp);
|
|
|
+#endif
|
|
|
return PortableTimeGM(&tp);
|
|
|
}
|
|
@@ -71,21 +67,22 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
return PortableTimeGM(&tp);
|
|
|
}
|
|
|
|
|
|
-@@ -1043,7 +1045,11 @@ BIOPointer BIOPointer::NewMem() {
|
|
|
+@@ -1085,7 +1086,11 @@ BIOPointer BIOPointer::NewMem() {
|
|
|
}
|
|
|
|
|
|
BIOPointer BIOPointer::NewSecMem() {
|
|
|
+- return BIOPointer(BIO_new(BIO_s_secmem()));
|
|
|
+#ifdef OPENSSL_IS_BORINGSSL
|
|
|
+ return BIOPointer(BIO_new(BIO_s_mem()));
|
|
|
+#else
|
|
|
- return BIOPointer(BIO_new(BIO_s_secmem()));
|
|
|
++ return BIOPointer(BIO_new(BIO_s_secmem()));
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
BIOPointer BIOPointer::New(const BIO_METHOD* method) {
|
|
|
-@@ -1098,8 +1104,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
|
|
|
- FindGroupOption option) {
|
|
|
- #define V(n, p) if (EqualNoCase(name, n)) return BignumPointer(p(nullptr));
|
|
|
+@@ -1149,8 +1154,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name,
|
|
|
+ #define V(n, p) \
|
|
|
+ if (EqualNoCase(name, n)) return BignumPointer(p(nullptr));
|
|
|
if (option != FindGroupOption::NO_SMALL_PRIMES) {
|
|
|
+#ifndef OPENSSL_IS_BORINGSSL
|
|
|
V("modp1", BN_get_rfc2409_prime_768);
|
|
@@ -94,7 +91,7 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
V("modp5", BN_get_rfc3526_prime_1536);
|
|
|
}
|
|
|
V("modp14", BN_get_rfc3526_prime_2048);
|
|
|
-@@ -1171,11 +1179,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(const BignumPointer& p
|
|
|
+@@ -1223,11 +1230,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(
|
|
|
int codes = 0;
|
|
|
if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1)
|
|
|
return DHPointer::CheckPublicKeyResult::CHECK_FAILED;
|
|
@@ -110,10 +107,10 @@ index 457bd2f6c5b18956d06c716fbfae429496fb352d..e954cb2e53f3d8c297d21ef9f698d824
|
|
|
}
|
|
|
return CheckPublicKeyResult::NONE;
|
|
|
diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h
|
|
|
-index 20b69dc67b13fd4f0bd44f7adf6a0d928a2c10c4..2320f92c50543fb9b426bce1c6d182bddf7658de 100644
|
|
|
+index fffa75ec718facc61cebf48f33ddc3909b9b9413..19757016a4f50e2f656a76bf60cb87e601845afe 100644
|
|
|
--- a/deps/ncrypto/ncrypto.h
|
|
|
+++ b/deps/ncrypto/ncrypto.h
|
|
|
-@@ -493,17 +493,21 @@ public:
|
|
|
+@@ -516,17 +516,21 @@ class DHPointer final {
|
|
|
UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR,
|
|
|
NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR,
|
|
|
Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME,
|
|
@@ -136,33 +133,21 @@ index 20b69dc67b13fd4f0bd44f7adf6a0d928a2c10c4..2320f92c50543fb9b426bce1c6d182bd
|
|
|
CHECK_FAILED = 512,
|
|
|
};
|
|
|
// Check to see if the given public key is suitable for this DH instance.
|
|
|
-diff --git a/deps/ncrypto/unofficial.gni b/deps/ncrypto/unofficial.gni
|
|
|
-index ea024af73e215b3cad5f08796ac405f419530c86..41061b524eea74330b8d2452635a38c48f21386b 100644
|
|
|
---- a/deps/ncrypto/unofficial.gni
|
|
|
-+++ b/deps/ncrypto/unofficial.gni
|
|
|
-@@ -27,6 +27,6 @@ template("ncrypto_gn_build") {
|
|
|
- forward_variables_from(invoker, "*")
|
|
|
- public_configs = [ ":ncrypto_config" ]
|
|
|
- sources = gypi_values.ncrypto_sources
|
|
|
-- deps = [ "../openssl" ]
|
|
|
-+ deps = [ "$node_crypto_path" ]
|
|
|
- }
|
|
|
- }
|
|
|
diff --git a/node.gni b/node.gni
|
|
|
-index 852f64fa9cfb50fe6e9ce7aa46be336d3196d5b8..461bff93e151c454cd0a9575daa01d3f7c0ec9c3 100644
|
|
|
+index 245a43920c7baf000ba63192a84a4c3fd219be7d..56a554175b805c1703f13d62041f8c80d6e94dd9 100644
|
|
|
--- a/node.gni
|
|
|
+++ b/node.gni
|
|
|
-@@ -10,6 +10,8 @@ declare_args() {
|
|
|
- # The location of V8, use the one from node's deps by default.
|
|
|
+@@ -11,7 +11,7 @@ declare_args() {
|
|
|
node_v8_path = "//v8"
|
|
|
|
|
|
-+ node_crypto_path = "//third_party/boringssl"
|
|
|
-+
|
|
|
- # The NODE_MODULE_VERSION defined in node_version.h.
|
|
|
- node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value")
|
|
|
+ # The location of OpenSSL - use the one from node's deps by default.
|
|
|
+- node_openssl_path = "$node_path/deps/openssl"
|
|
|
++ node_openssl_path = "//third_party/boringssl"
|
|
|
|
|
|
+ # The location of simdutf - use the one from node's deps by default.
|
|
|
+ node_simdutf_path = "$node_path/deps/simdutf"
|
|
|
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
|
|
|
-index a81ab8e95f2fc23e1e315fb9c69364934377a0c1..dbe12ba2413ef29ff06a7e8abde50000eaf277e2 100644
|
|
|
+index c7588583530cf291946d01cec807390d987706cf..495fb92355a7eadc2f7ec885a3b529988bb3bd02 100644
|
|
|
--- a/src/crypto/crypto_cipher.cc
|
|
|
+++ b/src/crypto/crypto_cipher.cc
|
|
|
@@ -1080,7 +1080,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
|
|
@@ -174,9 +159,9 @@ index a81ab8e95f2fc23e1e315fb9c69364934377a0c1..dbe12ba2413ef29ff06a7e8abde50000
|
|
|
int rsa_pkcs1_implicit_rejection =
|
|
|
EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
|
|
|
// From the doc -2 means that the option is not supported.
|
|
|
-@@ -1096,6 +1096,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
|
|
|
- "RSA_PKCS1_PADDING is no longer supported for private decryption,"
|
|
|
- " this can be reverted with --security-revert=CVE-2024-PEND");
|
|
|
+@@ -1095,6 +1095,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
|
|
|
+ env,
|
|
|
+ "RSA_PKCS1_PADDING is no longer supported for private decryption");
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
@@ -440,10 +425,10 @@ index b557de774117e442d7f429e92d63a6e1faa236fd..0aca233ced39269b09c383e5b32d85cf
|
|
|
return EVPKeyCtxPointer();
|
|
|
|
|
|
diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc
|
|
|
-index 6af8d089ca6bcd73aff314638443610b9cc4bf7e..c84cbd5b4708e0c403ab0a1e1ddf5fc72eb3d148 100644
|
|
|
+index ac4103400e1e293909e7c524f4a1422c5f04e707..c44c11cbd533350d8bf149032c658d5585303b7d 100644
|
|
|
--- a/src/crypto/crypto_keys.cc
|
|
|
+++ b/src/crypto/crypto_keys.cc
|
|
|
-@@ -1059,6 +1059,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
|
|
|
+@@ -945,6 +945,7 @@ void KeyObjectHandle::GetAsymmetricKeyType(
|
|
|
}
|
|
|
|
|
|
bool KeyObjectHandle::CheckEcKeyData() const {
|
|
@@ -451,7 +436,7 @@ index 6af8d089ca6bcd73aff314638443610b9cc4bf7e..c84cbd5b4708e0c403ab0a1e1ddf5fc7
|
|
|
MarkPopErrorOnReturn mark_pop_error_on_return;
|
|
|
|
|
|
const auto& key = data_.GetAsymmetricKey();
|
|
|
-@@ -1075,6 +1076,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
|
|
|
+@@ -961,6 +962,9 @@ bool KeyObjectHandle::CheckEcKeyData() const {
|
|
|
#else
|
|
|
return EVP_PKEY_public_check(ctx.get()) == 1;
|
|
|
#endif
|
|
@@ -554,7 +539,7 @@ index 12ee0cde0897024bccb0face49053544a0bcfcd7..8a6a36a3c31532ed585c287ba8cee140
|
|
|
} // namespace
|
|
|
|
|
|
diff --git a/src/env.h b/src/env.h
|
|
|
-index 55124cd38e75ab67c092f6bf5c909a50e7232045..3ef093e612b23d5e1e7cacf56055e5f9818bcb02 100644
|
|
|
+index 16312e548e526b80ec9a230bc3c772f45685b61f..0a3f09ebc7e2e7c1f8b9499d4439e2ca90b86810 100644
|
|
|
--- a/src/env.h
|
|
|
+++ b/src/env.h
|
|
|
@@ -50,7 +50,7 @@
|
|
@@ -566,7 +551,7 @@ index 55124cd38e75ab67c092f6bf5c909a50e7232045..3ef093e612b23d5e1e7cacf56055e5f9
|
|
|
#include <openssl/evp.h>
|
|
|
#endif
|
|
|
|
|
|
-@@ -1060,7 +1060,7 @@ class Environment final : public MemoryRetainer {
|
|
|
+@@ -1062,7 +1062,7 @@ class Environment final : public MemoryRetainer {
|
|
|
kExitInfoFieldCount
|
|
|
};
|
|
|
|
|
@@ -589,7 +574,7 @@ index c59e65ad1fe3fac23f1fc25ca77e6133d1ccaccd..f2f07434e076e2977755ef7dac7d489a
|
|
|
#if NODE_OPENSSL_HAS_QUIC
|
|
|
#include <openssl/quic.h>
|
|
|
diff --git a/src/node_options.cc b/src/node_options.cc
|
|
|
-index d3b59690e917afcf725cbfb1232d6ed9f298ee3a..3c42f9b87c11a0f88800d6709515c1c9e2972fc0 100644
|
|
|
+index a03daec2bd74d7857d38238ea0479e36e054a7a3..f70e0917f6caa66210107cdb2ef891685563ba96 100644
|
|
|
--- a/src/node_options.cc
|
|
|
+++ b/src/node_options.cc
|
|
|
@@ -6,7 +6,7 @@
|
|
@@ -602,7 +587,7 @@ index d3b59690e917afcf725cbfb1232d6ed9f298ee3a..3c42f9b87c11a0f88800d6709515c1c9
|
|
|
#endif
|
|
|
|
|
|
diff --git a/src/node_options.h b/src/node_options.h
|
|
|
-index fc7f898a6b9b6072c15d77710c20ed1ba580966b..f39dcad0a28ae483e6d0e5df3816693119ac823e 100644
|
|
|
+index ab6ea77b2e9ce54af44e21c29fcba929f117c41b..23923ccd645e810d84b0a08e57e486d012b5796b 100644
|
|
|
--- a/src/node_options.h
|
|
|
+++ b/src/node_options.h
|
|
|
@@ -11,7 +11,7 @@
|
|
@@ -615,10 +600,10 @@ index fc7f898a6b9b6072c15d77710c20ed1ba580966b..f39dcad0a28ae483e6d0e5df38166931
|
|
|
#endif
|
|
|
|
|
|
diff --git a/unofficial.gni b/unofficial.gni
|
|
|
-index f6793b8bf22d6ac911a1977edaa881b6dbbe7ac7..ddfbb97276b29df114ab455a2eed3b186b3af5d2 100644
|
|
|
+index 3632d5bd21e277fcbd8d62dc65598a7f7c87f00e..08a4ed939fb1482a897def94128282fdfd63dc62 100644
|
|
|
--- a/unofficial.gni
|
|
|
+++ b/unofficial.gni
|
|
|
-@@ -150,7 +150,6 @@ template("node_gn_build") {
|
|
|
+@@ -151,7 +151,6 @@ template("node_gn_build") {
|
|
|
]
|
|
|
deps = [
|
|
|
":run_node_js2c",
|
|
@@ -632,19 +617,6 @@ index f6793b8bf22d6ac911a1977edaa881b6dbbe7ac7..ddfbb97276b29df114ab455a2eed3b18
|
|
|
"//third_party/zlib",
|
|
|
+ "//third_party/brotli:dec",
|
|
|
+ "//third_party/brotli:enc",
|
|
|
+ "$node_simdutf_path",
|
|
|
"$node_v8_path:v8_libplatform",
|
|
|
]
|
|
|
-
|
|
|
-@@ -187,10 +188,8 @@ template("node_gn_build") {
|
|
|
- deps += [ "//third_party/icu" ]
|
|
|
- }
|
|
|
- if (node_use_openssl) {
|
|
|
-- deps += [
|
|
|
-- "deps/ncrypto",
|
|
|
-- "//third_party/boringssl"
|
|
|
-- ]
|
|
|
-+ deps += [ "deps/ncrypto" ]
|
|
|
-+ public_deps += [ "$node_crypto_path" ]
|
|
|
- sources += gypi_values.node_crypto_sources
|
|
|
- }
|
|
|
- if (node_enable_inspector) {
|