| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 static PK11SlotInfo* OpenUserDB(const base::FilePath& path, | 866 static PK11SlotInfo* OpenUserDB(const base::FilePath& path, |
| 867 const std::string& description) { | 867 const std::string& description) { |
| 868 const std::string modspec = | 868 const std::string modspec = |
| 869 base::StringPrintf("configDir='sql:%s' tokenDescription='%s'", | 869 base::StringPrintf("configDir='sql:%s' tokenDescription='%s'", |
| 870 path.value().c_str(), | 870 path.value().c_str(), |
| 871 description.c_str()); | 871 description.c_str()); |
| 872 PK11SlotInfo* db_slot = SECMOD_OpenUserDB(modspec.c_str()); | 872 PK11SlotInfo* db_slot = SECMOD_OpenUserDB(modspec.c_str()); |
| 873 if (db_slot) { | 873 if (db_slot) { |
| 874 if (PK11_NeedUserInit(db_slot)) | 874 if (PK11_NeedUserInit(db_slot)) |
| 875 PK11_InitPin(db_slot, NULL, NULL); | 875 PK11_InitPin(db_slot, NULL, NULL); |
| 876 } | 876 } else { |
| 877 else { | |
| 878 LOG(ERROR) << "Error opening persistent database (" << modspec | 877 LOG(ERROR) << "Error opening persistent database (" << modspec |
| 879 << "): " << GetNSSErrorMessage(); | 878 << "): " << GetNSSErrorMessage(); |
| 880 } | 879 } |
| 881 return db_slot; | 880 return db_slot; |
| 882 } | 881 } |
| 883 | 882 |
| 884 static void DisableAESNIIfNeeded() { | 883 static void DisableAESNIIfNeeded() { |
| 885 if (NSS_VersionCheck("3.15") && !NSS_VersionCheck("3.15.4")) { | 884 if (NSS_VersionCheck("3.15") && !NSS_VersionCheck("3.15.4")) { |
| 886 // Some versions of NSS have a bug that causes AVX instructions to be | 885 // Some versions of NSS have a bug that causes AVX instructions to be |
| 887 // used without testing whether XSAVE is enabled by the operating system. | 886 // used without testing whether XSAVE is enabled by the operating system. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 | 1161 |
| 1163 PRTime BaseTimeToPRTime(base::Time time) { | 1162 PRTime BaseTimeToPRTime(base::Time time) { |
| 1164 return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue(); | 1163 return time.ToInternalValue() - base::Time::UnixEpoch().ToInternalValue(); |
| 1165 } | 1164 } |
| 1166 | 1165 |
| 1167 PK11SlotInfo* GetPersistentNSSKeySlot() { | 1166 PK11SlotInfo* GetPersistentNSSKeySlot() { |
| 1168 return g_nss_singleton.Get().GetPersistentNSSKeySlot(); | 1167 return g_nss_singleton.Get().GetPersistentNSSKeySlot(); |
| 1169 } | 1168 } |
| 1170 | 1169 |
| 1171 } // namespace crypto | 1170 } // namespace crypto |
| OLD | NEW |