Index: crypto/nss_util_internal.h |
diff --git a/crypto/nss_util_internal.h b/crypto/nss_util_internal.h |
index 056ec28c165d19b39a8c6a5643172216e587793e..2f889f74f779c8faa57d1aeb5f340f2623e0c6e9 100644 |
--- a/crypto/nss_util_internal.h |
+++ b/crypto/nss_util_internal.h |
@@ -7,7 +7,13 @@ |
#include <secmodt.h> |
+#include "base/callback.h" |
#include "crypto/crypto_export.h" |
+#include "crypto/scoped_nss_types.h" |
+ |
+namespace base { |
+class FilePath; |
+} |
// These functions return a type defined in an NSS header, and so cannot be |
// declared in nss_util.h. Hence, they are declared here. |
@@ -38,6 +44,38 @@ class AutoSECMODListReadLock { |
DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); |
}; |
+#if defined(OS_CHROMEOS) |
+// Prepare per-user NSS slot mapping. It is safe to call this function multiple |
+// times. Returns true if the user was added, or false if it already existed. |
+CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( |
+ const std::string& email, |
+ const std::string& username_hash, |
+ bool is_primary_user, |
+ const base::FilePath& path); |
+ |
+// Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been |
+// called first. |
+CRYPTO_EXPORT void InitializeTPMForChromeOSUser( |
+ const std::string& username_hash, |
+ CK_SLOT_ID slot_id); |
+ |
+// Use the software slot as the private slot for user. |
+// InitializeNSSForChromeOSUser must have been called first. |
+CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( |
+ const std::string& username_hash); |
+ |
+// Returns a reference to the public slot for user. |
+CRYPTO_EXPORT ScopedPK11Slot |
+ GetPublicSlotForChromeOSUser(const std::string& username_hash); |
+ |
+// Runs |callback| with the private slot handle when the private slot is loaded |
+// for the given user. If the slot is already loaded, the |callback| will be |
+// run synchronously. |
+CRYPTO_EXPORT void OnPrivateSlotReadyForChromeOSUser( |
+ const std::string& username_hash, |
+ const base::Callback<void(ScopedPK11Slot)>& callback); |
+#endif // defined(OS_CHROMEOS) |
+ |
} // namespace crypto |
#endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |