Skip to content

Commit 81e70d7

Browse files
committed
fix: do not try to use OpenSSL when building for Electron
1 parent b010fa9 commit 81e70d7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Diff for: addon/openssl-crypto.cc

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
// This file provides native crypto hooks for OpenSSL 3 (the default since Node.js 18),
66
// allowing us to skip expensive round-trips between JS and C++.
77

8+
#include "mongocrypt.h"
9+
10+
// Electron does not expose OpenSSL, so we cannot use OpenSSL
11+
// functions directly if we're building against Electron:
12+
// https://github.com/electron/electron/issues/13176
13+
#ifndef ELECTRON_ENSURE_CONFIG_GYPI
814
#include <openssl/crypto.h>
915
#include <openssl/err.h>
1016
#include <openssl/evp.h>
@@ -13,8 +19,6 @@
1319

1420
#include <stdexcept>
1521

16-
#include "mongocrypt.h"
17-
1822
#ifdef _WIN32
1923
#include <windows.h>
2024
#else
@@ -441,3 +445,13 @@ std::unique_ptr<CryptoHooks> createOpenSSLCryptoHooks() {
441445

442446
} // namespace opensslcrypto
443447
} // namespace node_mongocrypt
448+
449+
#else // ELECTRON_ENSURE_CONFIG_GYPI
450+
namespace node_mongocrypt {
451+
namespace opensslcrypto {
452+
std::unique_ptr<CryptoHooks> createOpenSSLCryptoHooks() {
453+
return {};
454+
}
455+
}
456+
}
457+
#endif // ELECTRON_ENSURE_CONFIG_GYPI

0 commit comments

Comments
 (0)