Relanding: 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@{#16224}
This commit is contained in:
@ -19,7 +19,6 @@
|
||||
#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"
|
||||
@ -65,12 +64,6 @@ 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,
|
||||
@ -963,7 +956,6 @@ TEST_P(SSLStreamAdapterTestTLS, TestSetPeerCertificateDigestWithInvalidLength) {
|
||||
// Basic tests: DTLS
|
||||
// Test that we can make a handshake work
|
||||
TEST_P(SSLStreamAdapterTestDTLS, TestDTLSConnect) {
|
||||
MAYBE_SKIP_TEST(HaveDtls);
|
||||
TestHandshake();
|
||||
};
|
||||
|
||||
@ -971,14 +963,12 @@ 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);
|
||||
@ -988,7 +978,6 @@ 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();
|
||||
@ -996,20 +985,17 @@ 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();
|
||||
@ -1026,7 +1012,6 @@ 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);
|
||||
@ -1044,7 +1029,6 @@ 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);
|
||||
@ -1062,7 +1046,6 @@ 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;
|
||||
@ -1079,7 +1062,6 @@ 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);
|
||||
@ -1098,7 +1080,6 @@ 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);
|
||||
@ -1116,7 +1097,6 @@ 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);
|
||||
@ -1134,7 +1114,6 @@ 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;
|
||||
@ -1151,7 +1130,6 @@ 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);
|
||||
@ -1199,7 +1177,6 @@ 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];
|
||||
@ -1222,7 +1199,6 @@ 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);
|
||||
@ -1231,7 +1207,6 @@ 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);
|
||||
@ -1240,15 +1215,12 @@ 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));
|
||||
@ -1282,7 +1254,6 @@ 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();
|
||||
|
||||
@ -1302,7 +1273,6 @@ 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();
|
||||
|
||||
@ -1321,7 +1291,6 @@ 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();
|
||||
|
||||
@ -1340,7 +1309,6 @@ 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