Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: net/ssl/ssl_cipher_suite_names_unittest.cc

Issue 2012353002: Add CECPQ1 ciphers to the cipher suites table. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing mab's comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ssl/ssl_cipher_suite_names.h" 5 #include "net/ssl/ssl_cipher_suite_names.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/stringprintf.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace net { 11 namespace net {
11 12
12 namespace { 13 namespace {
13 14
14 TEST(CipherSuiteNamesTest, Basic) { 15 TEST(CipherSuiteNamesTest, Basic) {
15 const char *key_exchange, *cipher, *mac; 16 const char *key_exchange, *cipher, *mac;
16 bool is_aead; 17 bool is_aead;
17 18
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2( 132 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(
132 0xcc13 /* ECDHE_RSA_WITH_CHACHA20_POLY1305 (non-standard) */)); 133 0xcc13 /* ECDHE_RSA_WITH_CHACHA20_POLY1305 (non-standard) */));
133 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2( 134 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(
134 0xcc14 /* ECDHE_ECDSA_WITH_CHACHA20_POLY1305 (non-standard) */)); 135 0xcc14 /* ECDHE_ECDSA_WITH_CHACHA20_POLY1305 (non-standard) */));
135 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2( 136 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(
136 0xcca8 /* ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 */)); 137 0xcca8 /* ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 */));
137 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2( 138 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(
138 0xcca9 /* ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 */)); 139 0xcca9 /* ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 */));
139 } 140 }
140 141
142 TEST(CipherSuiteNamesTest, CECPQ1) {
143 const std::vector<uint16_t> kCECPQ1CipherSuites = {
144 0x16b7, // TLS_CECPQ1_RSA_WITH_CHACHA20_POLY1305_SHA256 (non-standard)
145 0x16b8, // TLS_CECPQ1_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (non-standard)
146 0x16b9, // TLS_CECPQ1_RSA_WITH_AES_256_GCM_SHA384 (non-standard)
147 0x16ba, // TLS_CECPQ1_ECDSA_WITH_AES_256_GCM_SHA384 (non-standard)
148 };
149 const char *key_exchange, *cipher, *mac;
150 bool is_aead;
151
152 for (const uint16_t cipher_suite_id : kCECPQ1CipherSuites) {
153 SCOPED_TRACE(base::StringPrintf("cipher suite %x", cipher_suite_id));
154 EXPECT_TRUE(IsTLSCipherSuiteAllowedByHTTP2(cipher_suite_id));
155 EXPECT_TRUE(IsSecureTLSCipherSuite(cipher_suite_id));
156 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead,
157 cipher_suite_id);
158 EXPECT_TRUE(is_aead);
159 EXPECT_EQ(nullptr, mac);
160 }
161
162 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b7);
163 EXPECT_STREQ("CECPQ1_RSA", key_exchange);
164 EXPECT_STREQ("CHACHA20_POLY1305", cipher);
165
166 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b8);
167 EXPECT_STREQ("CECPQ1_ECDSA", key_exchange);
168 EXPECT_STREQ("CHACHA20_POLY1305", cipher);
169
170 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16b9);
171 EXPECT_STREQ("CECPQ1_RSA", key_exchange);
172 EXPECT_STREQ("AES_256_GCM", cipher);
173
174 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x16ba);
175 EXPECT_STREQ("CECPQ1_ECDSA", key_exchange);
176 EXPECT_STREQ("AES_256_GCM", cipher);
177 }
178
141 } // anonymous namespace 179 } // anonymous namespace
142 180
143 } // namespace net 181 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698