summaryrefslogtreecommitdiffstats
path: root/crypto/nss_util.h
diff options
context:
space:
mode:
authorgspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 18:49:54 +0000
committergspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 18:49:54 +0000
commitc64b9143b18ce8ec3746c1288c7c1204e8ce6612 (patch)
treeffb0482fb7be708006274e1a3e3d0a29e7030b13 /crypto/nss_util.h
parent18a8ff16490804f05c5f3d939e863c3b09749ede (diff)
downloadchromium_src-c64b9143b18ce8ec3746c1288c7c1204e8ce6612.zip
chromium_src-c64b9143b18ce8ec3746c1288c7c1204e8ce6612.tar.gz
chromium_src-c64b9143b18ce8ec3746c1288c7c1204e8ce6612.tar.bz2
This adds calls to new API for cryptohomed that gives status
of the PKCS#11 initialization of the TPM. Also, add cros_library wrapper calls for new libcros API. BUG=chromium-os:12303 TEST=Ran on device, checked to make sure TPM certs showed up, indicating that status and user PIN were successfully retrieved. Review URL: http://codereview.chromium.org/6838032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/nss_util.h')
-rw-r--r--crypto/nss_util.h37
1 files changed, 27 insertions, 10 deletions
diff --git a/crypto/nss_util.h b/crypto/nss_util.h
index 6cb03a8..3ed79fe 100644
--- a/crypto/nss_util.h
+++ b/crypto/nss_util.h
@@ -86,17 +86,34 @@ bool CheckNSSVersion(const char* version);
// GetPublicNSSKeySlot().
void OpenPersistentNSSDB();
-// Load the opencryptoki library into NSS so that we can access the
-// TPM through NSS. Once this is called, GetPrivateNSSKeySlot() will
-// return the TPM slot if one was found. Returns false if it was
-// unable to load opencryptoki or open the TPM slot.
-bool EnableTPMForNSS();
-
-// Get name for the built-in TPM token on ChromeOS.
-std::string GetTPMTokenName();
+// A delegate class that we can use it to access the cros API for
+// communication with cryptohomed and the TPM.
+class TPMTokenInfoDelegate {
+ public:
+ TPMTokenInfoDelegate();
+ virtual ~TPMTokenInfoDelegate();
+ virtual bool IsTokenReady() const = 0;
+ virtual void GetTokenInfo(std::string* token_name,
+ std::string* user_pin) const = 0;
+};
-// Get the user PIN for the built-in TPM token on ChromeOS.
-std::string GetTPMUserPIN();
+// Indicates that NSS should load the opencryptoki library so that we
+// can access the TPM through NSS. Once this is called,
+// GetPrivateNSSKeySlot() will return the TPM slot if one was found.
+// Takes ownership of the passed-in delegate object so it can access
+// the cros library to talk to cryptohomed.
+void EnableTPMTokenForNSS(TPMTokenInfoDelegate* delegate);
+
+// Get name and user PIN for the built-in TPM token on ChromeOS.
+// Either one can safely be NULL. Should only be called after
+// EnableTPMTokenForNSS has been called with a non-null delegate.
+void GetTPMTokenInfo(std::string* token_name, std::string* user_pin);
+
+// Returns true if the TPM is owned and PKCS#11 initialized with the
+// user and security officer PINs, and has been enabled in NSS by
+// calling EnableTPMForNSS, and opencryptoki has been successfully
+// loaded into NSS.
+bool IsTPMTokenReady();
#endif
// Convert a NSS PRTime value into a base::Time object.