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 class TpmInitCallback { |
| 22 public: |
| 23 virtual void InitializeTpmComplete(bool status, bool took_ownership) = 0; |
| 24 }; |
| 25 |
21 // Default constructor | 26 // Default constructor |
22 TpmInit(); | 27 TpmInit(); |
23 | 28 |
24 virtual ~TpmInit(); | 29 virtual ~TpmInit(); |
25 | 30 |
| 31 virtual void Init(TpmInitCallback* notify_callback); |
| 32 |
26 // Gets random data from the TPM | 33 // Gets random data from the TPM |
27 // | 34 // |
28 // Parameters | 35 // Parameters |
29 // length - The number of bytes to get | 36 // length - The number of bytes to get |
30 // data (OUT) - Receives the random bytes | 37 // data (OUT) - Receives the random bytes |
31 virtual bool GetRandomData(int length, chromeos::Blob* data); | 38 virtual bool GetRandomData(int length, chromeos::Blob* data); |
32 | 39 |
33 // Starts asynchronous initialization of the TPM | 40 // Starts asynchronous initialization of the TPM |
34 virtual bool StartInitializeTpm(); | 41 virtual bool StartInitializeTpm(); |
35 | 42 |
(...skipping 14 matching lines...) Expand all Loading... |
50 // Parameters | 57 // Parameters |
51 // password (OUT) - The owner password used for the TPM | 58 // password (OUT) - The owner password used for the TPM |
52 virtual bool GetTpmPassword(chromeos::Blob* password); | 59 virtual bool GetTpmPassword(chromeos::Blob* password); |
53 | 60 |
54 // Returns the number of milliseconds it took to initialize the TPM | 61 // Returns the number of milliseconds it took to initialize the TPM |
55 virtual long GetInitializationMillis(); | 62 virtual long GetInitializationMillis(); |
56 | 63 |
57 private: | 64 private: |
58 // The background task for initializing the TPM, implemented as a | 65 // The background task for initializing the TPM, implemented as a |
59 // PlatformThread::Delegate | 66 // PlatformThread::Delegate |
60 scoped_ptr<TpmInitTask> tpm_init_; | 67 scoped_ptr<TpmInitTask> tpm_init_task_; |
| 68 |
| 69 TpmInitCallback* notify_callback_; |
61 | 70 |
62 DISALLOW_COPY_AND_ASSIGN(TpmInit); | 71 DISALLOW_COPY_AND_ASSIGN(TpmInit); |
63 }; | 72 }; |
64 | 73 |
65 } // namespace tpm_init | 74 } // namespace tpm_init |
66 | 75 |
67 #endif // TPM_INIT_TPM_INIT_H_ | 76 #endif // TPM_INIT_TPM_INIT_H_ |
OLD | NEW |