| 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 // TpmInit - public interface class for initializing the TPM | 5 // TpmInit - public interface class for initializing the TPM |
| 6 | 6 |
| 7 #include <base/scoped_ptr.h> | 7 #include <base/scoped_ptr.h> |
| 8 #include <base/platform_thread.h> | 8 #include <base/platform_thread.h> |
| 9 #include <chromeos/utility.h> | 9 #include <chromeos/utility.h> |
| 10 | 10 |
| 11 #ifndef TPM_INIT_TPM_INIT_H_ | 11 #ifndef TPM_INIT_TPM_INIT_H_ |
| 12 #define TPM_INIT_TPM_INIT_H_ | 12 #define TPM_INIT_TPM_INIT_H_ |
| 13 | 13 |
| 14 namespace tpm_init { | 14 namespace tpm_init { |
| 15 | 15 |
| 16 class TpmInitTask; | 16 class TpmInitTask; |
| 17 | 17 |
| 18 class TpmInit { | 18 class TpmInit { |
| 19 public: | 19 public: |
| 20 | 20 |
| 21 // Default constructor | 21 // Default constructor |
| 22 TpmInit(); | 22 TpmInit(); |
| 23 | 23 |
| 24 virtual ~TpmInit(); | 24 virtual ~TpmInit(); |
| 25 | 25 |
| 26 // Gets random data from the TPM |
| 27 // |
| 28 // Parameters |
| 29 // length - The number of bytes to get |
| 30 // data (OUT) - Receives the random bytes |
| 31 virtual bool GetRandomData(int length, chromeos::Blob* data); |
| 32 |
| 26 // Starts asynchronous initialization of the TPM | 33 // Starts asynchronous initialization of the TPM |
| 27 virtual bool StartInitializeTpm(); | 34 virtual bool StartInitializeTpm(); |
| 28 | 35 |
| 29 // Returns true if the TPM is initialized and ready for use | 36 // Returns true if the TPM is initialized and ready for use |
| 30 virtual bool IsTpmReady(); | 37 virtual bool IsTpmReady(); |
| 31 | 38 |
| 32 // Returns true if the TPM is enabled | 39 // Returns true if the TPM is enabled |
| 33 virtual bool IsTpmEnabled(); | 40 virtual bool IsTpmEnabled(); |
| 34 | 41 |
| 35 // Gets the TPM password if the TPM initialization took ownership | 42 // Gets the TPM password if the TPM initialization took ownership |
| 36 // | 43 // |
| 37 // Parameters | 44 // Parameters |
| 38 // password (OUT) - The owner password used for the TPM | 45 // password (OUT) - The owner password used for the TPM |
| 39 virtual bool GetTpmPassword(chromeos::Blob* password); | 46 virtual bool GetTpmPassword(chromeos::Blob* password); |
| 40 | 47 |
| 41 // Returns the number of milliseconds it took to initialize the TPM | 48 // Returns the number of milliseconds it took to initialize the TPM |
| 42 virtual long GetInitializationMillis(); | 49 virtual long GetInitializationMillis(); |
| 43 | 50 |
| 44 private: | 51 private: |
| 45 // The background task for initializing the TPM, implemented as a | 52 // The background task for initializing the TPM, implemented as a |
| 46 // PlatformThread::Delegate | 53 // PlatformThread::Delegate |
| 47 scoped_ptr<TpmInitTask> tpm_init_; | 54 scoped_ptr<TpmInitTask> tpm_init_; |
| 48 | 55 |
| 49 DISALLOW_COPY_AND_ASSIGN(TpmInit); | 56 DISALLOW_COPY_AND_ASSIGN(TpmInit); |
| 50 }; | 57 }; |
| 51 | 58 |
| 52 } // namespace tpm_init | 59 } // namespace tpm_init |
| 53 | 60 |
| 54 #endif // TPM_INIT_TPM_INIT_H_ | 61 #endif // TPM_INIT_TPM_INIT_H_ |
| OLD | NEW |