OLD | NEW |
1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Tpm - class for handling init TPM initialization for Chrome OS | 5 // Tpm - class for handling init TPM initialization for Chrome OS |
6 | 6 |
7 #include <base/lock.h> | 7 #include <base/lock.h> |
8 #include <base/logging.h> | 8 #include <base/logging.h> |
9 #include <base/scoped_ptr.h> | 9 #include <base/scoped_ptr.h> |
10 #include <chromeos/utility.h> | 10 #include <chromeos/utility.h> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 bool IsEnabled() const { return !is_disabled_; } | 57 bool IsEnabled() const { return !is_disabled_; } |
58 | 58 |
59 // Returns whether or not the TPM is owned. This method call returns a cached | 59 // Returns whether or not the TPM is owned. This method call returns a cached |
60 // result because querying the TPM directly will block if ownership is | 60 // result because querying the TPM directly will block if ownership is |
61 // currently being taken (such as on a separate thread). | 61 // currently being taken (such as on a separate thread). |
62 bool IsOwned() const { return is_owned_; } | 62 bool IsOwned() const { return is_owned_; } |
63 | 63 |
64 // Returns whether or not the SRK is available | 64 // Returns whether or not the SRK is available |
65 bool IsSrkAvailable() const { return is_srk_available_; } | 65 bool IsSrkAvailable() const { return is_srk_available_; } |
66 | 66 |
| 67 // Returns whether or not the TPM is being owned |
| 68 bool IsBeingOwned() const { return is_being_owned_; } |
| 69 |
67 // Runs the TPM initialization sequence. This may take a long time due to the | 70 // Runs the TPM initialization sequence. This may take a long time due to the |
68 // call to Tspi_TPM_TakeOwnership. | 71 // call to Tspi_TPM_TakeOwnership. |
69 bool InitializeTpm(); | 72 bool InitializeTpm(); |
70 | 73 |
71 // Gets random bytes from the TPM | 74 // Gets random bytes from the TPM |
72 // | 75 // |
73 // Parameters | 76 // Parameters |
74 // length - The number of bytes to get | 77 // length - The number of bytes to get |
75 // data (OUT) - The random data from the TPM | 78 // data (OUT) - The random data from the TPM |
76 bool GetRandomData(size_t length, chromeos::Blob* data); | 79 bool GetRandomData(size_t length, chromeos::Blob* data); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 207 |
205 // Indicates if the TPM is disabled | 208 // Indicates if the TPM is disabled |
206 bool is_disabled_; | 209 bool is_disabled_; |
207 | 210 |
208 // Indicates if the TPM is owned | 211 // Indicates if the TPM is owned |
209 bool is_owned_; | 212 bool is_owned_; |
210 | 213 |
211 // Indicates if the SRK is available | 214 // Indicates if the SRK is available |
212 bool is_srk_available_; | 215 bool is_srk_available_; |
213 | 216 |
| 217 // Indicates if the TPM is being owned |
| 218 bool is_being_owned_; |
| 219 |
214 DISALLOW_COPY_AND_ASSIGN(Tpm); | 220 DISALLOW_COPY_AND_ASSIGN(Tpm); |
215 }; | 221 }; |
216 | 222 |
217 } // namespace tpm_init | 223 } // namespace tpm_init |
218 | 224 |
219 #endif // TPM_INIT_TPM_H_ | 225 #endif // TPM_INIT_TPM_H_ |
OLD | NEW |