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

Unified Diff: net/socket/nss_ssl_util.cc

Issue 10830326: net: disable ECDSA ciphersuites on platforms where we can't support it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 4 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
« base/mac/mac_util.mm ('K') | « net/base/ssl_config_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/nss_ssl_util.cc
diff --git a/net/socket/nss_ssl_util.cc b/net/socket/nss_ssl_util.cc
index d262f939dc38bd9db7017663891c7e2dfd2bbafc..503a016e76aafe55c408b583bc5f19472495cedd 100644
--- a/net/socket/nss_ssl_util.cc
+++ b/net/socket/nss_ssl_util.cc
@@ -17,10 +17,17 @@
#include "base/memory/singleton.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
+#include "build/build_config.h"
#include "crypto/nss_util.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
+#if defined(OS_WIN)
+#include "base/win/windows_version.h"
+#elif defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif
+
Mark Mentovai 2012/08/15 02:33:48 Alternative B, if you’re intent on landing this on
namespace net {
class NSSSSLInitSingleton {
@@ -60,6 +67,19 @@ class NSSSSLInitSingleton {
// Enable SSL.
SSL_OptionSetDefault(SSL_SECURITY, PR_TRUE);
+ // Disable ECDSA cipher suites on platforms that do not support ECDSA
+ // signed certificates, as servers may use the presence of such
+ // ciphersuites as a hint to send an ECDSA certificate.
+#if defined(OS_WIN)
+ if (base::win::GetVersion() < base::win::VERSION_VISTA) {
Ryan Sleevi 2012/08/15 01:45:35 nit on the braces here ;)
+ DisableECDSA();
+ }
+#elif defined(OS_MACOSX)
+ if (!base::mac::IsOSSnowLeopardOrLater()) {
Mark Mentovai 2012/08/15 02:19:22 We’ve removed all 10.5-specific code on the trunk.
+ DisableECDSA();
+ }
+#endif
+
// All other SSL options are set per-session by SSLClientSocket and
// SSLServerSocket.
}
@@ -68,6 +88,19 @@ class NSSSSLInitSingleton {
// Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY.
SSL_ClearSessionCache();
}
+
+ void DisableECDSA() {
+ const PRUint16* ciphersuites = SSL_GetImplementedCiphers();
+ const unsigned num_ciphersuites = SSL_GetNumImplementedCiphers();
+ SECStatus rv;
+ SSLCipherSuiteInfo info;
+
+ for (unsigned i = 0; i < num_ciphersuites; i++) {
wtc 2012/08/15 02:38:42 You should merge this for loop with the existing f
+ rv = SSL_GetCipherSuiteInfo(ciphersuites[i], &info, sizeof(info));
+ if (rv == SECSuccess && info.authAlgorithm == ssl_auth_ecdsa)
+ SSL_CipherPrefSetDefault(ciphersuites[i], PR_FALSE);
+ }
+ }
};
static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton =
« base/mac/mac_util.mm ('K') | « net/base/ssl_config_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698