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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Runs the TPM initialization sequence. This may take a long time due to the | 67 // Runs the TPM initialization sequence. This may take a long time due to the |
68 // call to Tspi_TPM_TakeOwnership. | 68 // call to Tspi_TPM_TakeOwnership. |
69 bool InitializeTpm(); | 69 bool InitializeTpm(); |
70 | 70 |
| 71 // Gets random bytes from the TPM |
| 72 // |
| 73 // Parameters |
| 74 // length - The number of bytes to get |
| 75 // data (OUT) - The random data from the TPM |
| 76 bool GetRandomData(size_t length, chromeos::Blob* data); |
| 77 |
71 private: | 78 private: |
72 // Attempts to connect to tcsd | 79 // Attempts to connect to tcsd |
73 // | 80 // |
74 // Parameters | 81 // Parameters |
75 // context_handle (OUT) - The context handle to the session on success | 82 // context_handle (OUT) - The context handle to the session on success |
76 bool OpenAndConnectTpm(TSS_HCONTEXT* context_handle); | 83 bool OpenAndConnectTpm(TSS_HCONTEXT* context_handle); |
77 | 84 |
78 // Returns the maximum simultaneously-loaded RSA key count for the TPM | 85 // Returns the maximum simultaneously-loaded RSA key count for the TPM |
79 // specified by the context handle | 86 // specified by the context handle |
80 // | 87 // |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 210 |
204 // Indicates if the SRK is available | 211 // Indicates if the SRK is available |
205 bool is_srk_available_; | 212 bool is_srk_available_; |
206 | 213 |
207 DISALLOW_COPY_AND_ASSIGN(Tpm); | 214 DISALLOW_COPY_AND_ASSIGN(Tpm); |
208 }; | 215 }; |
209 | 216 |
210 } // namespace tpm_init | 217 } // namespace tpm_init |
211 | 218 |
212 #endif // TPM_INIT_TPM_H_ | 219 #endif // TPM_INIT_TPM_H_ |
OLD | NEW |