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

Side by Side Diff: components/login/secure_module_util_chromeos.cc

Issue 2856683002: cros: Replace "TPM" with "secure module" for machines without TPM. (Closed)
Patch Set: Suffixed chromeos for chromeos compiling of secure_module_*. 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 unified diff | Download patch
« no previous file with comments | « components/login/secure_module_util_chromeos.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/login/secure_module_util_chromeos.h"
6
7 #include "base/bind.h"
8 #include "base/callback_helpers.h"
9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h"
11 #include "base/task_scheduler/post_task.h"
12
13 namespace login {
14
15 namespace {
16
17 // If either of these two files exist, then we are using Cr50 and not using TPM.
18 constexpr char kCr50UsedIndicatorFile1[] =
19 "/opt/google/cr50/firmware/cr50.bin.prod";
20 constexpr char kCr50UsedIndicatorFile2[] = "/etc/init/cr50-update.conf";
21
22 SecureModuleUsed g_secure_module_used = SecureModuleUsed::UNQUERIED;
23
24 SecureModuleUsed GetSecureModuleInfoFromFilesAndCacheIt() {
25 if (base::PathExists(base::FilePath(kCr50UsedIndicatorFile1)) ||
26 base::PathExists(base::FilePath(kCr50UsedIndicatorFile2))) {
27 g_secure_module_used = SecureModuleUsed::CR50;
28 } else {
29 g_secure_module_used = SecureModuleUsed::TPM;
30 }
31 return g_secure_module_used;
32 }
33
34 } // namespace
35
36 void GetSecureModuleUsed(GetSecureModuleUsedCallback callback) {
37 if (g_secure_module_used != SecureModuleUsed::UNQUERIED) {
38 base::ResetAndReturn(&callback).Run(g_secure_module_used);
39 return;
40 }
41
42 base::PostTaskWithTraitsAndReplyWithResult(
43 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
44 base::BindOnce(&GetSecureModuleInfoFromFilesAndCacheIt),
45 std::move(callback));
46 }
47
48 } // namespace login
OLDNEW
« no previous file with comments | « components/login/secure_module_util_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698