Revert of Removing #defines previously used for building without BoringSSL/OpenSSL. (patchset #2 id:20001 of https://codereview.webrtc.org/2640513002/ )
Reason for revert:
Broke chromium build, due to a config being removed. Will add it back and remove the dependency in a chromium CL.
Original issue's description:
> Removing #defines previously used for building without BoringSSL/OpenSSL.
>
> These defines don't work any more, so they only cause confusion:
>
> FEATURE_ENABLE_SSL
> HAVE_OPENSSL_SSL_H
> SSL_USE_OPENSSL
>
> BUG=webrtc:7025
>
> Review-Url: https://codereview.webrtc.org/2640513002
> Cr-Commit-Position: refs/heads/master@{#16196}
> Committed: eaa826c2ee
TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7025
Review-Url: https://codereview.webrtc.org/2648003003
Cr-Commit-Position: refs/heads/master@{#16197}
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include "webrtc/base/gunit.h"
|
||||
#include "webrtc/base/helpers.h"
|
||||
#include "webrtc/base/ssladapter.h"
|
||||
#include "webrtc/base/sslconfig.h"
|
||||
#include "webrtc/base/sslidentity.h"
|
||||
#include "webrtc/base/sslstreamadapter.h"
|
||||
#include "webrtc/base/stream.h"
|
||||
@ -64,6 +65,12 @@ static const char kCERT_PEM[] =
|
||||
"UD0A8qfhfDM+LK6rPAnCsVN0NRDY3jvd6rzix9M=\n"
|
||||
"-----END CERTIFICATE-----\n";
|
||||
|
||||
#define MAYBE_SKIP_TEST(feature) \
|
||||
if (!(rtc::SSLStreamAdapter::feature())) { \
|
||||
LOG(LS_INFO) << "Feature disabled... skipping"; \
|
||||
return; \
|
||||
}
|
||||
|
||||
class SSLStreamAdapterTestBase;
|
||||
|
||||
class SSLDummyStreamBase : public rtc::StreamInterface,
|
||||
@ -956,6 +963,7 @@ TEST_P(SSLStreamAdapterTestTLS, TestSetPeerCertificateDigestWithInvalidLength) {
|
||||
// Basic tests: DTLS
|
||||
// Test that we can make a handshake work
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnect) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
TestHandshake();
|
||||
};
|
||||
|
||||
@ -963,12 +971,14 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnect) {
|
||||
// each direction is lost. This gives us predictable loss
|
||||
// rather than having to tune random
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnectWithLostFirstPacket) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetLoseFirstPacket(true);
|
||||
TestHandshake();
|
||||
};
|
||||
|
||||
// Test a handshake with loss and delay
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnectWithLostFirstPacketDelay2s) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetLoseFirstPacket(true);
|
||||
SetDelay(2000);
|
||||
SetHandshakeWait(20000);
|
||||
@ -978,6 +988,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnectWithLostFirstPacketDelay2s) {
|
||||
// Test a handshake with small MTU
|
||||
// Disabled due to https://code.google.com/p/webrtc/issues/detail?id=3910
|
||||
TEST_P(SSLStreamAdapterTestDTLS, DISABLED_TestDTLSConnectWithSmallMtu) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetMtu(700);
|
||||
SetHandshakeWait(20000);
|
||||
TestHandshake();
|
||||
@ -985,17 +996,20 @@ TEST_P(SSLStreamAdapterTestDTLS, DISABLED_TestDTLSConnectWithSmallMtu) {
|
||||
|
||||
// Test transfer -- trivial
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSTransfer) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
TestHandshake();
|
||||
TestTransfer(100);
|
||||
};
|
||||
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSTransferWithLoss) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
TestHandshake();
|
||||
SetLoss(10);
|
||||
TestTransfer(100);
|
||||
};
|
||||
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSTransferWithDamage) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetDamage(); // Must be called first because first packet
|
||||
// write happens at end of handshake.
|
||||
TestHandshake();
|
||||
@ -1012,6 +1026,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSDelayedIdentityWithBogusDigest) {
|
||||
|
||||
// Test DTLS-SRTP with all high ciphers
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpHigh) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> high;
|
||||
high.push_back(rtc::SRTP_AES128_CM_SHA1_80);
|
||||
SetDtlsSrtpCryptoSuites(high, true);
|
||||
@ -1029,6 +1044,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpHigh) {
|
||||
|
||||
// Test DTLS-SRTP with all low ciphers
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpLow) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> low;
|
||||
low.push_back(rtc::SRTP_AES128_CM_SHA1_32);
|
||||
SetDtlsSrtpCryptoSuites(low, true);
|
||||
@ -1046,6 +1062,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpLow) {
|
||||
|
||||
// Test DTLS-SRTP with a mismatch -- should not converge
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpHighLow) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> high;
|
||||
high.push_back(rtc::SRTP_AES128_CM_SHA1_80);
|
||||
std::vector<int> low;
|
||||
@ -1062,6 +1079,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpHighLow) {
|
||||
|
||||
// Test DTLS-SRTP with each side being mixed -- should select high
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpMixed) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> mixed;
|
||||
mixed.push_back(rtc::SRTP_AES128_CM_SHA1_80);
|
||||
mixed.push_back(rtc::SRTP_AES128_CM_SHA1_32);
|
||||
@ -1080,6 +1098,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpMixed) {
|
||||
|
||||
// Test DTLS-SRTP with all GCM-128 ciphers.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCM128) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> gcm128;
|
||||
gcm128.push_back(rtc::SRTP_AEAD_AES_128_GCM);
|
||||
SetDtlsSrtpCryptoSuites(gcm128, true);
|
||||
@ -1097,6 +1116,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCM128) {
|
||||
|
||||
// Test DTLS-SRTP with all GCM-256 ciphers.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCM256) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> gcm256;
|
||||
gcm256.push_back(rtc::SRTP_AEAD_AES_256_GCM);
|
||||
SetDtlsSrtpCryptoSuites(gcm256, true);
|
||||
@ -1114,6 +1134,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCM256) {
|
||||
|
||||
// Test DTLS-SRTP with mixed GCM-128/-256 ciphers -- should not converge.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCMMismatch) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> gcm128;
|
||||
gcm128.push_back(rtc::SRTP_AEAD_AES_128_GCM);
|
||||
std::vector<int> gcm256;
|
||||
@ -1130,6 +1151,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCMMismatch) {
|
||||
|
||||
// Test DTLS-SRTP with both GCM-128/-256 ciphers -- should select GCM-256.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpGCMMixed) {
|
||||
MAYBE_SKIP_TEST(HaveDtlsSrtp);
|
||||
std::vector<int> gcmBoth;
|
||||
gcmBoth.push_back(rtc::SRTP_AEAD_AES_256_GCM);
|
||||
gcmBoth.push_back(rtc::SRTP_AEAD_AES_128_GCM);
|
||||
@ -1177,6 +1199,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSSrtpKeyAndSaltLengths) {
|
||||
|
||||
// Test an exporter
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSExporter) {
|
||||
MAYBE_SKIP_TEST(HaveExporter);
|
||||
TestHandshake();
|
||||
unsigned char client_out[20];
|
||||
unsigned char server_out[20];
|
||||
@ -1199,6 +1222,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestDTLSExporter) {
|
||||
|
||||
// Test not yet valid certificates are not rejected.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestCertNotYetValid) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
long one_day = 60 * 60 * 24;
|
||||
// Make the certificates not valid until one day later.
|
||||
ResetIdentitiesWithValidity(one_day, one_day);
|
||||
@ -1207,6 +1231,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestCertNotYetValid) {
|
||||
|
||||
// Test expired certificates are not rejected.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestCertExpired) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
long one_day = 60 * 60 * 24;
|
||||
// Make the certificates already expired.
|
||||
ResetIdentitiesWithValidity(-one_day, -one_day);
|
||||
@ -1215,12 +1240,15 @@ TEST_P(SSLStreamAdapterTestDTLS, TestCertExpired) {
|
||||
|
||||
// Test data transfer using certs created from strings.
|
||||
TEST_F(SSLStreamAdapterTestDTLSFromPEMStrings, TestTransfer) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
TestHandshake();
|
||||
TestTransfer(100);
|
||||
}
|
||||
|
||||
// Test getting the remote certificate.
|
||||
TEST_F(SSLStreamAdapterTestDTLSFromPEMStrings, TestDTLSGetPeerCertificate) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
|
||||
// Peer certificates haven't been received yet.
|
||||
ASSERT_FALSE(GetPeerCertificate(true));
|
||||
ASSERT_FALSE(GetPeerCertificate(false));
|
||||
@ -1254,6 +1282,7 @@ TEST_F(SSLStreamAdapterTestDTLSFromPEMStrings, TestDTLSGetPeerCertificate) {
|
||||
// Test getting the used DTLS ciphers.
|
||||
// DTLS 1.2 enabled for neither client nor server -> DTLS 1.0 will be used.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuite) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10);
|
||||
TestHandshake();
|
||||
|
||||
@ -1273,6 +1302,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuite) {
|
||||
// Test getting the used DTLS 1.2 ciphers.
|
||||
// DTLS 1.2 enabled for client and server -> DTLS 1.2 will be used.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Both) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12);
|
||||
TestHandshake();
|
||||
|
||||
@ -1291,6 +1321,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Both) {
|
||||
|
||||
// DTLS 1.2 enabled for client only -> DTLS 1.0 will be used.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Client) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12);
|
||||
TestHandshake();
|
||||
|
||||
@ -1309,6 +1340,7 @@ TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Client) {
|
||||
|
||||
// DTLS 1.2 enabled for server only -> DTLS 1.0 will be used.
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Server) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10);
|
||||
TestHandshake();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user