Fix some gratuitous compile failures under OpenSSL
To test: - ensure openssl files live in /usr/include/openssl - make a config with the following values: ``` rtc_build_ssl = false rtc_ssl_root = "/usr/include/openssl ``` - compile rtc_unittests There will be link errors, but no compile errors. Bug: None Change-Id: I3d28b1613e11a716b11c7def808100ef58ab75f5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358300 Reviewed-by: Florent Castelli <orphis@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42714}
This commit is contained in:
parent
5d6fa7d2fc
commit
7079843bc8
@ -35,6 +35,15 @@ SSL_CTX* NewTlsContext() {
|
|||||||
return SSL_CTX_new(TLS_method());
|
return SSL_CTX_new(TLS_method());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SSL_SESSION* NewSslSession(SSL_CTX* ssl_ctx) {
|
||||||
|
#ifdef OPENSSL_IS_BORINGSSL
|
||||||
|
return SSL_SESSION_new(ssl_ctx);
|
||||||
|
#else
|
||||||
|
return SSL_SESSION_new();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
@ -79,7 +88,7 @@ TEST(OpenSSLSessionCache, InvalidLookupReturnsNullptr) {
|
|||||||
|
|
||||||
TEST(OpenSSLSessionCache, SimpleValidSessionLookup) {
|
TEST(OpenSSLSessionCache, SimpleValidSessionLookup) {
|
||||||
SSL_CTX* ssl_ctx = NewDtlsContext();
|
SSL_CTX* ssl_ctx = NewDtlsContext();
|
||||||
SSL_SESSION* ssl_session = SSL_SESSION_new(ssl_ctx);
|
SSL_SESSION* ssl_session = NewSslSession(ssl_ctx);
|
||||||
|
|
||||||
OpenSSLSessionCache session_cache(SSL_MODE_DTLS, ssl_ctx);
|
OpenSSLSessionCache session_cache(SSL_MODE_DTLS, ssl_ctx);
|
||||||
session_cache.AddSession("webrtc.org", ssl_session);
|
session_cache.AddSession("webrtc.org", ssl_session);
|
||||||
@ -90,8 +99,8 @@ TEST(OpenSSLSessionCache, SimpleValidSessionLookup) {
|
|||||||
|
|
||||||
TEST(OpenSSLSessionCache, AddToExistingReplacesPrevious) {
|
TEST(OpenSSLSessionCache, AddToExistingReplacesPrevious) {
|
||||||
SSL_CTX* ssl_ctx = NewDtlsContext();
|
SSL_CTX* ssl_ctx = NewDtlsContext();
|
||||||
SSL_SESSION* ssl_session_1 = SSL_SESSION_new(ssl_ctx);
|
SSL_SESSION* ssl_session_1 = NewSslSession(ssl_ctx);
|
||||||
SSL_SESSION* ssl_session_2 = SSL_SESSION_new(ssl_ctx);
|
SSL_SESSION* ssl_session_2 = NewSslSession(ssl_ctx);
|
||||||
|
|
||||||
OpenSSLSessionCache session_cache(SSL_MODE_DTLS, ssl_ctx);
|
OpenSSLSessionCache session_cache(SSL_MODE_DTLS, ssl_ctx);
|
||||||
session_cache.AddSession("webrtc.org", ssl_session_1);
|
session_cache.AddSession("webrtc.org", ssl_session_1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user