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

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

Issue 809743005: Add TLS_DHE_RSA_WITH_CHACHA20_POLY1305 to ssl_cipher_suite_names.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 TEST(CipherSuiteNamesTest, Basic) { 14 TEST(CipherSuiteNamesTest, Basic) {
15 const char *key_exchange, *cipher, *mac; 15 const char *key_exchange, *cipher, *mac;
16 bool is_aead; 16 bool is_aead;
17 17
18 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xc001); 18 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xc001);
19 EXPECT_STREQ("ECDH_ECDSA", key_exchange); 19 EXPECT_STREQ("ECDH_ECDSA", key_exchange);
20 EXPECT_STREQ("NULL", cipher); 20 EXPECT_STREQ("NULL", cipher);
21 EXPECT_STREQ("SHA1", mac); 21 EXPECT_STREQ("SHA1", mac);
22 EXPECT_FALSE(is_aead); 22 EXPECT_FALSE(is_aead);
23 23
24 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x009f); 24 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0x009f);
25 EXPECT_STREQ("DHE_RSA", key_exchange); 25 EXPECT_STREQ("DHE_RSA", key_exchange);
26 EXPECT_STREQ("AES_256_GCM", cipher); 26 EXPECT_STREQ("AES_256_GCM", cipher);
27 EXPECT_TRUE(is_aead); 27 EXPECT_TRUE(is_aead);
28 EXPECT_EQ(NULL, mac); 28 EXPECT_EQ(NULL, mac);
29 29
30 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xcc15);
31 EXPECT_STREQ("DHE_RSA", key_exchange);
32 EXPECT_STREQ("CHACHA20_POLY1305", cipher);
33 EXPECT_TRUE(is_aead);
34 EXPECT_EQ(NULL, mac);
35
30 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xff31); 36 SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, &is_aead, 0xff31);
31 EXPECT_STREQ("???", key_exchange); 37 EXPECT_STREQ("???", key_exchange);
32 EXPECT_STREQ("???", cipher); 38 EXPECT_STREQ("???", cipher);
33 EXPECT_STREQ("???", mac); 39 EXPECT_STREQ("???", mac);
34 EXPECT_FALSE(is_aead); 40 EXPECT_FALSE(is_aead);
35 } 41 }
36 42
37 TEST(CipherSuiteNamesTest, ParseSSLCipherString) { 43 TEST(CipherSuiteNamesTest, ParseSSLCipherString) {
38 uint16 cipher_suite = 0; 44 uint16 cipher_suite = 0;
39 EXPECT_TRUE(ParseSSLCipherString("0x0004", &cipher_suite)); 45 EXPECT_TRUE(ParseSSLCipherString("0x0004", &cipher_suite));
(...skipping 23 matching lines...) Expand all
63 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc5)); 69 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc5));
64 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc00f)); 70 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc00f));
65 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc083)); 71 EXPECT_FALSE(IsSecureTLSCipherSuite(0xc083));
66 72
67 // Non-existent cipher suite. 73 // Non-existent cipher suite.
68 EXPECT_FALSE(IsSecureTLSCipherSuite(0xffff)) << "Doesn't exist!"; 74 EXPECT_FALSE(IsSecureTLSCipherSuite(0xffff)) << "Doesn't exist!";
69 75
70 // Secure ones. 76 // Secure ones.
71 EXPECT_TRUE(IsSecureTLSCipherSuite(0xcc13)); 77 EXPECT_TRUE(IsSecureTLSCipherSuite(0xcc13));
72 EXPECT_TRUE(IsSecureTLSCipherSuite(0xcc14)); 78 EXPECT_TRUE(IsSecureTLSCipherSuite(0xcc14));
79 EXPECT_TRUE(IsSecureTLSCipherSuite(0xcc15));
73 } 80 }
74 81
75 } // anonymous namespace 82 } // anonymous namespace
76 83
77 } // namespace net 84 } // 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