Bug 732390, Add preference to configure acceptance of MD5 in signatures, still accept by default, NSS calls r+=rrelyea, PSM pref code r+=honzab, pref name feedback+=dveditz

This commit is contained in:
Kai Engert 2012-03-10 22:18:13 +01:00
Родитель 61e8de0a07
Коммит eaff5fa503
2 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -1,6 +1,7 @@
pref("security.enable_ssl3", true);
pref("security.enable_tls", true);
pref("security.enable_tls_session_tickets", true);
pref("security.enable_md5_signatures", true);
pref("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref", false);
pref("security.ssl.renego_unrestricted_hosts", "");

Просмотреть файл

@ -1597,6 +1597,26 @@ nsNSSComponent::TryCFM2MachOMigration(nsIFile *cfmPath, nsIFile *machoPath)
}
#endif
static void configureMD5(bool enabled)
{
if (enabled) { // set flags
NSS_SetAlgorithmPolicy(SEC_OID_MD5,
NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE, 0);
NSS_SetAlgorithmPolicy(SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION,
NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE, 0);
NSS_SetAlgorithmPolicy(SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC,
NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE, 0);
}
else { // clear flags
NSS_SetAlgorithmPolicy(SEC_OID_MD5,
0, NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE);
NSS_SetAlgorithmPolicy(SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION,
0, NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE);
NSS_SetAlgorithmPolicy(SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC,
0, NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_CMS_SIGNATURE);
}
}
nsresult
nsNSSComponent::InitializeNSS(bool showWarningBox)
{
@ -1788,6 +1808,8 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
SSL_OptionSetDefault(SSL_ENABLE_SSL3, enabled);
mPrefBranch->GetBoolPref("security.enable_tls", &enabled);
SSL_OptionSetDefault(SSL_ENABLE_TLS, enabled);
mPrefBranch->GetBoolPref("security.enable_md5_signatures", &enabled);
configureMD5(enabled);
// Configure TLS session tickets
mPrefBranch->GetBoolPref("security.enable_tls_session_tickets", &enabled);
@ -2310,6 +2332,10 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
mPrefBranch->GetBoolPref("security.enable_tls", &enabled);
SSL_OptionSetDefault(SSL_ENABLE_TLS, enabled);
clearSessionCache = true;
} else if (prefName.Equals("security.enable_md5_signatures")) {
mPrefBranch->GetBoolPref("security.enable_md5_signatures", &enabled);
configureMD5(enabled);
clearSessionCache = true;
} else if (prefName.Equals("security.enable_tls_session_tickets")) {
mPrefBranch->GetBoolPref("security.enable_tls_session_tickets", &enabled);
SSL_OptionSetDefault(SSL_ENABLE_SESSION_TICKETS, enabled);