Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: net/base/cert_database_nss.cc

Issue 6580058: NSS: Unlock crypto devices when populating cert manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/cert_database_nss.cc
diff --git a/net/base/cert_database_nss.cc b/net/base/cert_database_nss.cc
index db2c47ad0451e63080c7558a6b87771a99a64ff0..7e1abaa90cc5a515e174aa3b48a6263fcc8ad4a2 100644
--- a/net/base/cert_database_nss.cc
+++ b/net/base/cert_database_nss.cc
@@ -118,6 +118,30 @@ CryptoModule* CertDatabase::GetDefaultModule() const {
return module;
}
+void CertDatabase::ListModules(CryptoModuleList* modules, bool need_rw) const {
+ modules->clear();
+
+ PK11SlotList* slot_list = NULL;
+ // The wincx arg is unused since we don't call PK11_SetIsLoggedInFunc.
+ slot_list = PK11_GetAllTokens(CKM_INVALID_MECHANISM,
+ need_rw ? PR_TRUE : PR_FALSE, // needRW
+ PR_TRUE, // loadCerts (unused)
+ NULL); // wincx
+ if (!slot_list) {
+ LOG(ERROR) << "PK11_GetAllTokens failed: " << PORT_GetError();
+ return;
+ }
+
+ PK11SlotListElement* slot_element = PK11_GetFirstSafe(slot_list);
+ while (slot_element) {
+ modules->push_back(CryptoModule::CreateFromHandle(slot_element->slot));
+ slot_element = PK11_GetNextSafe(slot_list, slot_element,
+ PR_FALSE); // restart
+ }
+
+ PK11_FreeSlotList(slot_list);
+}
+
int CertDatabase::ImportFromPKCS12(
net::CryptoModule* module,
const std::string& data,

Powered by Google App Engine
This is Rietveld 408576698