Skip to content

Commit 577fea0

Browse files
committed
fixup! crypto: split OpenSSL 3, BoringSSL, and legacy backends
1 parent a9d6492 commit 577fea0

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/crypto/crypto_context.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,13 +2044,17 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo<Value>& args) {
20442044
}
20452045

20462046
#if NCRYPTO_USE_OPENSSL3_PROVIDER
2047-
if (!SSL_CTX_set0_tmp_dh_pkey(sc->ctx_.get(), dh.release())) {
2047+
EVPKeyPointer dh_pkey(dh.release());
2048+
if (!SSL_CTX_set0_tmp_dh_pkey(sc->ctx_.get(), dh_pkey.get())) {
20482049
#else
20492050
if (!SSL_CTX_set_tmp_dh(sc->ctx_.get(), dh.get())) {
20502051
#endif
20512052
return THROW_ERR_CRYPTO_OPERATION_FAILED(
20522053
env, "Error setting temp DH parameter");
20532054
}
2055+
#if NCRYPTO_USE_OPENSSL3_PROVIDER
2056+
dh_pkey.release();
2057+
#endif
20542058
}
20552059

20562060
void SecureContext::SetMinProto(const FunctionCallbackInfo<Value>& args) {

src/crypto/crypto_dh.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ void PutDhError(int reason) {
9999
#endif
100100
}
101101

102+
#if defined(OPENSSL_IS_BORINGSSL) || !NCRYPTO_USE_OPENSSL3_PROVIDER
102103
void PutBnError(int reason) {
103104
#ifdef OPENSSL_IS_BORINGSSL
104105
OPENSSL_PUT_ERROR(BN, reason);
105-
#elif NCRYPTO_USE_OPENSSL3_PROVIDER
106-
ERR_raise(ERR_LIB_BN, reason);
107106
#else
108107
ERR_put_error(ERR_LIB_BN, 0, reason, __FILE__, __LINE__);
109108
#endif
110109
}
110+
#endif
111111

112112
void DiffieHellmanGroup(const FunctionCallbackInfo<Value>& args) {
113113
Environment* env = Environment::GetCurrent(args);

0 commit comments

Comments
 (0)