diff options
author | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 04:17:00 +0000 |
---|---|---|
committer | stevenjb@chromium.org <stevenjb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-15 04:17:00 +0000 |
commit | 20ba9d8a3e2ffaf02ea7cc300bba52bbb040606c (patch) | |
tree | 4078a9071182e56942447c74383f22876cc5da11 /chrome/browser/chromeos | |
parent | de37df5047683325f5189c5d54c41f704a624fbe (diff) | |
download | chromium_src-20ba9d8a3e2ffaf02ea7cc300bba52bbb040606c.zip chromium_src-20ba9d8a3e2ffaf02ea7cc300bba52bbb040606c.tar.gz chromium_src-20ba9d8a3e2ffaf02ea7cc300bba52bbb040606c.tar.bz2 |
Make nss/TPM integration in ChromeOS more robust.
Change-Id: I09e942098cb780f110c115f5097f57e8344170cb
BUG=chromium-os:26177
TEST=See issue. Ensure certificates still work with VPN and wifi.
Review URL: http://codereview.chromium.org/9389028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/login/user_manager.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc index e4c7390..4fde9b3 100644 --- a/chrome/browser/chromeos/login/user_manager.cc +++ b/chrome/browser/chromeos/login/user_manager.cc @@ -238,15 +238,19 @@ bool RealTPMTokenInfoDelegate::IsTokenAvailable() const { } bool RealTPMTokenInfoDelegate::IsTokenReady() const { + // Note: This should only be getting called from the UI thread, however + // if this does get called from another thread and token_ready_ is true, + // we can safely just return true here. + // TODO(stevenjb/gspencer): Clean this up to improve thread safety. + if (token_ready_) + return true; CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (!token_ready_) { - // Retrieve token_name_ and user_pin_ here since they will never change - // and CryptohomeLibrary calls are not thread safe. - if (CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11IsTpmTokenReady()) { - CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11GetTpmTokenInfo( - &token_name_, &user_pin_); - token_ready_ = true; - } + // Retrieve token_name_ and user_pin_ here since they will never change + // and CryptohomeLibrary calls are not thread safe. + if (CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11IsTpmTokenReady()) { + CrosLibrary::Get()->GetCryptohomeLibrary()->Pkcs11GetTpmTokenInfo( + &token_name_, &user_pin_); + token_ready_ = true; } return token_ready_; } @@ -725,6 +729,7 @@ void UserManager::StubUserLoggedIn() { } void UserManager::NotifyOnLogin() { + CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); content::NotificationService::current()->Notify( chrome::NOTIFICATION_LOGIN_USER_CHANGED, content::Source<UserManager>(this), @@ -752,6 +757,7 @@ void UserManager::NotifyOnLogin() { crypto::EnableTPMTokenForNSS(new RealTPMTokenInfoDelegate()); CertLibrary* cert_library; cert_library = chromeos::CrosLibrary::Get()->GetCertLibrary(); + // Note: this calls crypto::EnsureTPMTokenReady() cert_library->RequestCertificates(); } |