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

Unified Diff: runtime/bin/secure_socket.cc

Issue 102033004: Enable more ciphers, and TLS 1.2, in SecureSocket. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index 0a2547ce25ed4b981ff5d432d041a70ed40daa6a..6fa0a9975dbcefb9384a8f92e541f433642a30c5 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -585,13 +585,38 @@ void SSLFilter::InitializeLibrary(const char* certificate_database,
ThrowPRException("TlsException",
"Failed NSS_SetDomesticPolicy call.");
}
- // Enable TLS, as well as SSL3 and SSL2.
- status = SSL_OptionSetDefault(SSL_ENABLE_TLS, PR_TRUE);
- if (status != SECSuccess) {
- mutex_->Unlock(); // MutexLocker destructor not called when throwing.
- ThrowPRException("TlsException",
- "Failed SSL_OptionSetDefault enable TLS call.");
+
+ // Enable the same additional ciphers that Chromium does.
+ // See NSSSSLInitSingleton() in Chromium's net/socket/nss_ssl_util.cc.
+ // Explicitly enable exactly those ciphers with keys of at least 80 bits.
+ const PRUint16* const ssl_ciphers = SSL_GetImplementedCiphers();
Anders Johnsen 2013/12/04 10:08:57 Do we need to release this buffer somehow?
wtc 2013/12/04 14:35:16 No. SSL_GetImplementedCiphers() returns a pointer
+ const PRUint16 num_ciphers = SSL_GetNumImplementedCiphers();
+ for (int i = 0; i < num_ciphers; i++) {
+ SSLCipherSuiteInfo info;
+ if (SSL_GetCipherSuiteInfo(ssl_ciphers[i], &info, sizeof(info)) ==
+ SECSuccess) {
+ bool enabled = (info.effectiveKeyBits >= 80);
+ // Trim the list of cipher suites in order to keep the size of the
+ // ClientHello down. DSS, ECDH, CAMELLIA, SEED, ECC+3DES, and
+ // HMAC-SHA256 cipher suites are disabled.
+ if (info.symCipher == ssl_calg_camellia ||
+ info.symCipher == ssl_calg_seed ||
+ (info.symCipher == ssl_calg_3des && info.keaType != ssl_kea_rsa) ||
+ info.authAlgorithm == ssl_auth_dsa ||
+ info.macAlgorithm == ssl_hmac_sha256 ||
+ info.nonStandard ||
+ strcmp(info.keaTypeName, "ECDH") == 0) {
+ enabled = false;
+ }
+
+ if (ssl_ciphers[i] == TLS_DHE_DSS_WITH_AES_128_CBC_SHA) {
+ // Enabled to allow servers with only a DSA certificate to function.
+ enabled = true;
+ }
+ SSL_CipherPrefSetDefault(ssl_ciphers[i], enabled);
+ }
}
+
status = SSL_ConfigServerSessionIDCache(0, 0, 0, NULL);
if (status != SECSuccess) {
mutex_->Unlock(); // MutexLocker destructor not called when throwing.
@@ -658,7 +683,7 @@ void SSLFilter::Connect(const char* host_name,
SSLVersionRange vrange;
vrange.min = SSL_LIBRARY_VERSION_3_0;
- vrange.max = SSL_LIBRARY_VERSION_TLS_1_1;
+ vrange.max = SSL_LIBRARY_VERSION_TLS_1_2;
SSL_VersionRangeSet(filter_, &vrange);
SECStatus status;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698