Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: service.h

Issue 6823012: cryptohome: Add stub functions to query PKCS11 set up status (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cryptohome.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
Greg Spencer (Chromium) 2011/04/08 20:21:45 Update Copyright.
kmixter1 2011/04/08 21:04:14 Done.
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
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 SO and user PINs.
153 virtual gboolean Pkcs11GetTpmTokenInfo(gchar** OUT_label,
154 gchar** OUT_so_pin,
155 gchar** OUT_user_pin,
156 GError** error);
157
158 // Returns in |OUT_ready| whether the TPM token is ready for use.
159 virtual gboolean Pkcs11IsReady(gboolean* OUT_ready, GError** error);
150 virtual gboolean GetStatusString(gchar** OUT_status, GError** error); 160 virtual gboolean GetStatusString(gchar** OUT_status, GError** error);
151 161
152 protected: 162 protected:
153 virtual GMainLoop *main_loop() { return loop_; } 163 virtual GMainLoop *main_loop() { return loop_; }
154 164
155 // Called periodically on Mount thread to initiate automatic disk 165 // Called periodically on Mount thread to initiate automatic disk
156 // cleanup if needed. 166 // cleanup if needed.
157 virtual void AutoCleanupCallback(); 167 virtual void AutoCleanupCallback();
158 168
159 private: 169 private:
160 GMainLoop *loop_; 170 GMainLoop *loop_;
161 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib. 171 // Can't use scoped_ptr for cryptohome_ because memory is allocated by glib.
162 gobject::Cryptohome *cryptohome_; 172 gobject::Cryptohome *cryptohome_;
163 chromeos::Blob system_salt_; 173 chromeos::Blob system_salt_;
164 scoped_ptr<cryptohome::Mount> default_mount_; 174 scoped_ptr<cryptohome::Mount> default_mount_;
165 cryptohome::Mount* mount_; 175 cryptohome::Mount* mount_;
166 scoped_ptr<TpmInit> default_tpm_init_; 176 scoped_ptr<TpmInit> default_tpm_init_;
167 TpmInit *tpm_init_; 177 TpmInit *tpm_init_;
178 scoped_ptr<Pkcs11Init> default_pkcs11_init_;
179 Pkcs11Init *pkcs11_init_;
168 bool initialize_tpm_; 180 bool initialize_tpm_;
169 base::Thread mount_thread_; 181 base::Thread mount_thread_;
170 guint async_complete_signal_; 182 guint async_complete_signal_;
171 guint tpm_init_signal_; 183 guint tpm_init_signal_;
172 CryptohomeEventSource event_source_; 184 CryptohomeEventSource event_source_;
173 int auto_cleanup_period_; 185 int auto_cleanup_period_;
174 186
175 DISALLOW_COPY_AND_ASSIGN(Service); 187 DISALLOW_COPY_AND_ASSIGN(Service);
176 }; 188 };
177 189
178 } // namespace cryptohome 190 } // namespace cryptohome
179 191
180 #endif // CRYPTOHOME_SERVICE_H_ 192 #endif // CRYPTOHOME_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698