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

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: another one 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698