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

Unified Diff: chromeos/tpm/tpm_token_info_getter.cc

Issue 2856683002: cros: Replace "TPM" with "secure module" for machines without TPM. (Closed)
Patch Set: Created 3 years, 8 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
« chrome/app/chromeos_strings.grdp ('K') | « chromeos/tpm/tpm_token_info_getter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« chrome/app/chromeos_strings.grdp ('K') | « chromeos/tpm/tpm_token_info_getter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698