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(); |
} |