[gnome-keyring] [pkcs11] Fix warning when running tests.



commit 387b5f2b7584134723ad0a5d22e11586a73dc12a
Author: Stef Walter <stef memberwebs com>
Date:   Sat Dec 19 19:10:56 2009 +0000

    [pkcs11] Fix warning when running tests.

 pkcs11/gck/gck-session.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gck/gck-session.c
index e33adc5..130d6d4 100644
--- a/pkcs11/gck/gck-session.c
+++ b/pkcs11/gck/gck-session.c
@@ -147,10 +147,11 @@ prepare_crypto (GckSession *self, CK_MECHANISM_PTR mech,
 
 	/* Lookup the mechanisms this object can do */
 	mechanisms = gck_object_get_attribute_data (object, self, CKA_ALLOWED_MECHANISMS, &n_data);
-	g_return_val_if_fail (mechanisms, CKR_GENERAL_ERROR);
-	g_return_val_if_fail (n_data % sizeof (CK_MECHANISM_TYPE) == 0, CKR_GENERAL_ERROR);
-	n_mechanisms = n_data / sizeof (CK_MECHANISM_TYPE);
-	
+	if (mechanisms)
+		n_mechanisms = n_data / sizeof (CK_MECHANISM_TYPE);
+	else
+		n_mechanisms = 0;
+
 	/* See if ours is represented */
 	have = FALSE;
 	for (i = 0; !have && i < n_mechanisms; ++i) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]