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

Unified Diff: chromeos/network/cert_loader.h

Issue 15649018: Call crypto::InitializeTPMToken on the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 7 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: chromeos/network/cert_loader.h
diff --git a/chromeos/network/cert_loader.h b/chromeos/network/cert_loader.h
index a57d29a362069c05badc8527e98e6cd0816b5e9c..2100f7b110467314ad9f3123cec2f4529d0be680 100644
--- a/chromeos/network/cert_loader.h
+++ b/chromeos/network/cert_loader.h
@@ -19,6 +19,10 @@
#include "net/cert/cert_database.h"
#include "net/cert/x509_certificate.h"
+namespace base {
+class SequencedTaskRunner;
+}
+
namespace crypto {
class SymmetricKey;
}
@@ -77,11 +81,15 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer,
private:
friend class NetworkHandler;
CertLoader();
+ // |crypto_task_runner| is the task runner that any synchronous crypto calls
+ // should be made from. e.g. in Chrome this is the IO thread.
+ void Init(const scoped_refptr<base::SequencedTaskRunner>& crypto_task_runner);
void RequestCertificates();
// This is the cyclic chain of callbacks to initialize the TPM token and to
// kick off the update of the certificate list.
+ void OnPersistentNSSDBOpened();
void InitializeTokenAndLoadCertificates();
void RetryTokenInitializationLater();
void OnTpmIsEnabled(DBusMethodCallStatus call_status,
@@ -91,7 +99,7 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer,
void OnPkcs11GetTpmTokenInfo(DBusMethodCallStatus call_status,
const std::string& token_name,
const std::string& user_pin);
- void InitializeNSSForTPMToken();
+ void OnTPMTokenInitialized(bool success);
// These calls handle the updating of the certificate list after the TPM token
// was initialized.
@@ -119,11 +127,12 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer,
// be left.
enum TPMTokenState {
TPM_STATE_UNKNOWN,
+ TPM_DB_OPENED,
TPM_DISABLED,
TPM_ENABLED,
TPM_TOKEN_READY,
TPM_TOKEN_INFO_RECEIVED,
- TPM_TOKEN_NSS_INITIALIZED,
+ TPM_TOKEN_INITIALIZED,
};
TPMTokenState tpm_token_state_;
@@ -141,6 +150,9 @@ class CHROMEOS_EXPORT CertLoader : public net::CertDatabase::Observer,
base::ThreadChecker thread_checker_;
+ // TaskRunner for crypto calls.
+ scoped_refptr<base::SequencedTaskRunner> crypto_task_runner_;
+
// This factory should be used only for callbacks during TPMToken
// initialization.
base::WeakPtrFactory<CertLoader> initialize_token_factory_;

Powered by Google App Engine
This is Rietveld 408576698