Chromium Code Reviews| Index: chromeos/tpm/tpm_token_info_getter.cc |
| diff --git a/chromeos/tpm/tpm_token_info_getter.cc b/chromeos/tpm/tpm_token_info_getter.cc |
| index 1e7918d03c016ab2b6bd074ab0bb3a8126a50cd6..ec52980a48b510893d50837db04ccb1aba4f2374 100644 |
| --- a/chromeos/tpm/tpm_token_info_getter.cc |
| +++ b/chromeos/tpm/tpm_token_info_getter.cc |
| @@ -7,6 +7,8 @@ |
| #include <stdint.h> |
| #include "base/bind.h" |
| +#include "base/files/file_path.h" |
| +#include "base/files/file_util.h" |
| #include "base/location.h" |
| #include "base/task_runner.h" |
| #include "chromeos/cryptohome/cryptohome_parameters.h" |
| @@ -17,6 +19,11 @@ namespace { |
| const int64_t kInitialRequestDelayMs = 100; |
| const int64_t kMaxRequestDelayMs = 300000; // 5 minutes |
| +// If either of these two files exist, then we are not using TPM. |
| +constexpr char kNoTPMIndicatorFile1[] = |
|
apronin
2017/05/02 16:43:38
I'd go with 'NoTPMIndicator' -> 'Cr50UsedIndicator
sammiequon
2017/05/02 17:27:23
Done.
|
| + "/opt/google/cr50/firmware/cr50.bin.prod"; |
| +constexpr char kNoTPMIndicatorFile2[] = "/etc/init/cr50-update.conf"; |
| + |
| // Calculates the delay before running next attempt to initiatialize the TPM |
| // token, if |last_delay| was the last or initial delay. |
| base::TimeDelta GetNextRequestDelayMs(base::TimeDelta last_delay) { |
| @@ -61,6 +68,11 @@ std::unique_ptr<TPMTokenInfoGetter> TPMTokenInfoGetter::CreateForSystemToken( |
| TYPE_SYSTEM, EmptyAccountId(), cryptohome_client, delayed_task_runner)); |
| } |
| +bool TPMTokenInfoGetter::DoesTPMExist() { |
|
apronin
2017/05/02 16:43:38
Does what is supposed to do for the purposes of th
sammiequon
2017/05/02 17:27:23
Done.
|
| + return !base::PathExists(base::FilePath(kNoTPMIndicatorFile1)) && |
| + !base::PathExists(base::FilePath(kNoTPMIndicatorFile2)); |
| +} |
| + |
| TPMTokenInfoGetter::~TPMTokenInfoGetter() {} |
| void TPMTokenInfoGetter::Start(const TPMTokenInfoCallback& callback) { |