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

Unified Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc

Issue 660343002: Look for Owner key in both private and public slots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_settings_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
index 037df4ea963351ab9601afbabaf385dfaae5f594..aa61394b1a5cc0e00c873975f98fecbf5075053f 100644
--- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
+++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc
@@ -65,10 +65,21 @@ void LoadPrivateKeyByPublicKey(
const scoped_refptr<PrivateKey>& private_key)>&
callback) {
crypto::EnsureNSSInit();
- crypto::ScopedPK11Slot slot =
+ crypto::ScopedPK11Slot public_slot =
crypto::GetPublicSlotForChromeOSUser(username_hash);
- scoped_refptr<PrivateKey> private_key(new PrivateKey(
- owner_key_util->FindPrivateKeyInSlot(public_key->data(), slot.get())));
+ crypto::ScopedPK11Slot private_slot = crypto::GetPrivateSlotForChromeOSUser(
+ username_hash, base::Callback<void(crypto::ScopedPK11Slot)>());
+
+ // If private slot is already available, this will check it. If not,
+ // we'll get called again later when the TPM Token is ready, and the
+ // slot will be available then.
+ scoped_refptr<PrivateKey> private_key(
+ new PrivateKey(owner_key_util->FindPrivateKeyInSlot(public_key->data(),
+ private_slot.get())));
+ if (!private_key->key()) {
+ private_key = new PrivateKey(owner_key_util->FindPrivateKeyInSlot(
+ public_key->data(), public_slot.get()));
+ }
BrowserThread::PostTask(BrowserThread::UI,
FROM_HERE,
base::Bind(callback, public_key, private_key));
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_settings_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698