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

Unified Diff: net/ssl/ssl_cipher_suite_names.cc

Issue 291093002: Fail the SPDY transaction if it does not meet TLS base requirements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address forgotten comment. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.h ('k') | net/ssl/ssl_cipher_suite_names_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_cipher_suite_names.cc
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc
index f018857d25005fb21363f5b5e3a77f84832d768b..55b0276ee5c2e2dc860b057edc16c687d5447e44 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -345,4 +345,49 @@ bool ParseSSLCipherString(const std::string& cipher_string,
return false;
}
+bool IsSecureTLSCipherSuite(uint16 cipher_suite) {
+ CipherSuite desired = {0};
+ desired.cipher_suite = cipher_suite;
+
+ void* r = bsearch(&desired,
+ kCipherSuites,
+ arraysize(kCipherSuites),
+ sizeof(kCipherSuites[0]),
+ CipherSuiteCmp);
+
+ if (!r)
+ return false;
+
+ const CipherSuite* cs = static_cast<const CipherSuite*>(r);
+
+ const int key_exchange = cs->encoded >> 8;
+ const int cipher = (cs->encoded >> 3) & 0x1f;
+ const int mac = cs->encoded & 0x7;
+
+ // Only allow forward secure key exchanges.
+ switch (key_exchange) {
+ case 10: // DHE_RSA
+ case 14: // ECDHE_ECDSA
+ case 16: // ECDHE_RSA
+ break;
+ default:
+ return false;
+ }
+
+ switch (cipher) {
+ case 13: // AES_128_GCM
+ case 14: // AES_256_GCM
+ case 17: // CHACHA20_POLY1305
+ break;
+ default:
+ return false;
+ }
+
+ // Only AEADs allowed.
+ if (mac != kAEADMACValue)
+ return false;
+
+ return true;
+}
+
} // namespace net
« no previous file with comments | « net/ssl/ssl_cipher_suite_names.h ('k') | net/ssl/ssl_cipher_suite_names_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698