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

Unified Diff: components/login/secure_module_util.cc

Issue 2856683002: cros: Replace "TPM" with "secure module" for machines without TPM. (Closed)
Patch Set: Use IO thread to check files. Created 3 years, 7 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
« components/login/BUILD.gn ('K') | « components/login/secure_module_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/login/secure_module_util.cc
diff --git a/components/login/secure_module_util.cc b/components/login/secure_module_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b8ac70ac4272b0d4bc5c91ade4c7089ff6d5042f
--- /dev/null
+++ b/components/login/secure_module_util.cc
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/login/secure_module_util.h"
+
+#include "base/bind.h"
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+
+namespace login {
+
+namespace {
+
+// If either of these two files exist, then we are using Cr50 and not using TPM.
+constexpr char kCr50UsedIndicatorFile1[] =
+ "/opt/google/cr50/firmware/cr50.bin.prod";
+constexpr char kCr50UsedIndicatorFile2[] = "/etc/init/cr50-update.conf";
+
+SecureModuleUsed g_secure_module_used = SecureModuleUsed::UNQUERIED;
+
+} // namespace
+
+SecureModuleUsed GetSecureModuleUsed() {
+ return g_secure_module_used;
+}
+
+void QuerySecureModuleUsed() {
+ if (base::PathExists(base::FilePath(kCr50UsedIndicatorFile1)) ||
+ base::PathExists(base::FilePath(kCr50UsedIndicatorFile2))) {
+ g_secure_module_used = SecureModuleUsed::CR50;
+ return;
+ }
+
+ g_secure_module_used = SecureModuleUsed::TPM;
+}
+
+} // namespace secure_module_util
« components/login/BUILD.gn ('K') | « components/login/secure_module_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698