Split SSL adapters from main ssl build target 1/2

with an intermediate step since Chromium depends on the openssl_stream_adapter.h which will move to the new target.

BUG=webrtc:339300437

Change-Id: Iea163e0a6e3923ce8a741a2e11e9a2a1e3f3e7a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350887
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42362}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 64028ad..d366f3d 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -346,6 +346,7 @@
     "../rtc_base:network_constants",
     "../rtc_base:rtc_certificate_generator",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "adaptation:resource_adaptation_api",
     "audio:audio_mixer_api",
diff --git a/api/crypto/BUILD.gn b/api/crypto/BUILD.gn
index 8d041ea..5064aff 100644
--- a/api/crypto/BUILD.gn
+++ b/api/crypto/BUILD.gn
@@ -23,7 +23,7 @@
     "crypto_options.h",
   ]
   deps = [
-    "../../rtc_base:ssl",
+    "../../rtc_base:ssl_adapter",
     "../../rtc_base/system:rtc_export",
   ]
 }
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 3d7d19c..3b5b782 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -632,7 +632,7 @@
         deps = [
           ":AppRTCMobile_lib",
           ":apprtc_signaling",
-          "../rtc_base:ssl",
+          "../rtc_base:ssl_adapter",
           "../sdk:mediaconstraints_objc",
           "../sdk:peerconnectionfactory_base_objc",
           "../sdk:videocapture_objc",
@@ -711,7 +711,7 @@
       "../rtc_base:net_helpers",
       "../rtc_base:refcount",
       "../rtc_base:rtc_certificate_generator",
-      "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:stringutils",
       "../rtc_base:threading",
       "../rtc_base/third_party/sigslot",
@@ -870,6 +870,7 @@
       "../rtc_base:network",
       "../rtc_base:socket_address",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:threading",
       "../rtc_base:timeutils",
       "../test:scoped_key_value_config",
diff --git a/examples/androidnativeapi/BUILD.gn b/examples/androidnativeapi/BUILD.gn
index d1088b3..65ab875 100644
--- a/examples/androidnativeapi/BUILD.gn
+++ b/examples/androidnativeapi/BUILD.gn
@@ -51,6 +51,7 @@
       "../../api:scoped_refptr",
       "../../api:sequence_checker",
       "../../rtc_base:ssl",
+      "../../rtc_base:ssl_adapter",
       "../../rtc_base/synchronization:mutex",
       "//api:libjingle_peerconnection_api",
       "//api/rtc_event_log:rtc_event_log_factory",
diff --git a/examples/androidvoip/BUILD.gn b/examples/androidvoip/BUILD.gn
index d390815..c86f899 100644
--- a/examples/androidvoip/BUILD.gn
+++ b/examples/androidvoip/BUILD.gn
@@ -62,7 +62,7 @@
       "../../rtc_base:network",
       "../../rtc_base:socket_address",
       "../../rtc_base:socket_server",
-      "../../rtc_base:ssl",
+      "../../rtc_base:ssl_adapter",
       "../../rtc_base:threading",
       "//api:transport_api",
       "//api/audio_codecs:audio_codecs_api",
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index 96b24d8..7211d8e 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -137,6 +137,7 @@
     "../rtc_base:socket_factory",
     "../rtc_base:socket_server",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stream",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
@@ -250,6 +251,7 @@
     "../rtc_base:socket_address",
     "../rtc_base:socket_factory",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base/system:rtc_export",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
@@ -420,6 +422,7 @@
     "../rtc_base:logging",
     "../rtc_base:socket_address",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stream",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
@@ -454,6 +457,7 @@
     "../api/crypto:options",
     "../rtc_base:callback_list",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
   ]
   absl_deps = [
     "//third_party/abseil-cpp/absl/base:core_headers",
@@ -1095,6 +1099,7 @@
       "../rtc_base:socket_address",
       "../rtc_base:socket_server",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:threading",
       "../rtc_base:timeutils",
       "../rtc_base/network:received_packet",
@@ -1201,6 +1206,7 @@
       "../rtc_base:socket_address",
       "../rtc_base:socket_address_pair",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:stringutils",
       "../rtc_base:testclient",
       "../rtc_base:threading",
@@ -1251,6 +1257,7 @@
     "../rtc_base:socket_adapters",
     "../rtc_base:socket_address",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base/network:received_packet",
     "../rtc_base/third_party/sigslot",
@@ -1305,7 +1312,7 @@
       "../rtc_base:gunit_helpers",
       "../rtc_base:ip_address",
       "../rtc_base:rtc_base_tests_utils",
-      "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../test:test_support",
       "//testing/gtest",
     ]
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index 7d0cac8..546b83a 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -136,7 +136,7 @@
     "../rtc_base:buffer",
     "../rtc_base:checks",
     "../rtc_base:logging",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
 }
@@ -161,7 +161,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:threading",
     "../rtc_base/synchronization:mutex",
   ]
@@ -238,6 +238,7 @@
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
   ]
@@ -323,6 +324,7 @@
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:threading",
     "../rtc_base/third_party/sigslot",
   ]
@@ -516,7 +518,7 @@
     "../p2p:rtc_p2p",
     "../rtc_base:callback_list",
     "../rtc_base:network_route",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
   ]
 }
 
@@ -564,7 +566,7 @@
     "../rtc_base:byte_buffer",
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:logging",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
   ]
   absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
 }
@@ -585,7 +587,7 @@
     "../rtc_base:checks",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:timeutils",
     "../rtc_base/synchronization:mutex",
