xref: /aosp_15_r20/external/cronet/crypto/unexportable_key_metrics.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CRYPTO_UNEXPORTABLE_KEY_METRICS_H_
6 #define CRYPTO_UNEXPORTABLE_KEY_METRICS_H_
7 
8 #include "crypto/crypto_export.h"
9 #include "crypto/unexportable_key.h"
10 
11 namespace crypto {
12 
13 // Records UMA metrics of TPM availability, latency and successful usage.
14 // Does the work on a new background task.
15 CRYPTO_EXPORT void MaybeMeasureTpmOperations(
16     UnexportableKeyProvider::Config config);
17 
18 // internal namespace to be used by tests only
19 namespace internal {
20 
21 // Note that values here are used in a recorded histogram. Don't change
22 // the values of existing members.
23 enum class TPMSupport {
24   kNone = 0,
25   kRSA = 1,
26   kECDSA = 2,
27   kMaxValue = 2,
28 };
29 
30 // Note that values here are used in a recorded histogram. Don't change
31 // the values of existing members.
32 enum class TPMType {
33   kNone = 0,
34   kHW = 1,
35   kVirtual = 2,
36   kBoth = 3,
37   kMaxValue = 3,
38 };
39 
40 // Exported for testing
41 CRYPTO_EXPORT void MeasureTpmOperationsInternalForTesting();
42 }  // namespace internal
43 
44 }  // namespace crypto
45 
46 #endif  // CRYPTO_UNEXPORTABLE_KEY_METRICS_H_
47