Chromium Code Reviews| 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 <plarena.h> | 9 #include <plarena.h> |
| 10 #include <prerror.h> | 10 #include <prerror.h> |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 FilePath database_dir = GetInitialConfigDirectory(); | 643 FilePath database_dir = GetInitialConfigDirectory(); |
| 644 if (!database_dir.empty()) | 644 if (!database_dir.empty()) |
| 645 UseLocalCacheOfNSSDatabaseIfNFS(database_dir); | 645 UseLocalCacheOfNSSDatabaseIfNFS(database_dir); |
| 646 } | 646 } |
| 647 #endif | 647 #endif |
| 648 | 648 |
| 649 void EnsureNSPRInit() { | 649 void EnsureNSPRInit() { |
| 650 g_nspr_singleton.Get(); | 650 g_nspr_singleton.Get(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void WarmUpNSSSafely() { | |
| 654 // We might fork, but we haven't loaded any security modules. | |
| 655 crypto::DisableNSSForkCheck(); | |
| 656 // If we're sandboxed, we shouldn't be able to open user security modules, | |
| 657 // but it's more correct to tell NSS to not even try. | |
| 658 // Loading user security modules would have security implications. | |
| 659 crypto::ForceNSSNoDBInit(); | |
| 660 // Initialize NSS. | |
| 661 crypto::EnsureNSSInit(); | |
|
wtc
2012/11/21 00:28:21
Remove the crypto:: prefixes because this is insid
| |
| 662 } | |
| 663 | |
| 653 void EnsureNSSInit() { | 664 void EnsureNSSInit() { |
| 654 // Initializing SSL causes us to do blocking IO. | 665 // Initializing SSL causes us to do blocking IO. |
| 655 // Temporarily allow it until we fix | 666 // Temporarily allow it until we fix |
| 656 // http://code.google.com/p/chromium/issues/detail?id=59847 | 667 // http://code.google.com/p/chromium/issues/detail?id=59847 |
| 657 base::ThreadRestrictions::ScopedAllowIO allow_io; | 668 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 658 g_nss_singleton.Get(); | 669 g_nss_singleton.Get(); |
| 659 } | 670 } |
| 660 | 671 |
| 661 void ForceNSSNoDBInit() { | 672 void ForceNSSNoDBInit() { |
| 662 NSSInitSingleton::ForceNoDBInit(); | 673 NSSInitSingleton::ForceNoDBInit(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 | 807 |
| 797 PK11SlotInfo* GetPublicNSSKeySlot() { | 808 PK11SlotInfo* GetPublicNSSKeySlot() { |
| 798 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 809 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
| 799 } | 810 } |
| 800 | 811 |
| 801 PK11SlotInfo* GetPrivateNSSKeySlot() { | 812 PK11SlotInfo* GetPrivateNSSKeySlot() { |
| 802 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 813 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
| 803 } | 814 } |
| 804 | 815 |
| 805 } // namespace crypto | 816 } // namespace crypto |
| OLD | NEW |