From 1ea175143247fd623322c3e4f8235fdcec827255 Mon Sep 17 00:00:00 2001
From: Eran Rundstein <eran@rundste.in>
Date: Mon, 26 Feb 2024 14:45:10 -0800
Subject: [PATCH 1/2] wip

---
 Cargo.toml |  9 +++++++++
 src/lib.rs | 12 ++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 8960942..3e7c73d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]
 [features]
 vendored = ["openssl/vendored"]
 alpn = ["security-framework/alpn"]
+force-openssl = ["openssl", "openssl-sys", "openssl-probe", "log"]
 
 [target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos"))'.dependencies]
 security-framework = "2.0.0"
@@ -31,6 +32,14 @@ openssl = "0.10.29"
 openssl-sys = "0.9.55"
 openssl-probe = "0.1"
 
+[dependencies]
+log = { version = "0.4.5", optional = true }
+openssl = { version = "0.10.29", optional = true }
+openssl-sys = { version = "0.9.55", optional = true }
+openssl-probe = { version = "0.1", optional = true }
+
+
+
 [dev-dependencies]
 tempfile = "3.0"
 test-cert-gen = "0.9"
diff --git a/src/lib.rs b/src/lib.rs
index cc86502..04da52a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,33 +104,33 @@ use std::fmt;
 use std::io;
 use std::result;
 
-#[cfg(not(any(
+#[cfg(any(feature = "force-openssl", not(any(
     target_os = "macos",
     target_os = "windows",
     target_os = "ios",
     target_os = "watchos",
     target_os = "tvos"
-)))]
+))))]
 #[macro_use]
 extern crate log;
-#[cfg(any(
+#[cfg(all(not(feature = "force-openssl"), any(
     target_os = "macos",
     target_os = "ios",
     target_os = "watchos",
     target_os = "tvos"
-))]
+)))]
 #[path = "imp/security_framework.rs"]
 mod imp;
 #[cfg(target_os = "windows")]
 #[path = "imp/schannel.rs"]
 mod imp;
-#[cfg(not(any(
+#[cfg(any(feature = "force-openssl", not(any(
     target_os = "macos",
     target_os = "windows",
     target_os = "ios",
     target_os = "watchos",
     target_os = "tvos"
-)))]
+))))]
 #[path = "imp/openssl.rs"]
 mod imp;
 

From 8d791e08d1e94f0b7b3cd7c8451e109364d19c54 Mon Sep 17 00:00:00 2001
From: Eran Rundstein <eran@rundste.in>
Date: Mon, 26 Feb 2024 15:08:34 -0800
Subject: [PATCH 2/2] cleanup

---
 Cargo.toml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 3e7c73d..271c6f6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,14 +32,13 @@ openssl = "0.10.29"
 openssl-sys = "0.9.55"
 openssl-probe = "0.1"
 
+# Used when the force-openssl feature is enabled.
 [dependencies]
 log = { version = "0.4.5", optional = true }
 openssl = { version = "0.10.29", optional = true }
 openssl-sys = { version = "0.9.55", optional = true }
 openssl-probe = { version = "0.1", optional = true }
 
-
-
 [dev-dependencies]
 tempfile = "3.0"
 test-cert-gen = "0.9"