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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 bool CheckNSSVersion(const char* version) { | 739 bool CheckNSSVersion(const char* version) { |
740 return !!NSS_VersionCheck(version); | 740 return !!NSS_VersionCheck(version); |
741 } | 741 } |
742 | 742 |
743 #if defined(USE_NSS) | 743 #if defined(USE_NSS) |
744 ScopedTestNSSDB::ScopedTestNSSDB() | 744 ScopedTestNSSDB::ScopedTestNSSDB() |
745 : is_open_(g_nss_singleton.Get().OpenTestNSSDB()) { | 745 : is_open_(g_nss_singleton.Get().OpenTestNSSDB()) { |
746 } | 746 } |
747 | 747 |
748 ScopedTestNSSDB::~ScopedTestNSSDB() { | 748 ScopedTestNSSDB::~ScopedTestNSSDB() { |
749 if (NSS_VersionCheck("3.14")) | 749 // TODO(mattm): Close the dababase once NSS 3.14 is required, |
750 g_nss_singleton.Get().CloseTestNSSDB(); | 750 // which fixes https://bugzilla.mozilla.org/show_bug.cgi?id=588269 |
| 751 // Resource leaks are suppressed. http://crbug.com/156433 . |
751 } | 752 } |
752 | 753 |
753 base::Lock* GetNSSWriteLock() { | 754 base::Lock* GetNSSWriteLock() { |
754 return g_nss_singleton.Get().write_lock(); | 755 return g_nss_singleton.Get().write_lock(); |
755 } | 756 } |
756 | 757 |
757 AutoNSSWriteLock::AutoNSSWriteLock() : lock_(GetNSSWriteLock()) { | 758 AutoNSSWriteLock::AutoNSSWriteLock() : lock_(GetNSSWriteLock()) { |
758 // May be NULL if the lock is not needed in our version of NSS. | 759 // May be NULL if the lock is not needed in our version of NSS. |
759 if (lock_) | 760 if (lock_) |
760 lock_->Acquire(); | 761 lock_->Acquire(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 817 |
817 PK11SlotInfo* GetPublicNSSKeySlot() { | 818 PK11SlotInfo* GetPublicNSSKeySlot() { |
818 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 819 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
819 } | 820 } |
820 | 821 |
821 PK11SlotInfo* GetPrivateNSSKeySlot() { | 822 PK11SlotInfo* GetPrivateNSSKeySlot() { |
822 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 823 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
823 } | 824 } |
824 | 825 |
825 } // namespace crypto | 826 } // namespace crypto |
OLD | NEW |