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 // The Linux SUID sandbox would prevent opening user security modules anyway, |
| 655 // but it's more correct to tell NSS to not do it. |
| 656 // Loading user security modules would have security implications. |
| 657 crypto::ForceNSSNoDBInit(); |
| 658 // Initialize NSS. |
| 659 crypto::EnsureNSSInit(); |
| 660 } |
| 661 |
653 void EnsureNSSInit() { | 662 void EnsureNSSInit() { |
654 // Initializing SSL causes us to do blocking IO. | 663 // Initializing SSL causes us to do blocking IO. |
655 // Temporarily allow it until we fix | 664 // Temporarily allow it until we fix |
656 // http://code.google.com/p/chromium/issues/detail?id=59847 | 665 // http://code.google.com/p/chromium/issues/detail?id=59847 |
657 base::ThreadRestrictions::ScopedAllowIO allow_io; | 666 base::ThreadRestrictions::ScopedAllowIO allow_io; |
658 g_nss_singleton.Get(); | 667 g_nss_singleton.Get(); |
659 } | 668 } |
660 | 669 |
661 void ForceNSSNoDBInit() { | 670 void ForceNSSNoDBInit() { |
662 NSSInitSingleton::ForceNoDBInit(); | 671 NSSInitSingleton::ForceNoDBInit(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 | 805 |
797 PK11SlotInfo* GetPublicNSSKeySlot() { | 806 PK11SlotInfo* GetPublicNSSKeySlot() { |
798 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 807 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
799 } | 808 } |
800 | 809 |
801 PK11SlotInfo* GetPrivateNSSKeySlot() { | 810 PK11SlotInfo* GetPrivateNSSKeySlot() { |
802 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 811 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
803 } | 812 } |
804 | 813 |
805 } // namespace crypto | 814 } // namespace crypto |
OLD | NEW |