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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager.cc

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager. h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager. h"
6 6
7 #include <cryptohi.h> 7 #include <cryptohi.h>
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <stdint.h>
9 10
10 #include "base/base64.h" 11 #include "base/base64.h"
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/prefs/pref_registry_simple.h" 16 #include "base/prefs/pref_registry_simple.h"
16 #include "base/prefs/pref_service.h" 17 #include "base/prefs/pref_service.h"
17 #include "base/prefs/scoped_user_pref_update.h" 18 #include "base/prefs/scoped_user_pref_update.h"
18 #include "base/single_thread_task_runner.h" 19 #include "base/single_thread_task_runner.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 81
81 // Checks if a private RSA key associated with |public_key| can be found in 82 // Checks if a private RSA key associated with |public_key| can be found in
82 // |slot|. |slot| must be non-null. 83 // |slot|. |slot| must be non-null.
83 // Must be called on a worker thread. 84 // Must be called on a worker thread.
84 crypto::ScopedSECKEYPrivateKey GetPrivateKeyOnWorkerThread( 85 crypto::ScopedSECKEYPrivateKey GetPrivateKeyOnWorkerThread(
85 PK11SlotInfo* slot, 86 PK11SlotInfo* slot,
86 const std::string& public_key) { 87 const std::string& public_key) {
87 CHECK(slot); 88 CHECK(slot);
88 89
89 const uint8* public_key_uint8 = 90 const uint8_t* public_key_uint8 =
90 reinterpret_cast<const uint8*>(public_key.data()); 91 reinterpret_cast<const uint8_t*>(public_key.data());
91 std::vector<uint8> public_key_vector( 92 std::vector<uint8_t> public_key_vector(public_key_uint8,
92 public_key_uint8, public_key_uint8 + public_key.size()); 93 public_key_uint8 + public_key.size());
93 94
94 crypto::ScopedSECKEYPrivateKey rsa_key( 95 crypto::ScopedSECKEYPrivateKey rsa_key(
95 crypto::FindNSSKeyFromPublicKeyInfoInSlot(public_key_vector, slot)); 96 crypto::FindNSSKeyFromPublicKeyInfoInSlot(public_key_vector, slot));
96 if (!rsa_key || SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey) 97 if (!rsa_key || SECKEY_GetPrivateKeyType(rsa_key.get()) != rsaKey)
97 return nullptr; 98 return nullptr;
98 return rsa_key.Pass(); 99 return rsa_key.Pass();
99 } 100 }
100 101
101 // Signs |data| using a private key associated with |public_key| and stored in 102 // Signs |data| using a private key associated with |public_key| and stored in
102 // |slot|. Once the data is signed, callback is run on |response_task_runner|. 103 // |slot|. Once the data is signed, callback is run on |response_task_runner|.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // If key creation failed, reset the state machine. 390 // If key creation failed, reset the state machine.
390 create_tpm_key_state_ = 391 create_tpm_key_state_ =
391 public_key.empty() ? CREATE_TPM_KEY_NOT_STARTED : CREATE_TPM_KEY_DONE; 392 public_key.empty() ? CREATE_TPM_KEY_NOT_STARTED : CREATE_TPM_KEY_DONE;
392 } 393 }
393 394
394 void EasyUnlockTpmKeyManager::OnDataSigned( 395 void EasyUnlockTpmKeyManager::OnDataSigned(
395 const base::Callback<void(const std::string&)>& callback, 396 const base::Callback<void(const std::string&)>& callback,
396 const std::string& signature) { 397 const std::string& signature) {
397 callback.Run(signature); 398 callback.Run(signature);
398 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698