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

Unified Diff: crypto/nss_util.cc

Issue 9969019: Forces TPM slot to be "Friendly", allowing NSS to avoid locking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 48f356c5c584f2b6399c9910a2305c1c37df14ae..9cdab159a8f1dbca0fbc75069f73dd40f35336d8 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -196,6 +196,30 @@ PK11SlotInfo* FindSlotWithTokenName(const std::string& token_name) {
#endif // defined(USE_NSS)
+#if defined(OS_CHROMEOS)
+void LogSlotInfo() {
+ AutoSECMODListReadLock auto_lock;
+ SECMODModuleList* head = SECMOD_GetDefaultModuleList();
+ VLOG(1) << "Current PK11 Slot Status:";
+ for (SECMODModuleList* item = head; item != NULL; item = item->next) {
+ int slot_count = item->module->loaded ? item->module->slotCount : 0;
+ for (int i = 0; i < slot_count; i++) {
+ PK11SlotInfo* slot = item->module->slots[i];
+ if (slot) {
+ VLOG(1) << " ###############################";
+ VLOG(1) << " Token Name : " << PK11_GetTokenName(slot);
+ VLOG(1) << " Slot Name : " << PK11_GetSlotName(slot);
+ VLOG(1) << " Slot ID : " << PK11_GetSlotID(slot);
+ VLOG(1) << " Is Friendly : "
+ << (PK11_IsFriendly(slot) ? "True" : "False");
+ VLOG(1) << " Default Flags: " << PK11_GetDefaultFlags(slot);
+ VLOG(1) << " Need Login : " << (PK11_NeedLogin(slot) ? "Yes" : "No");
+ }
+ }
+ }
+}
+#endif
+
// A singleton to initialize/deinitialize NSPR.
// Separate from the NSS singleton because we initialize NSPR on the UI thread.
// Now that we're leaking the singleton, we could merge back with the NSS
@@ -543,13 +567,18 @@ class NSSInitSingleton {
// slotParams=... -- selects RSA as the only mechanism, and only
// asks for the password when necessary (instead of every
// time, or after a timeout).
- "trustOrder=100 slotParams=(1={slotFlags=[RSA] askpw=only})");
+ "trustOrder=100 slotParams=(1={slotFlags=[RSA,PublicCerts] "
Ryan Sleevi 2012/03/30 18:29:26 I believe you should update the 1= to 0=, based on
+ "askpw=only})");
Ryan Sleevi 2012/03/30 21:05:48 One more thing to try here: This will help determ
Ryan Sleevi 2012/03/30 21:07:14 Sorry, that should be: for (int i = 0; friendly_en
}
if (chaps_module_) {
// If this gets set, then we'll use the TPM for certs with
// private keys, otherwise we'll fall back to the software
// implementation.
tpm_slot_ = GetTPMSlot();
+
+ if (VLOG_IS_ON(1))
+ LogSlotInfo();
+
callback.Run(tpm_slot_ != NULL);
return;
}
@@ -637,7 +666,6 @@ bool NSSInitSingleton::force_nodb_init_ = false;
base::LazyInstance<NSSInitSingleton>::Leaky
g_nss_singleton = LAZY_INSTANCE_INITIALIZER;
-
} // namespace
#if defined(USE_NSS)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698