diff options
author | Stefan Walter <stefw@src.gnome.org> | 2009-02-28 01:24:29 +0000 |
---|---|---|
committer | Stefan Walter <stefw@src.gnome.org> | 2009-02-28 01:24:29 +0000 |
commit | 46bd10f8fe1c49d10486a75b990ec5d38687b962 (patch) | |
tree | e18d83fdb95c1dc59598dcee8c9160373077f66c | |
parent | c186b62bc0d1a0189faa65ffbfc0e8fda336d828 (diff) | |
download | gnome-keyring-46bd10f8fe1c49d10486a75b990ec5d38687b962.tar.gz |
Implement C_InitPIN for the cases when no PIN exists yet.
svn path=/trunk/; revision=1630
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | pkcs11/gck/gck-module.c | 23 |
2 files changed, 23 insertions, 2 deletions
@@ -12,6 +12,8 @@ * daemon/pkcs11/gkr-pkcs11-auth-ep.c: Prompt for new password when C_InitPIN is called on a token. + * pkcs11/gck/gck-module.c: Implement C_InitPIN for the cases when no PIN + exists yet. 2009-02-25 Stef Walter <stef@memberwebs.com> diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gck/gck-module.c index 1c021eb1..b6a06cbc 100644 --- a/pkcs11/gck/gck-module.c +++ b/pkcs11/gck/gck-module.c @@ -1024,9 +1024,28 @@ gck_module_C_CloseAllSessions (GckModule *self, CK_SLOT_ID id) CK_RV gck_module_C_InitPIN (GckModule* self, CK_SESSION_HANDLE handle, - CK_UTF8CHAR_PTR pin, CK_ULONG pin_len) + CK_UTF8CHAR_PTR pin, CK_ULONG n_pin) { - return CKR_FUNCTION_NOT_SUPPORTED; + GckSession *session; + VirtualSlot *slot; + CK_SLOT_ID slot_id; + + g_return_val_if_fail (GCK_IS_MODULE (self), CKR_CRYPTOKI_NOT_INITIALIZED); + + session = gck_module_lookup_session (self, handle); + if (session == NULL) + return CKR_SESSION_HANDLE_INVALID; + + /* Calculate the virtual slot */ + slot_id = gck_session_get_slot_id (session); + slot = lookup_virtual_slot (self, slot_id); + g_return_val_if_fail (slot, CKR_GENERAL_ERROR); + + if (slot->logged_in != CKU_SO) + return CKR_USER_NOT_LOGGED_IN; + + /* Our InitPIN assumes an uninitialized PIN */ + return gck_module_login_change (self, slot_id, NULL, 0, pin, n_pin); } CK_RV |