Fix OpenSSL builds

BoringSSL includes cannot be included in an OpenSSL build.
Links the SSL related target against the crypto and ssl libs
the proper way.

Bug: None
Change-Id: I4252e6207815d7d7e35bb8d4d966e3d1b83e659d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358941
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42754}
This commit is contained in:
Florent Castelli 2024-08-09 13:38:33 +00:00 committed by WebRTC LUCI CQ
parent 486aa857b5
commit ccec7e2042
5 changed files with 15 additions and 16 deletions

View File

@ -691,12 +691,6 @@ if (rtc_include_tests && !build_with_chromium) {
] ]
shard_timeout = 900 shard_timeout = 900
} }
# Link unit tests against OpenSSL when not building with BoringSSL.
ldflags = []
if (!rtc_build_ssl) {
ldflags += [ "-lssl" ]
}
} }
if (rtc_enable_google_benchmarks) { if (rtc_enable_google_benchmarks) {

View File

@ -18,8 +18,10 @@ if (!rtc_build_ssl) {
assert(rtc_ssl_root != "", assert(rtc_ssl_root != "",
"You must specify rtc_ssl_root when rtc_build_ssl==0.") "You must specify rtc_ssl_root when rtc_build_ssl==0.")
include_dirs = [ rtc_ssl_root ] include_dirs = [ rtc_ssl_root ]
libs = [
# Note: do not link against OpenSSL here. "crypto",
"ssl",
]
} }
} }

View File

@ -11,6 +11,7 @@
#ifndef RTC_BASE_BORINGSSL_CERTIFICATE_H_ #ifndef RTC_BASE_BORINGSSL_CERTIFICATE_H_
#define RTC_BASE_BORINGSSL_CERTIFICATE_H_ #define RTC_BASE_BORINGSSL_CERTIFICATE_H_
#include <openssl/base.h>
#include <openssl/ossl_typ.h> #include <openssl/ossl_typ.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>

View File

@ -13,6 +13,7 @@
#include <errno.h> #include <errno.h>
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ssl.h>
#include <cstdint> #include <cstdint>
#include <string> #include <string>
@ -21,10 +22,7 @@
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "openssl/base.h"
#include "openssl/ssl.h"
#include "rtc_base/async_socket.h" #include "rtc_base/async_socket.h"
#include "rtc_base/boringssl_certificate.h"
#include "rtc_base/openssl_session_cache.h" #include "rtc_base/openssl_session_cache.h"
#include "rtc_base/socket.h" #include "rtc_base/socket.h"
#include "rtc_base/socket_address.h" #include "rtc_base/socket_address.h"
@ -33,7 +31,10 @@
#include "rtc_base/ssl_identity.h" #include "rtc_base/ssl_identity.h"
#include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/ssl_stream_adapter.h"
#ifdef OPENSSL_IS_BORINGSSL #ifdef OPENSSL_IS_BORINGSSL
#include <openssl/base.h>
#include <openssl/pool.h> #include <openssl/pool.h>
#include "rtc_base/boringssl_certificate.h"
#endif #endif
#include <openssl/x509.h> #include <openssl/x509.h>
#include <string.h> #include <string.h>

View File

@ -12,6 +12,8 @@
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ssl.h>
#include <openssl/stack.h>
#include <openssl/tls1.h> #include <openssl/tls1.h>
#include <cstddef> #include <cstddef>
@ -28,11 +30,6 @@
#include "api/sequence_checker.h" #include "api/sequence_checker.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
#include "openssl/base.h"
#include "openssl/digest.h"
#include "openssl/pool.h"
#include "openssl/stack.h"
#include "rtc_base/boringssl_certificate.h"
#include "rtc_base/buffer.h" #include "rtc_base/buffer.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
@ -43,9 +40,13 @@
#include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/task_utils/repeating_task.h" #include "rtc_base/task_utils/repeating_task.h"
#ifdef OPENSSL_IS_BORINGSSL #ifdef OPENSSL_IS_BORINGSSL
#include <openssl/base.h>
#include <openssl/digest.h>
#include <openssl/dtls1.h> #include <openssl/dtls1.h>
#include <openssl/pool.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include "rtc_base/boringssl_certificate.h"
#include "rtc_base/boringssl_identity.h" #include "rtc_base/boringssl_identity.h"
#else #else
#include "rtc_base/openssl_identity.h" #include "rtc_base/openssl_identity.h"