OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/attestation/platform_verification_flow.h" | 5 #include "chrome/browser/chromeos/attestation/platform_verification_flow.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" | 16 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" |
17 #include "chrome/browser/chromeos/attestation/attestation_signed_data.pb.h" | |
18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
20 #include "chrome/browser/permissions/permission_manager.h" | 19 #include "chrome/browser/permissions/permission_manager.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chromeos/attestation/attestation.pb.h" |
22 #include "chromeos/attestation/attestation_flow.h" | 22 #include "chromeos/attestation/attestation_flow.h" |
23 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
24 #include "chromeos/cryptohome/async_method_caller.h" | 24 #include "chromeos/cryptohome/async_method_caller.h" |
25 #include "chromeos/cryptohome/cryptohome_parameters.h" | 25 #include "chromeos/cryptohome/cryptohome_parameters.h" |
26 #include "chromeos/dbus/cryptohome_client.h" | 26 #include "chromeos/dbus/cryptohome_client.h" |
27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
28 #include "components/content_settings/core/browser/host_content_settings_map.h" | 28 #include "components/content_settings/core/browser/host_content_settings_map.h" |
29 #include "components/content_settings/core/common/content_settings_pattern.h" | 29 #include "components/content_settings/core/common/content_settings_pattern.h" |
30 #include "components/user_manager/user.h" | 30 #include "components/user_manager/user.h" |
31 #include "content/public/browser/browser_context.h" | 31 #include "content/public/browser/browser_context.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 const AccountId& account_id, | 328 const AccountId& account_id, |
329 const std::string& certificate_chain, | 329 const std::string& certificate_chain, |
330 bool is_expiring_soon, | 330 bool is_expiring_soon, |
331 bool operation_success, | 331 bool operation_success, |
332 const std::string& response_data) { | 332 const std::string& response_data) { |
333 if (!operation_success) { | 333 if (!operation_success) { |
334 LOG(ERROR) << "PlatformVerificationFlow: Failed to sign challenge."; | 334 LOG(ERROR) << "PlatformVerificationFlow: Failed to sign challenge."; |
335 ReportError(context.callback, INTERNAL_ERROR); | 335 ReportError(context.callback, INTERNAL_ERROR); |
336 return; | 336 return; |
337 } | 337 } |
338 SignedData signed_data_pb; | 338 chromeos::attestation::SignedData signed_data_pb; |
339 if (response_data.empty() || !signed_data_pb.ParseFromString(response_data)) { | 339 if (response_data.empty() || !signed_data_pb.ParseFromString(response_data)) { |
340 LOG(ERROR) << "PlatformVerificationFlow: Failed to parse response data."; | 340 LOG(ERROR) << "PlatformVerificationFlow: Failed to parse response data."; |
341 ReportError(context.callback, INTERNAL_ERROR); | 341 ReportError(context.callback, INTERNAL_ERROR); |
342 return; | 342 return; |
343 } | 343 } |
344 VLOG(1) << "Platform verification successful."; | 344 VLOG(1) << "Platform verification successful."; |
345 UMA_HISTOGRAM_ENUMERATION(kAttestationResultHistogram, SUCCESS, RESULT_MAX); | 345 UMA_HISTOGRAM_ENUMERATION(kAttestationResultHistogram, SUCCESS, RESULT_MAX); |
346 context.callback.Run(SUCCESS, signed_data_pb.data(), | 346 context.callback.Run(SUCCESS, signed_data_pb.data(), |
347 signed_data_pb.signature(), certificate_chain); | 347 signed_data_pb.signature(), certificate_chain); |
348 if (is_expiring_soon && renewals_in_progress_.count(certificate_chain) == 0) { | 348 if (is_expiring_soon && renewals_in_progress_.count(certificate_chain) == 0) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (!operation_success) { | 428 if (!operation_success) { |
429 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " | 429 LOG(WARNING) << "PlatformVerificationFlow: Failed to renew platform " |
430 "certificate."; | 430 "certificate."; |
431 return; | 431 return; |
432 } | 432 } |
433 VLOG(1) << "Certificate successfully renewed."; | 433 VLOG(1) << "Certificate successfully renewed."; |
434 } | 434 } |
435 | 435 |
436 } // namespace attestation | 436 } // namespace attestation |
437 } // namespace chromeos | 437 } // namespace chromeos |
OLD | NEW |