@@ -623,7 +625,7 @@
     "../rtc_base:logging",
     "../rtc_base:network_route",
     "../rtc_base:safe_conversions",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:zero_memory",
     "../rtc_base/third_party/base64",
   ]
@@ -647,7 +649,7 @@
     "../p2p:ice_transport_internal",
     "../p2p:port",
     "../p2p:rtc_p2p",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
   ]
 }
 
@@ -768,7 +770,7 @@
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:threading",
     "../rtc_base:weak_ptr",
     "../rtc_base/containers:flat_set",
@@ -848,7 +850,7 @@
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
-    "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:threading",
     "../rtc_base:weak_ptr",
   ]
@@ -936,6 +938,7 @@
     "../rtc_base:rtc_event",
     "../rtc_base:socket_address",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
     "../rtc_base:timeutils",
@@ -1034,6 +1037,7 @@
     "../rtc_base:macromagic",
     "../rtc_base:rtc_operations_chain",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
     "../rtc_base:unique_id_generator",
@@ -1155,6 +1159,7 @@
     "../rtc_base:network_constants",
     "../rtc_base:socket_address",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
     "../rtc_base:unique_id_generator",
@@ -1247,6 +1252,7 @@
     "../rtc_base:network_constants",
     "../rtc_base:socket_address",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
     "../rtc_base:timeutils",
@@ -1358,6 +1364,7 @@
     "../rtc_base:logging",
     "../rtc_base:rtc_certificate_generator",
     "../rtc_base:ssl",
+    "../rtc_base:ssl_adapter",
     "../rtc_base:stringutils",
     "../rtc_base:unique_id_generator",
     "../rtc_base:weak_ptr",
@@ -2098,6 +2105,7 @@
       "../rtc_base:rtc_base_tests_utils",
       "../rtc_base:socket_address",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:stringutils",
       "../rtc_base:task_queue_for_test",
       "../rtc_base:threading",
@@ -2442,6 +2450,7 @@
       "../rtc_base:rtc_json",
       "../rtc_base:socket_address",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:stringutils",
       "../rtc_base:task_queue_for_test",
       "../rtc_base:threading",
@@ -2539,7 +2548,7 @@
         "test/android_test_initializer.h",
       ]
       deps = [
-        "../rtc_base:ssl",
+        "../rtc_base:ssl_adapter",
         "../sdk/android:internal_jni",
         "../sdk/android:libjingle_peerconnection_jni",
         "//modules/utility:utility",
@@ -2653,6 +2662,7 @@
       "../rtc_base:safe_conversions",
       "../rtc_base:socket_address",
       "../rtc_base:ssl",
+      "../rtc_base:ssl_adapter",
       "../rtc_base:task_queue_for_test",
       "../rtc_base:threading",
       "../rtc_base:timeutils",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index edf48ee..f6b6439 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1618,6 +1618,11 @@
   }
 }
 
+rtc_library("ssl_adapter") {
+  visibility = [ "*" ]
+  public_deps += [ ":ssl" ]  # no-presubmit-check TODO(webrtc:8603)
+}
+
 rtc_source_set("gtest_prod") {
   sources = [ "gtest_prod_util.h" ]
 }
@@ -2117,6 +2122,7 @@
         ":socket_factory",
         ":socket_server",
         ":ssl",
+        ":ssl_adapter",
         ":ssl_header",
         ":stream",
         ":stringutils",
diff --git a/rtc_tools/data_channel_benchmark/BUILD.gn b/rtc_tools/data_channel_benchmark/BUILD.gn
index abe1b4a..4535372 100644
--- a/rtc_tools/data_channel_benchmark/BUILD.gn
+++ b/rtc_tools/data_channel_benchmark/BUILD.gn
@@ -61,7 +61,7 @@
     "../../rtc_base:logging",
     "../../rtc_base:refcount",
     "../../rtc_base:rtc_event",
-    "../../rtc_base:ssl",
+    "../../rtc_base:ssl_adapter",
     "../../rtc_base:threading",
     "../../system_wrappers:field_trial",
     "//third_party/abseil-cpp/absl/cleanup:cleanup",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 7620217..342dbe9 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -1093,6 +1093,7 @@
         "../rtc_base:rtc_certificate_generator",
         "../rtc_base:safe_conversions",
         "../rtc_base:ssl",
+        "../rtc_base:ssl_adapter",
         "../rtc_base:stringutils",
         "../rtc_base:threading",
         "../rtc_base:timeutils",
@@ -1602,6 +1603,7 @@
         "../rtc_base:buffer",
         "../rtc_base:logging",
         "../rtc_base:ssl",
+        "../rtc_base:ssl_adapter",
         "../rtc_base:threading",
       ]
       if (is_ios) {
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 8c04811..572289e 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -140,7 +140,7 @@
       ":native_api_jni",
       ":video_egl_jni",
       "../../pc:libjingle_peerconnection",
-      "../../rtc_base:ssl",
+      "../../rtc_base:ssl_adapter",
       "//third_party/jni_zero",
     ]
     output_extension = "so"
@@ -1581,7 +1581,7 @@
       ":libjingle_peerconnection_metrics_default_jni",
       ":native_api_jni",
       "../../pc:libjingle_peerconnection",
-      "../../rtc_base:ssl",
+      "../../rtc_base:ssl_adapter",
     ]
     output_extension = "so"
   }
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 9f94917..53eaa71 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -612,7 +612,7 @@
         "../rtc_base:checks",
         "../rtc_base:event_tracer",
         "../rtc_base:logging",
-        "../rtc_base:ssl",
+        "../rtc_base:ssl_adapter",
         "../rtc_base:threading",
         "../system_wrappers:field_trial",
         "../system_wrappers:metrics",