diff --git a/addon/openssl-crypto.cc b/addon/openssl-crypto.cc index 8d8d976..deb9012 100644 --- a/addon/openssl-crypto.cc +++ b/addon/openssl-crypto.cc @@ -5,6 +5,12 @@ // This file provides native crypto hooks for OpenSSL 3 (the default since Node.js 18), // allowing us to skip expensive round-trips between JS and C++. +#include "mongocrypt.h" + +// Electron does not expose OpenSSL, so we cannot use OpenSSL +// functions directly if we're building against Electron: +// https://github.com/electron/electron/issues/13176 +#ifndef ELECTRON_ENSURE_CONFIG_GYPI #include #include #include @@ -13,8 +19,6 @@ #include -#include "mongocrypt.h" - #ifdef _WIN32 #include #else @@ -441,3 +445,13 @@ std::unique_ptr createOpenSSLCryptoHooks() { } // namespace opensslcrypto } // namespace node_mongocrypt + +#else // ELECTRON_ENSURE_CONFIG_GYPI +namespace node_mongocrypt { +namespace opensslcrypto { +std::unique_ptr createOpenSSLCryptoHooks() { + return {}; +} +} +} +#endif // ELECTRON_ENSURE_CONFIG_GYPI