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

Unified Diff: crypto/nss_util.cc

Issue 330213002: *wip* NSS: handle chromeos system slot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review #1 changes, remove chromeos/ changes Created 6 years, 6 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: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 5958ad972daf74db958b9c50b88badfef4169b5b..ab099bb3123c540542252a42498ecdf4b3d346b7 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -652,6 +652,21 @@ class NSSInitSingleton {
return PK11_GetInternalKeySlot();
}
+#if defined(OS_CHROMEOS)
+ PK11SlotInfo* GetSystemNSSKeySlot() {
+ // TODO: what about when system slot is disabled?
+ // TODO: can GetPrivateNSSKeySlot be removed / disabled ?
+ if (tpm_token_enabled_for_nss_) {
+ if (IsTPMTokenReady(base::Closure())) {
+ return PK11_ReferenceSlot(tpm_slot_);
+ }
+ }
+ // If we were supposed to get the hardware token, but were
+ // unable to, return NULL rather than fall back to sofware.
+ return NULL;
+ }
+#endif
+
#if defined(USE_NSS)
base::Lock* write_lock() {
return &write_lock_;
@@ -1070,6 +1085,10 @@ AutoSECMODListReadLock::~AutoSECMODListReadLock() {
#endif // defined(USE_NSS)
#if defined(OS_CHROMEOS)
+PK11SlotInfo* GetSystemNSSKeySlot() {
+ return g_nss_singleton.Get().GetSystemNSSKeySlot();
+}
+
void OpenPersistentNSSDB() {
g_nss_singleton.Get().OpenPersistentNSSDB();
}

Powered by Google App Engine
This is Rietveld 408576698