Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1059 // It's kCERT_PEM | 1059 // It's kCERT_PEM |
| 1060 ASSERT_EQ(kCERT_PEM, server_peer_cert->ToPEMString()); | 1060 ASSERT_EQ(kCERT_PEM, server_peer_cert->ToPEMString()); |
| 1061 | 1061 |
| 1062 // It must not have a chain, because the test certs are self-signed. | 1062 // It must not have a chain, because the test certs are self-signed. |
| 1063 rtc::SSLCertChain* server_peer_chain; | 1063 rtc::SSLCertChain* server_peer_chain; |
| 1064 ASSERT_FALSE(server_peer_cert->GetChain(&server_peer_chain)); | 1064 ASSERT_FALSE(server_peer_cert->GetChain(&server_peer_chain)); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 // Test getting the used DTLS ciphers. | 1067 // Test getting the used DTLS ciphers. |
| 1068 // DTLS 1.2 enabled for neither client nor server -> DTLS 1.0 will be used. | 1068 // DTLS 1.2 enabled for neither client nor server -> DTLS 1.0 will be used. |
| 1069 // Disabled due to new BoringSSLL version, see webrtc:5634 | 1069 TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuite) { |
| 1070 TEST_P(SSLStreamAdapterTestDTLS, DISABLED_TestGetSslCipherSuite) { | |
| 1071 MAYBE_SKIP_TEST(HaveDtls); | 1070 MAYBE_SKIP_TEST(HaveDtls); |
| 1072 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10); | 1071 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_10); |
| 1073 TestHandshake(); | 1072 TestHandshake(); |
| 1074 | 1073 |
| 1075 int client_cipher; | 1074 int client_cipher; |
| 1076 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); | 1075 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); |
| 1077 int server_cipher; | 1076 int server_cipher; |
| 1078 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); | 1077 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); |
| 1079 | 1078 |
| 1080 ASSERT_EQ(client_cipher, server_cipher); | 1079 ASSERT_EQ(client_cipher, server_cipher); |
| 1081 ASSERT_EQ( | 1080 ASSERT_TRUE(rtc::SSLStreamAdapter::IsAcceptableCipher( |
| 1082 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( | 1081 server_cipher, ::testing::get<1>(GetParam()).type())); |
| 1083 rtc::SSL_PROTOCOL_DTLS_10, ::testing::get<1>(GetParam()).type()), | |
| 1084 server_cipher); | |
| 1085 } | 1082 } |
| 1086 | 1083 |
| 1087 // Test getting the used DTLS 1.2 ciphers. | 1084 // Test getting the used DTLS 1.2 ciphers. |
| 1088 // DTLS 1.2 enabled for client and server -> DTLS 1.2 will be used. | 1085 // DTLS 1.2 enabled for client and server -> DTLS 1.2 will be used. |
| 1089 TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Both) { | 1086 TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Both) { |
| 1090 MAYBE_SKIP_TEST(HaveDtls); | 1087 MAYBE_SKIP_TEST(HaveDtls); |
| 1091 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12); | 1088 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_12); |
| 1092 TestHandshake(); | 1089 TestHandshake(); |
| 1093 | 1090 |
| 1094 int client_cipher; | 1091 int client_cipher; |
| 1095 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); | 1092 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); |
| 1096 int server_cipher; | 1093 int server_cipher; |
| 1097 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); | 1094 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); |
| 1098 | 1095 |
| 1099 ASSERT_EQ(client_cipher, server_cipher); | 1096 ASSERT_EQ(client_cipher, server_cipher); |
| 1100 ASSERT_EQ( | 1097 ASSERT_TRUE(rtc::SSLStreamAdapter::IsAcceptableCipher( |
| 1101 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( | 1098 server_cipher, ::testing::get<1>(GetParam()).type())); |
| 1102 rtc::SSL_PROTOCOL_DTLS_12, ::testing::get<1>(GetParam()).type()), | |
| 1103 server_cipher); | |
| 1104 } | 1099 } |
| 1105 | 1100 |
| 1106 // DTLS 1.2 enabled for client only -> DTLS 1.0 will be used. | 1101 // DTLS 1.2 enabled for client only -> DTLS 1.0 will be used. |
| 1107 // Disabled due to new BoringSSLL version, see webrtc:5634 | 1102 TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Client) { |
| 1108 TEST_P(SSLStreamAdapterTestDTLS, DISABLED_TestGetSslCipherSuiteDtls12Client) { | |
| 1109 MAYBE_SKIP_TEST(HaveDtls); | 1103 MAYBE_SKIP_TEST(HaveDtls); |
| 1110 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); | 1104 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_10, rtc::SSL_PROTOCOL_DTLS_12); |
| 1111 TestHandshake(); | 1105 TestHandshake(); |
| 1112 | 1106 |
| 1113 int client_cipher; | 1107 int client_cipher; |
| 1114 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); | 1108 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); |
| 1115 int server_cipher; | 1109 int server_cipher; |
| 1116 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); | 1110 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); |
| 1117 | 1111 |
| 1118 ASSERT_EQ(client_cipher, server_cipher); | 1112 ASSERT_EQ(client_cipher, server_cipher); |
| 1119 ASSERT_EQ( | 1113 ASSERT_TRUE(rtc::SSLStreamAdapter::IsAcceptableCipher( |
| 1120 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( | 1114 server_cipher, ::testing::get<1>(GetParam()).type())); |
| 1121 rtc::SSL_PROTOCOL_DTLS_10, ::testing::get<1>(GetParam()).type()), | |
|
davidben_webrtc
2016/03/08 20:29:05
Before, I think you were implicitly checking the r
torbjorng (webrtc)
2016/03/09 13:10:31
I don't think the old test had as a main objective
| |
| 1122 server_cipher); | |
| 1123 } | 1115 } |
| 1124 | 1116 |
| 1125 // DTLS 1.2 enabled for server only -> DTLS 1.0 will be used. | 1117 // DTLS 1.2 enabled for server only -> DTLS 1.0 will be used. |
| 1126 // Disabled due to new BoringSSLL version, see webrtc:5634 | 1118 TEST_P(SSLStreamAdapterTestDTLS, TestGetSslCipherSuiteDtls12Server) { |
| 1127 TEST_P(SSLStreamAdapterTestDTLS, DISABLED_TestGetSslCipherSuiteDtls12Server) { | |
| 1128 MAYBE_SKIP_TEST(HaveDtls); | 1119 MAYBE_SKIP_TEST(HaveDtls); |
| 1129 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10); | 1120 SetupProtocolVersions(rtc::SSL_PROTOCOL_DTLS_12, rtc::SSL_PROTOCOL_DTLS_10); |
| 1130 TestHandshake(); | 1121 TestHandshake(); |
| 1131 | 1122 |
| 1132 int client_cipher; | 1123 int client_cipher; |
| 1133 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); | 1124 ASSERT_TRUE(GetSslCipherSuite(true, &client_cipher)); |
| 1134 int server_cipher; | 1125 int server_cipher; |
| 1135 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); | 1126 ASSERT_TRUE(GetSslCipherSuite(false, &server_cipher)); |
| 1136 | 1127 |
| 1137 ASSERT_EQ(client_cipher, server_cipher); | 1128 ASSERT_EQ(client_cipher, server_cipher); |
| 1138 ASSERT_EQ( | 1129 ASSERT_TRUE(rtc::SSLStreamAdapter::IsAcceptableCipher( |
| 1139 rtc::SSLStreamAdapter::GetDefaultSslCipherForTest( | 1130 server_cipher, ::testing::get<1>(GetParam()).type())); |
| 1140 rtc::SSL_PROTOCOL_DTLS_10, ::testing::get<1>(GetParam()).type()), | |
| 1141 server_cipher); | |
| 1142 } | 1131 } |
| 1143 | 1132 |
| 1144 // The RSA keysizes here might look strange, why not include the RFC's size | 1133 // The RSA keysizes here might look strange, why not include the RFC's size |
| 1145 // 2048?. The reason is test case slowness; testing two sizes to exercise | 1134 // 2048?. The reason is test case slowness; testing two sizes to exercise |
| 1146 // parametrization is sufficient. | 1135 // parametrization is sufficient. |
| 1147 INSTANTIATE_TEST_CASE_P( | 1136 INSTANTIATE_TEST_CASE_P( |
| 1148 SSLStreamAdapterTestsTLS, | 1137 SSLStreamAdapterTestsTLS, |
| 1149 SSLStreamAdapterTestTLS, | 1138 SSLStreamAdapterTestTLS, |
| 1150 Combine(Values(rtc::KeyParams::RSA(1024, 65537), | 1139 Combine(Values(rtc::KeyParams::RSA(1024, 65537), |
| 1151 rtc::KeyParams::RSA(1152, 65537), | 1140 rtc::KeyParams::RSA(1152, 65537), |
| 1152 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), | 1141 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), |
| 1153 Values(rtc::KeyParams::RSA(1024, 65537), | 1142 Values(rtc::KeyParams::RSA(1024, 65537), |
| 1154 rtc::KeyParams::RSA(1152, 65537), | 1143 rtc::KeyParams::RSA(1152, 65537), |
| 1155 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); | 1144 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); |
| 1156 INSTANTIATE_TEST_CASE_P( | 1145 INSTANTIATE_TEST_CASE_P( |
| 1157 SSLStreamAdapterTestsDTLS, | 1146 SSLStreamAdapterTestsDTLS, |
| 1158 SSLStreamAdapterTestDTLS, | 1147 SSLStreamAdapterTestDTLS, |
| 1159 Combine(Values(rtc::KeyParams::RSA(1024, 65537), | 1148 Combine(Values(rtc::KeyParams::RSA(1024, 65537), |
| 1160 rtc::KeyParams::RSA(1152, 65537), | 1149 rtc::KeyParams::RSA(1152, 65537), |
| 1161 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), | 1150 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)), |
| 1162 Values(rtc::KeyParams::RSA(1024, 65537), | 1151 Values(rtc::KeyParams::RSA(1024, 65537), |
| 1163 rtc::KeyParams::RSA(1152, 65537), | 1152 rtc::KeyParams::RSA(1152, 65537), |
| 1164 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); | 1153 rtc::KeyParams::ECDSA(rtc::EC_NIST_P256)))); |
| OLD | NEW |