Skip to content

Commit e9b891c

Browse files
ckerrGitHub Copilot
authored andcommitted
fix(patch): avoid redundant std::get_if<>() call
Ref: nodejs/node#64094 Co-Authored-By: GitHub Copilot <copilot@github.com>
1 parent 6e6a5cf commit e9b891c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ index a26577b36a6f6c22e7bd68de691352d0ba7c64c1..60ec48a68abeac1ef2a5ca7b54be71cf
7272
X509* ca = sk_X509_value(extra_certs.get(), i);
7373

7474
X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca);
75+
diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc
76+
index 81ec6c8f928829fde54aaaacd5de72264b072e03..e5d75b3c27cabaa0c67e95afe56190c4f17c439b 100644
77+
--- a/src/crypto/crypto_dh.cc
78+
+++ b/src/crypto/crypto_dh.cc
79+
@@ -449,11 +449,12 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) {
80+
if (!dh) return {};
81+
82+
key_params = EVPKeyPointer::NewDH(std::move(dh));
83+
- } else if (int* prime_size = std::get_if<int>(&params->params.prime)) {
84+
- auto param_ctx = EVPKeyCtxPointer::NewFromID(EVP_PKEY_DH);
85+
+ } else if (std::holds_alternative<int>(params->params.prime)) {
86+
#ifndef OPENSSL_IS_BORINGSSL
87+
+ auto param_ctx = EVPKeyCtxPointer::NewFromID(EVP_PKEY_DH);
88+
if (!param_ctx.initForParamgen() ||
89+
- !param_ctx.setDhParameters(*prime_size, params->params.generator)) {
90+
+ !param_ctx.setDhParameters(std::get<int>(params->params.prime),
91+
+ params->params.generator)) {
92+
return {};
93+
}
94+
7595
diff --git a/src/crypto/crypto_hash.cc b/src/crypto/crypto_hash.cc
7696
index 946f6850d5e68f0c9197e05625e100b323889a35..bb7ed07f19593ce4c33e602b1881fea85b2a471b 100644
7797
--- a/src/crypto/crypto_hash.cc

0 commit comments

Comments
 (0)