|
@@ -9,10 +9,10 @@ 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 cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20b1b58bb0 100644
|
|
|
+index c373533ce85241f86d64eab8a49af79f935acdeb..454fff5ada0c271db7fb975f809c84d87773dcd6 100644
|
|
|
--- a/src/node_crypto.cc
|
|
|
+++ b/src/node_crypto.cc
|
|
|
-@@ -5142,6 +5142,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
|
|
+@@ -5145,6 +5145,7 @@ bool DiffieHellman::Init(int primeLength, int g) {
|
|
|
|
|
|
bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
|
|
dh_.reset(DH_new());
|
|
@@ -20,7 +20,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
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) {
|
|
|
+@@ -5153,6 +5154,7 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
|
|
|
DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);
|
|
|
return false;
|
|
|
}
|
|
@@ -28,7 +28,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
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) {
|
|
|
+@@ -5168,6 +5170,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());
|
|
@@ -36,7 +36,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
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) {
|
|
|
+@@ -5190,6 +5193,7 @@ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
|
|
|
BN_free(bn_g);
|
|
|
return false;
|
|
|
}
|
|
@@ -44,7 +44,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
return VerifyContext();
|
|
|
}
|
|
|
|
|
|
-@@ -6154,6 +6158,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
+@@ -6157,6 +6161,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
EVPKeyCtxPointer Setup() override {
|
|
|
EVPKeyPointer params;
|
|
|
if (prime_info_.fixed_value_) {
|
|
@@ -52,7 +52,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
DHPointer dh(DH_new());
|
|
|
if (!dh)
|
|
|
return nullptr;
|
|
|
-@@ -6170,6 +6175,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
+@@ -6173,6 +6178,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
params = EVPKeyPointer(EVP_PKEY_new());
|
|
|
CHECK(params);
|
|
|
EVP_PKEY_assign_DH(params.get(), dh.release());
|
|
@@ -60,7 +60,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
} else {
|
|
|
EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
|
|
|
if (!param_ctx)
|
|
|
-@@ -6177,7 +6183,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
+@@ -6180,7 +6186,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
|
|
|
if (EVP_PKEY_paramgen_init(param_ctx.get()) <= 0)
|
|
|
return nullptr;
|
|
@@ -69,7 +69,7 @@ index cd763fd3755357b36e753cf778550cf2d498ed57..dad343e15d0f76bdef9d9cc4e78c7e20
|
|
|
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 {
|
|
|
+@@ -6188,7 +6194,7 @@ class DHKeyPairGenerationConfig : public KeyPairGenerationConfig {
|
|
|
if (EVP_PKEY_CTX_set_dh_paramgen_generator(param_ctx.get(),
|
|
|
generator_) <= 0)
|
|
|
return nullptr;
|