diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 10:34:21 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 10:34:21 +0000 |
commit | 14172c8f5b57c8ec6da296c7f1b305cb1946dd12 (patch) | |
tree | ba228884299aa638295874c1402a8bfc248513f0 /crypto/nss_util.h | |
parent | 23bd6c4084302144ab8d81d963019e1b568fe1a8 (diff) | |
download | chromium_src-14172c8f5b57c8ec6da296c7f1b305cb1946dd12.zip chromium_src-14172c8f5b57c8ec6da296c7f1b305cb1946dd12.tar.gz chromium_src-14172c8f5b57c8ec6da296c7f1b305cb1946dd12.tar.bz2 |
Convert blocking chromeos::CryptohomeClient::Pkcs11* methods to async
CryptohomeLibrary::Pkcs11* methods are removed.
crypto::EnsureTPMTokenReady (renamed to InitializeTPMToken) and TPMTokenInfoDelegate::IsTokenReady are also converted to async.
BUG=chromium-os:16552
TEST=Login as a user, open chrome://cryptohome and see "token_name" is displayed correctly, open chrome://settings/certificates and see "Import and Bind to Deviceā¦" button is enabled (can be pushed).
Review URL: http://codereview.chromium.org/9421045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/nss_util.h')
-rw-r--r-- | crypto/nss_util.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/crypto/nss_util.h b/crypto/nss_util.h index 9cfdf0b..fb5049b 100644 --- a/crypto/nss_util.h +++ b/crypto/nss_util.h @@ -8,6 +8,7 @@ #include <string> #include "base/basictypes.h" +#include "base/callback.h" #include "crypto/crypto_export.h" #if defined(USE_NSS) @@ -26,6 +27,9 @@ namespace crypto { class SymmetricKey; +// A callback to handle the result of InitializeTPMToken. +typedef base::Callback<void(bool result)> InitializeTPMTokenCallback; + #if defined(USE_NSS) // EarlySetupForNSSInit performs lightweight setup which must occur before the // process goes multithreaded. This does not initialise NSS. For test, see @@ -93,16 +97,22 @@ CRYPTO_EXPORT void OpenPersistentNSSDB(); // communication with cryptohomed and the TPM. class CRYPTO_EXPORT TPMTokenInfoDelegate { public: + // A callback to handle the result of RequestIsTokenReady. + typedef base::Callback<void(bool result)> RequestIsTokenReadyCallback; + TPMTokenInfoDelegate(); virtual ~TPMTokenInfoDelegate(); // Returns true if the hardware supports a TPM Token and the TPM is enabled. virtual bool IsTokenAvailable() const = 0; - // Returns true if the TPM and PKCS#11 token slot is ready to be used. - // If IsTokenAvailable() is false this should return false. - // If IsTokenAvailable() is true, this should eventually return true. - virtual bool IsTokenReady() const = 0; + // Runs |callback| with true if the TPM and PKCS#11 token slot is ready to be + // used. + // If IsTokenAvailable() is false this should run |callback| with false. + // If IsTokenAvailable() is true, this should eventually run |callback| with + // true. + virtual void RequestIsTokenReady(RequestIsTokenReadyCallback callback) const + = 0; // Fetches token properties. TODO(stevenjb): make this interface asynchronous // so that the implementation does not have to be blocking. @@ -132,9 +142,8 @@ CRYPTO_EXPORT bool IsTPMTokenAvailable(); // loaded into NSS. CRYPTO_EXPORT bool IsTPMTokenReady(); -// Same as IsTPMTokenReady() except this attempts to initialize the token -// if necessary. -CRYPTO_EXPORT bool EnsureTPMTokenReady(); +// Initialize the TPM token. Does nothing if it is already initialized. +CRYPTO_EXPORT void InitializeTPMToken(InitializeTPMTokenCallback callback); // Gets supplemental user key. Creates one in NSS database if it does not exist. // The supplemental user key is used for AES encryption of user data that is |