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

Side by Side Diff: chromeos/cert_loader.cc

Issue 83833003: Remove crypto::GetTPMTokenInfo which is no longer necessary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-upload Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/cert_loader.h" 5 #include "chromeos/cert_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 void CertLoader::RemoveObserver(CertLoader::Observer* observer) { 129 void CertLoader::RemoveObserver(CertLoader::Observer* observer) {
130 observers_.RemoveObserver(observer); 130 observers_.RemoveObserver(observer);
131 } 131 }
132 132
133 bool CertLoader::CertificatesLoading() const { 133 bool CertLoader::CertificatesLoading() const {
134 return certificates_requested_ && !certificates_loaded_; 134 return certificates_requested_ && !certificates_loaded_;
135 } 135 }
136 136
137 bool CertLoader::IsHardwareBacked() const { 137 bool CertLoader::IsHardwareBacked() const {
138 return !tpm_token_name_.empty(); 138 return !tpm_token_name_.empty();
wtc 2013/11/23 00:42:29 The tpm_token_name_ member is now only used by thi
mattm 2013/11/23 01:30:50 It also has a getter in the header file, which is
139 } 139 }
140 140
141 void CertLoader::MaybeRequestCertificates() { 141 void CertLoader::MaybeRequestCertificates() {
142 CHECK(thread_checker_.CalledOnValidThread()); 142 CHECK(thread_checker_.CalledOnValidThread());
143 143
144 // This is the entry point to the TPM token initialization process, 144 // This is the entry point to the TPM token initialization process,
145 // which we should do at most once. 145 // which we should do at most once.
146 if (certificates_requested_ || !crypto_task_runner_.get()) 146 if (certificates_requested_ || !crypto_task_runner_.get())
147 return; 147 return;
148 148
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // and CryptohomeClient calls are not thread safe. 205 // and CryptohomeClient calls are not thread safe.
206 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11GetTpmTokenInfo( 206 DBusThreadManager::Get()->GetCryptohomeClient()->Pkcs11GetTpmTokenInfo(
207 base::Bind(&CertLoader::OnPkcs11GetTpmTokenInfo, 207 base::Bind(&CertLoader::OnPkcs11GetTpmTokenInfo,
208 initialize_token_factory_.GetWeakPtr())); 208 initialize_token_factory_.GetWeakPtr()));
209 return; 209 return;
210 } 210 }
211 case TPM_TOKEN_INFO_RECEIVED: { 211 case TPM_TOKEN_INFO_RECEIVED: {
212 base::PostTaskAndReplyWithResult( 212 base::PostTaskAndReplyWithResult(
213 crypto_task_runner_.get(), 213 crypto_task_runner_.get(),
214 FROM_HERE, 214 FROM_HERE,
215 base::Bind(&crypto::InitializeTPMToken, 215 base::Bind(&crypto::InitializeTPMToken, tpm_token_slot_id_),
216 tpm_token_name_,
217 tpm_token_slot_id_,
218 tpm_user_pin_),
219 base::Bind(&CertLoader::OnTPMTokenInitialized, 216 base::Bind(&CertLoader::OnTPMTokenInitialized,
220 initialize_token_factory_.GetWeakPtr())); 217 initialize_token_factory_.GetWeakPtr()));
221 return; 218 return;
222 } 219 }
223 case TPM_TOKEN_INITIALIZED: { 220 case TPM_TOKEN_INITIALIZED: {
224 StartLoadCertificates(); 221 StartLoadCertificates();
225 return; 222 return;
226 } 223 }
227 } 224 }
228 } 225 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 int token_slot_id) { 301 int token_slot_id) {
305 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name; 302 VLOG(1) << "OnPkcs11GetTpmTokenInfo: " << token_name;
306 303
307 if (call_status == DBUS_METHOD_CALL_FAILURE) { 304 if (call_status == DBUS_METHOD_CALL_FAILURE) {
308 RetryTokenInitializationLater(); 305 RetryTokenInitializationLater();
309 return; 306 return;
310 } 307 }
311 308
312 tpm_token_name_ = token_name; 309 tpm_token_name_ = token_name;
313 tpm_token_slot_id_ = token_slot_id; 310 tpm_token_slot_id_ = token_slot_id;
314 tpm_user_pin_ = user_pin; 311 tpm_user_pin_ = user_pin;
wtc 2013/11/23 00:42:29 Should we delete the tpm_user_pin_ member and the
mattm 2013/11/23 01:30:50 It also has a getter which is used in a few places
315 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED; 312 tpm_token_state_ = TPM_TOKEN_INFO_RECEIVED;
316 313
317 InitializeTokenAndLoadCertificates(); 314 InitializeTokenAndLoadCertificates();
318 } 315 }
319 316
320 void CertLoader::OnTPMTokenInitialized(bool success) { 317 void CertLoader::OnTPMTokenInitialized(bool success) {
321 VLOG(1) << "OnTPMTokenInitialized: " << success; 318 VLOG(1) << "OnTPMTokenInitialized: " << success;
322 if (!success) { 319 if (!success) {
323 RetryTokenInitializationLater(); 320 RetryTokenInitializationLater();
324 return; 321 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 VLOG(1) << "OnCertRemoved"; 392 VLOG(1) << "OnCertRemoved";
396 LoadCertificates(); 393 LoadCertificates();
397 } 394 }
398 395
399 void CertLoader::LoggedInStateChanged() { 396 void CertLoader::LoggedInStateChanged() {
400 VLOG(1) << "LoggedInStateChanged"; 397 VLOG(1) << "LoggedInStateChanged";
401 MaybeRequestCertificates(); 398 MaybeRequestCertificates();
402 } 399 }
403 400
404 } // namespace chromeos 401 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698