| 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
|
|
|