| OLD | NEW |
| (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.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" |
| 11 |
| 12 namespace login { |
| 13 |
| 14 namespace { |
| 15 |
| 16 // If either of these two files exist, then we are using Cr50 and not using TPM. |
| 17 constexpr char kCr50UsedIndicatorFile1[] = |
| 18 "/opt/google/cr50/firmware/cr50.bin.prod"; |
| 19 constexpr char kCr50UsedIndicatorFile2[] = "/etc/init/cr50-update.conf"; |
| 20 |
| 21 SecureModuleUsed g_secure_module_used = SecureModuleUsed::UNQUERIED; |
| 22 |
| 23 } // namespace |
| 24 |
| 25 SecureModuleUsed GetSecureModuleUsed() { |
| 26 return g_secure_module_used; |
| 27 } |
| 28 |
| 29 void QuerySecureModuleUsed() { |
| 30 if (base::PathExists(base::FilePath(kCr50UsedIndicatorFile1)) || |
| 31 base::PathExists(base::FilePath(kCr50UsedIndicatorFile2))) { |
| 32 g_secure_module_used = SecureModuleUsed::CR50; |
| 33 return; |
| 34 } |
| 35 |
| 36 g_secure_module_used = SecureModuleUsed::TPM; |
| 37 } |
| 38 |
| 39 } // namespace secure_module_util |
| OLD | NEW |