| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "crypto/nss_util.h" | 5 #include "crypto/nss_util.h" |
| 6 #include "crypto/nss_util_internal.h" | 6 #include "crypto/nss_util_internal.h" |
| 7 | 7 |
| 8 #include <nss.h> | 8 #include <nss.h> |
| 9 #include <pk11pub.h> | 9 #include <pk11pub.h> |
| 10 #include <plarena.h> | 10 #include <plarena.h> |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 static void DisableAESNIIfNeeded() { | 828 static void DisableAESNIIfNeeded() { |
| 829 if (NSS_VersionCheck("3.15") && !NSS_VersionCheck("3.15.4")) { | 829 if (NSS_VersionCheck("3.15") && !NSS_VersionCheck("3.15.4")) { |
| 830 // Some versions of NSS have a bug that causes AVX instructions to be | 830 // Some versions of NSS have a bug that causes AVX instructions to be |
| 831 // used without testing whether XSAVE is enabled by the operating system. | 831 // used without testing whether XSAVE is enabled by the operating system. |
| 832 // In order to work around this, we disable AES-NI in NSS when we find | 832 // In order to work around this, we disable AES-NI in NSS when we find |
| 833 // that |has_avx()| is false (which includes the XSAVE test). See | 833 // that |has_avx()| is false (which includes the XSAVE test). See |
| 834 // https://bugzilla.mozilla.org/show_bug.cgi?id=940794 | 834 // https://bugzilla.mozilla.org/show_bug.cgi?id=940794 |
| 835 base::CPU cpu; | 835 base::CPU cpu; |
| 836 | 836 |
| 837 if (cpu.has_avx_hardware() && !cpu.has_avx()) { | 837 if (cpu.has_avx_hardware() && !cpu.has_avx()) { |
| 838 base::Environment::Create()->SetVar("NSS_DISABLE_HW_AES", "1"); | 838 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 839 env->SetVar("NSS_DISABLE_HW_AES", "1"); |
| 839 } | 840 } |
| 840 } | 841 } |
| 841 } | 842 } |
| 842 | 843 |
| 843 // If this is set to true NSS is forced to be initialized without a DB. | 844 // If this is set to true NSS is forced to be initialized without a DB. |
| 844 static bool force_nodb_init_; | 845 static bool force_nodb_init_; |
| 845 | 846 |
| 846 bool tpm_token_enabled_for_nss_; | 847 bool tpm_token_enabled_for_nss_; |
| 847 bool initializing_tpm_token_; | 848 bool initializing_tpm_token_; |
| 848 typedef std::vector<base::Closure> TPMReadyCallbackList; | 849 typedef std::vector<base::Closure> TPMReadyCallbackList; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue(); | 1096 return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue(); |
| 1096 } | 1097 } |
| 1097 | 1098 |
| 1098 #if !defined(OS_CHROMEOS) | 1099 #if !defined(OS_CHROMEOS) |
| 1099 PK11SlotInfo* GetPersistentNSSKeySlot() { | 1100 PK11SlotInfo* GetPersistentNSSKeySlot() { |
| 1100 return g_nss_singleton.Get().GetPersistentNSSKeySlot(); | 1101 return g_nss_singleton.Get().GetPersistentNSSKeySlot(); |
| 1101 } | 1102 } |
| 1102 #endif | 1103 #endif |
| 1103 | 1104 |
| 1104 } // namespace crypto | 1105 } // namespace crypto |
| OLD | NEW |