summaryrefslogtreecommitdiffstats
path: root/net/base/ssl_cipher_suite_names_unittest.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-18 16:01:32 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-18 16:01:32 +0000
commitd8654bf1406e9cd0338e9e2c0e18f5295a08efce (patch)
treeab65c080c7cbbb03908f585b4842f28c7d5668f2 /net/base/ssl_cipher_suite_names_unittest.cc
parent19abe9a4b01c5f3933679266a7e8f6647ea59582 (diff)
downloadchromium_src-d8654bf1406e9cd0338e9e2c0e18f5295a08efce.zip
chromium_src-d8654bf1406e9cd0338e9e2c0e18f5295a08efce.tar.gz
chromium_src-d8654bf1406e9cd0338e9e2c0e18f5295a08efce.tar.bz2
net: add ciphersuite and compression to the SSL connection status.
18 bits of the connection status word are reserved for the negotiated cipher suite and compression method. This plumbs those bits for NSS. It also includes a lookup table to convert the cipher suite id into strings for the frontend. Although NSS already has a function which does something similar (SSL_GetCipherSuiteInfo), it's backed by a table which is limited only to those cipher suites which are compiled into NSS. Since we have other SSL library backends (and because we can do a better job of representing the data anyway), we have our own. In the future we might want to compile these tables out of NSS and save some space. BUG=27507 TEST=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/ssl_cipher_suite_names_unittest.cc')
-rw-r--r--net/base/ssl_cipher_suite_names_unittest.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/net/base/ssl_cipher_suite_names_unittest.cc b/net/base/ssl_cipher_suite_names_unittest.cc
new file mode 100644
index 0000000..3a9c2ee
--- /dev/null
+++ b/net/base/ssl_cipher_suite_names_unittest.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/ssl_cipher_suite_names.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+namespace {
+
+TEST(CipherSuiteNamesTest, Basic) {
+ const char *key_exchange, *cipher, *mac;
+ SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, 0xc001);
+ EXPECT_STREQ(key_exchange, "ECDH_ECDSA");
+ EXPECT_STREQ(cipher, "NULL");
+ EXPECT_STREQ(mac, "SHA1");
+
+ SSLCipherSuiteToStrings(&key_exchange, &cipher, &mac, 0xff31);
+ EXPECT_STREQ(key_exchange, "???");
+ EXPECT_STREQ(cipher, "???");
+ EXPECT_STREQ(mac, "???");
+}
+
+} // anonymous namespace
+
+} // namespace net