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 = |