OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CRYPTOHOME_SERVICE_H_ | 4 #ifndef CRYPTOHOME_SERVICE_H_ |
5 #define CRYPTOHOME_SERVICE_H_ | 5 #define CRYPTOHOME_SERVICE_H_ |
6 | 6 |
7 #include <base/logging.h> | 7 #include <base/logging.h> |
8 #include <base/scoped_ptr.h> | 8 #include <base/scoped_ptr.h> |
9 #include <base/thread.h> | 9 #include <base/thread.h> |
10 #include <chromeos/dbus/abstract_dbus_service.h> | 10 #include <chromeos/dbus/abstract_dbus_service.h> |
11 #include <chromeos/dbus/dbus.h> | 11 #include <chromeos/dbus/dbus.h> |
12 #include <chromeos/dbus/service_constants.h> | 12 #include <chromeos/dbus/service_constants.h> |
13 #include <chromeos/glib/object.h> | 13 #include <chromeos/glib/object.h> |
14 #include <dbus/dbus-glib.h> | 14 #include <dbus/dbus-glib.h> |
15 #include <glib-object.h> | 15 #include <glib-object.h> |
16 | 16 |
17 #include "cryptohome_event_source.h" | 17 #include "cryptohome_event_source.h" |
18 #include "mount.h" | 18 #include "mount.h" |
19 #include "mount_task.h" | 19 #include "mount_task.h" |
| 20 #include "pkcs11_init.h" |
20 #include "tpm_init.h" | 21 #include "tpm_init.h" |
21 | 22 |
22 namespace cryptohome { | 23 namespace cryptohome { |
23 namespace gobject { | 24 namespace gobject { |
24 | 25 |
25 struct Cryptohome; | 26 struct Cryptohome; |
26 } // namespace gobject | 27 } // namespace gobject |
27 | 28 |
28 // Service | 29 // Service |
29 // Provides a wrapper for exporting CryptohomeInterface to | 30 // Provides a wrapper for exporting CryptohomeInterface to |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 virtual gboolean AsyncDoAutomaticFreeDiskSpaceControl(gint *OUT_async_id, | 141 virtual gboolean AsyncDoAutomaticFreeDiskSpaceControl(gint *OUT_async_id, |
141 GError **error); | 142 GError **error); |
142 | 143 |
143 virtual gboolean TpmIsReady(gboolean* OUT_ready, GError** error); | 144 virtual gboolean TpmIsReady(gboolean* OUT_ready, GError** error); |
144 virtual gboolean TpmIsEnabled(gboolean* OUT_enabled, GError** error); | 145 virtual gboolean TpmIsEnabled(gboolean* OUT_enabled, GError** error); |
145 virtual gboolean TpmGetPassword(gchar** OUT_password, GError** error); | 146 virtual gboolean TpmGetPassword(gchar** OUT_password, GError** error); |
146 virtual gboolean TpmIsOwned(gboolean* OUT_owned, GError** error); | 147 virtual gboolean TpmIsOwned(gboolean* OUT_owned, GError** error); |
147 virtual gboolean TpmIsBeingOwned(gboolean* OUT_owning, GError** error); | 148 virtual gboolean TpmIsBeingOwned(gboolean* OUT_owning, GError** error); |
148 virtual gboolean TpmCanAttemptOwnership(GError** error); | 149 virtual gboolean TpmCanAttemptOwnership(GError** error); |
149 virtual gboolean TpmClearStoredPassword(GError** error); | 150 virtual gboolean TpmClearStoredPassword(GError** error); |
| 151 |
| 152 // Returns the label of the TPM token along with its user PIN. |
| 153 virtual gboolean Pkcs11GetTpmTokenInfo(gchar** OUT_label, |
| 154 gchar** OUT_user_pin, |
| 155 GError** error); |
| 156 |
| 157 // Returns in |OUT_ready| whether the TPM token is ready for use. |
| 158 virtual gboolean Pkcs11IsTpmTokenReady(gboolean* OUT_ready, GError** error); |
150 virtual gboolean GetStatusString(gchar** OUT_status, GError** error); | 159 virtual gboolean GetStatusString(gchar** OUT_status, GError** error); |
151 | 160 |
152 protected: | 161 protected: |
153 virtual GMainLoop *main_loop() { return loop_; } | 162 virtual GMainLoop *main_loop() { return loop_; } |
154 | 163 |
155 // Called periodically on Mount thread to initiate automatic disk | 164 // Called periodically on Mount thread to initiate automatic disk |
156 // cleanup if needed. | 165 // cleanup if needed. |
157 virtual void AutoCleanupCallback(); | 166 virtual void AutoCleanupCallback(); |
158 | 167 |
159 private: | 168 private: |
160 GMainLoop *loop_; | 169 GMainLoop *loop_; |
161 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib. | 170 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib. |
162 gobject::Cryptohome *cryptohome_; | 171 gobject::Cryptohome *cryptohome_; |
163 chromeos::Blob system_salt_; | 172 chromeos::Blob system_salt_; |
164 scoped_ptr<cryptohome::Mount> default_mount_; | 173 scoped_ptr<cryptohome::Mount> default_mount_; |
165 cryptohome::Mount* mount_; | 174 cryptohome::Mount* mount_; |
166 scoped_ptr<TpmInit> default_tpm_init_; | 175 scoped_ptr<TpmInit> default_tpm_init_; |
167 TpmInit *tpm_init_; | 176 TpmInit *tpm_init_; |
| 177 scoped_ptr<Pkcs11Init> default_pkcs11_init_; |
| 178 Pkcs11Init *pkcs11_init_; |
168 bool initialize_tpm_; | 179 bool initialize_tpm_; |
169 base::Thread mount_thread_; | 180 base::Thread mount_thread_; |
170 guint async_complete_signal_; | 181 guint async_complete_signal_; |
171 guint tpm_init_signal_; | 182 guint tpm_init_signal_; |
172 CryptohomeEventSource event_source_; | 183 CryptohomeEventSource event_source_; |
173 int auto_cleanup_period_; | 184 int auto_cleanup_period_; |
174 | 185 |
175 DISALLOW_COPY_AND_ASSIGN(Service); | 186 DISALLOW_COPY_AND_ASSIGN(Service); |
176 }; | 187 }; |
177 | 188 |
178 } // namespace cryptohome | 189 } // namespace cryptohome |
179 | 190 |
180 #endif // CRYPTOHOME_SERVICE_H_ | 191 #endif // CRYPTOHOME_SERVICE_H_ |
OLD | NEW |