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

Unified Diff: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc

Issue 1139533002: Use FindNSSKeyFromPublicKeyInfoInSlot in GetPrivateKeyOnWorkerThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rsa-private-key-1
Patch Set: fix build Created 5 years, 7 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 | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a7ce5b5d6adb9f3489c19ea060efe419aa65dc6f 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;
+ if (state->slot_) {
+ rsa_key = crypto::FindNSSKeyFromPublicKeyInfoInSlot(public_key_vector,
+ state->slot_.get());
+ } 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;
}
« no previous file with comments | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698