Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc |
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc |
index 46058c1692689a87c4506242e7ca86b40e8d6d02..20b442000bfb212d8783a2bf4b17e3239d1a2543 100644 |
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc |
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc |
@@ -56,24 +56,22 @@ void GetSystemSlotOnIOThread( |
} |
// Checks if a private RSA key associated with |public_key| can be found in |
-// |slot|. |
+// |slot|. |slot| must be non-null. |
// Must be called on a worker thread. |
crypto::ScopedSECKEYPrivateKey GetPrivateKeyOnWorkerThread( |
PK11SlotInfo* slot, |
const std::string& public_key) { |
+ CHECK(slot); |
+ |
const uint8* public_key_uint8 = |
reinterpret_cast<const uint8*>(public_key.data()); |
std::vector<uint8> public_key_vector( |
public_key_uint8, public_key_uint8 + public_key.size()); |
- // TODO(davidben): This should be equivalent to calling |
- // FindNSSKeyFromPublicKeyInfoInSlot. |
crypto::ScopedSECKEYPrivateKey rsa_key( |
- crypto::FindNSSKeyFromPublicKeyInfo(public_key_vector)); |
- if (!rsa_key || rsa_key->pkcs11Slot != slot || |
- SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey) { |
+ crypto::FindNSSKeyFromPublicKeyInfoInSlot(public_key_vector, slot)); |
+ if (!rsa_key || SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey) |
return nullptr; |
- } |
return rsa_key.Pass(); |
} |