Chromium Code Reviews| Index: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc |
| diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc |
| index 5678bafc5fe2217f5d03438aff3b40c365ed67da..f2b51a7f1bc689c91aa6a146aa89acd16a2cbdd6 100644 |
| --- a/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc |
| +++ b/chrome/browser/chromeos/platform_keys/platform_keys_nss.cc |
| @@ -451,14 +451,16 @@ void SignRSAOnWorkerThread(scoped_ptr<SignRSAState> state) { |
| std::vector<uint8> public_key_vector( |
| public_key_uint8, public_key_uint8 + state->public_key_.size()); |
| - // TODO(pneubeck): This searches all slots. Change to look only at |slot_|. |
| - crypto::ScopedSECKEYPrivateKey rsa_key( |
| - crypto::FindNSSKeyFromPublicKeyInfo(public_key_vector)); |
| - |
| - // Fail if the key was not found. If a specific slot was requested, also fail |
| - // if the key was found in the wrong slot. |
| - if (!rsa_key || SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey || |
| - (state->slot_ && rsa_key->pkcs11Slot != state->slot_)) { |
| + crypto::ScopedSECKEYPrivateKey rsa_key; |
|
pneubeck (no reviews)
2015/05/12 09:48:38
great, thanks!
|
| + if (state->slot_) { |
| + rsa_key = crypto::FindNSSKeyFromPublicKeyInfoInSlot(public_key_vector, |
| + state->slot_); |
| + } else { |
| + rsa_key = crypto::FindNSSKeyFromPublicKeyInfo(public_key_vector); |
| + } |
| + |
| + // Fail if the key was not found or is of the wrong type. |
| + if (!rsa_key || SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey) { |
| state->OnError(FROM_HERE, kErrorKeyNotFound); |
| return; |
| } |