gnome-keyring r1492 - in trunk: . daemon/pk gp11 gp11/tests pkcs11/gck pkcs11/ssh-agent tool



Author: nnielsen
Date: Mon Feb  2 12:58:29 2009
New Revision: 1492
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1492&view=rev

Log:
	* daemon/pk/gkr-pk-cert.c:
	* daemon/pk/gkr-pk-import.c:
	* daemon/pk/gkr-pk-object.c:
	* daemon/pk/gkr-pk-privkey.c:
	* daemon/pk/gkr-pk-pubkey.c:
	* daemon/pk/gkr-pk-util.c:
	* gp11/gp11-attributes.c:
	* gp11/gp11-object.c:
	* gp11/tests/unit-test-gp11-attributes.c:
	* gp11/tests/unit-test-gp11-object.c:
	* gp11/tests/unit-test-gp11-session.c:
	* pkcs11/gck/gck-attributes.c:
	* pkcs11/gck/gck-private-key.c:
	* pkcs11/gck/gck-public-key.c:
	* pkcs11/gck/gck-session.c:
	* pkcs11/ssh-agent/gck-ssh-agent-ops.c:
	* pkcs11/ssh-agent/gck-ssh-agent-proto.c:
	* tools/gkr-tool-import.c: Fix more size problems when using constants 
	with varargs. Fixes bug #569736. Research by Christophe Fergeau

Modified:
   trunk/ChangeLog
   trunk/daemon/pk/gkr-pk-cert.c
   trunk/daemon/pk/gkr-pk-import.c
   trunk/daemon/pk/gkr-pk-object.c
   trunk/daemon/pk/gkr-pk-privkey.c
   trunk/daemon/pk/gkr-pk-pubkey.c
   trunk/daemon/pk/gkr-pk-util.c
   trunk/gp11/gp11-attributes.c
   trunk/gp11/gp11-object.c
   trunk/gp11/tests/unit-test-gp11-attributes.c
   trunk/gp11/tests/unit-test-gp11-object.c
   trunk/gp11/tests/unit-test-gp11-session.c
   trunk/pkcs11/gck/gck-attributes.c
   trunk/pkcs11/gck/gck-private-key.c
   trunk/pkcs11/gck/gck-public-key.c
   trunk/pkcs11/gck/gck-session.c
   trunk/pkcs11/ssh-agent/gck-ssh-agent-ops.c
   trunk/pkcs11/ssh-agent/gck-ssh-agent-proto.c
   trunk/tool/gkr-tool-import.c

Modified: trunk/daemon/pk/gkr-pk-cert.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-cert.c	(original)
+++ trunk/daemon/pk/gkr-pk-cert.c	Mon Feb  2 12:58:29 2009
@@ -719,7 +719,7 @@
 		return CKR_ATTRIBUTE_VALUE_INVALID;
 	
 	/* All the attributes that we used up */	
-	gkr_pk_attributes_consume (array, CKA_CERTIFICATE_TYPE, CKA_VALUE, -1);
+	gkr_pk_attributes_consume (array, CKA_CERTIFICATE_TYPE, CKA_VALUE, G_MAXULONG);
 	
 	*object = GKR_PK_OBJECT (gkr_pk_cert_new (manager, 0, asn));
 	return CKR_OK;

Modified: trunk/daemon/pk/gkr-pk-import.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-import.c	(original)
+++ trunk/daemon/pk/gkr-pk-import.c	Mon Feb  2 12:58:29 2009
@@ -522,7 +522,7 @@
 	
 	/* All the attributes that we used up */
 	gkr_pk_attributes_consume (array, CKA_VALUE, CKA_GNOME_IMPORT_TOKEN, 
-	                           CKA_GNOME_IMPORT_LABEL, -1);
+	                           CKA_GNOME_IMPORT_LABEL, G_MAXULONG);
 	
 	return CKR_OK;
 }

Modified: trunk/daemon/pk/gkr-pk-object.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-object.c	(original)
+++ trunk/daemon/pk/gkr-pk-object.c	Mon Feb  2 12:58:29 2009
@@ -539,7 +539,7 @@
 	g_return_val_if_fail (*object != NULL, CKR_GENERAL_ERROR);
 
 	/* Mark these bits as used */
-	gkr_pk_attributes_consume (attrs, CKA_CLASS, CKA_TOKEN, -1);
+	gkr_pk_attributes_consume (attrs, CKA_CLASS, CKA_TOKEN, G_MAXULONG);
 	
 	/* 
 	 * Check that all the remaining attributes are either already

Modified: trunk/daemon/pk/gkr-pk-privkey.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-privkey.c	(original)
+++ trunk/daemon/pk/gkr-pk-privkey.c	Mon Feb  2 12:58:29 2009
@@ -200,7 +200,7 @@
 	
 	gkr_pk_attributes_consume (attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, 
 	                           CKA_PRIVATE_EXPONENT, CKA_PRIME_1, CKA_PRIME_2, 
-	                           CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT, -1);
+	                           CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -249,7 +249,7 @@
 	}
 
 	gkr_pk_attributes_consume (attrs, CKA_PRIME, CKA_SUBPRIME, 
-	                           CKA_BASE, CKA_VALUE, -1);
+	                           CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -642,7 +642,7 @@
 	
 	if (!gkr_pk_attributes_ulong (array, CKA_KEY_TYPE, &type))
  		return CKR_TEMPLATE_INCOMPLETE;
- 	gkr_pk_attributes_consume (array, CKA_KEY_TYPE, -1);
+ 	gkr_pk_attributes_consume (array, CKA_KEY_TYPE, G_MAXULONG);
 
  	switch (type) {
 	case CKK_RSA:

Modified: trunk/daemon/pk/gkr-pk-pubkey.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-pubkey.c	(original)
+++ trunk/daemon/pk/gkr-pk-pubkey.c	Mon Feb  2 12:58:29 2009
@@ -152,7 +152,7 @@
 		goto done;
 	}
 	
-	gkr_pk_attributes_consume (attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, -1);
+	gkr_pk_attributes_consume (attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -191,7 +191,7 @@
 	}
 	
 	gkr_pk_attributes_consume (attrs, CKA_PRIME, CKA_SUBPRIME, 
-	                           CKA_BASE, CKA_VALUE, -1);
+	                           CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 	
 done:
@@ -549,7 +549,7 @@
 	
 	if (!gkr_pk_attributes_ulong (array, CKA_KEY_TYPE, &type))
  		return CKR_TEMPLATE_INCOMPLETE;
- 	gkr_pk_attributes_consume (array, CKA_KEY_TYPE, -1);
+ 	gkr_pk_attributes_consume (array, CKA_KEY_TYPE, G_MAXULONG);
 
  	switch (type) {
 	case CKK_RSA:

Modified: trunk/daemon/pk/gkr-pk-util.c
==============================================================================
--- trunk/daemon/pk/gkr-pk-util.c	(original)
+++ trunk/daemon/pk/gkr-pk-util.c	Mon Feb  2 12:58:29 2009
@@ -491,7 +491,7 @@
 	/* Convert the var args into an array */
 	types = g_array_new (FALSE, TRUE, sizeof (CK_ATTRIBUTE_TYPE));
 	va_start (va, attrs);
-	while ((type = va_arg (va, CK_ATTRIBUTE_TYPE)) != (CK_ULONG)-1)
+	while ((type = va_arg (va, CK_ATTRIBUTE_TYPE)) != G_MAXULONG)
 		 g_array_append_val (types, type);
 	va_end (va);
 	

Modified: trunk/gp11/gp11-attributes.c
==============================================================================
--- trunk/gp11/gp11-attributes.c	(original)
+++ trunk/gp11/gp11-attributes.c	Mon Feb  2 12:58:29 2009
@@ -694,7 +694,7 @@
 
 	va_start (va, attr_type);
 	
-	while (attr_type != (gulong)-1) {
+	while (attr_type != GP11_INVALID) {
 		gp11_attributes_add_empty (attrs, attr_type);
 		attr_type = va_arg (va, gulong);
 	}

Modified: trunk/gp11/gp11-object.c
==============================================================================
--- trunk/gp11/gp11-object.c	(original)
+++ trunk/gp11/gp11-object.c	Mon Feb  2 12:58:29 2009
@@ -872,7 +872,7 @@
 	va_start (va, err);
 	for (;;) {
 		type = va_arg (va, gulong);
-		if (type == (gulong)-1)
+		if (type == GP11_INVALID)
 			break;
 		gp11_attributes_add_invalid (attrs, type);
 	}

Modified: trunk/gp11/tests/unit-test-gp11-attributes.c
==============================================================================
--- trunk/gp11/tests/unit-test-gp11-attributes.c	(original)
+++ trunk/gp11/tests/unit-test-gp11-attributes.c	Mon Feb  2 12:58:29 2009
@@ -350,11 +350,11 @@
 {
 	GDate *date = g_date_new_dmy (11, 12, 2008);
 	GP11Attributes *attrs;
-	attrs = gp11_attributes_newv (0, GP11_BOOLEAN, TRUE, 
-	                              101, GP11_ULONG, 888,
-	                              202, GP11_STRING, "string",
-	                              303, GP11_DATE, date,
-	                              404, N_ATTR_DATA, ATTR_DATA,
+	attrs = gp11_attributes_newv (0UL, GP11_BOOLEAN, TRUE, 
+	                              101UL, GP11_ULONG, 888,
+	                              202UL, GP11_STRING, "string",
+	                              303UL, GP11_DATE, date,
+	                              404UL, N_ATTR_DATA, ATTR_DATA,
 	                              GP11_INVALID);
 	g_date_free (date);
 
@@ -362,13 +362,13 @@
 	gp11_attributes_unref (attrs);
 	
 	/* An empty one */
-	attrs = gp11_attributes_newv (-1);
+	attrs = gp11_attributes_newv (GP11_INVALID);
 	gp11_attributes_unref (attrs);
 }
 
 DEFINE_TEST(new_empty_attributes)
 {
-	GP11Attributes *attrs = gp11_attributes_new_empty (101, 202, 303, 404, -1);
+	GP11Attributes *attrs = gp11_attributes_new_empty (101UL, 202UL, 303UL, 404UL, GP11_INVALID);
 	GP11Attribute *attr;
 	guint i;
 	
@@ -400,12 +400,12 @@
 	GDate *date = g_date_new_dmy (11, 12, 2008);
 	
 	attrs = help_attributes_valist (232434243, /* Not used */
-	                                0, GP11_BOOLEAN, TRUE, 
-	                                101, GP11_ULONG, 888,
-	                                202, GP11_STRING, "string",
-	                                303, GP11_DATE, date,
-	                                404, N_ATTR_DATA, ATTR_DATA,
-	                                -1);
+	                                0UL, GP11_BOOLEAN, TRUE, 
+	                                101UL, GP11_ULONG, 888,
+	                                202UL, GP11_STRING, "string",
+	                                303UL, GP11_DATE, date,
+	                                404UL, N_ATTR_DATA, ATTR_DATA,
+	                                GP11_INVALID);
 	
 	g_date_free (date);
 	test_attributes_contents (attrs, FALSE);
@@ -418,8 +418,8 @@
 	GP11Attributes *attrs;
 	
 	/* We should catch this with a warning */
-	attrs = gp11_attributes_newv (1, G_MAXSSIZE + 500U, GP11_ULONG, "invalid data",
-	                              -1);
+	attrs = gp11_attributes_newv (1UL, G_MAXSSIZE + 500U, GP11_ULONG, "invalid data",
+	                              GP11_INVALID);
 	
 	gp11_attributes_unref (attrs);
 }
@@ -430,14 +430,14 @@
 	GP11Attributes *attrs;
 	GDate *date = g_date_new_dmy (11, 12, 2008);
 	attrs = gp11_attributes_new ();
-	gp11_attributes_add_boolean (attrs, 0, TRUE);
-	gp11_attributes_add_ulong (attrs, 101, 888);
-	gp11_attributes_add_string (attrs, 202, "string");
-	gp11_attributes_add_date (attrs, 303, date);
+	gp11_attributes_add_boolean (attrs, 0UL, TRUE);
+	gp11_attributes_add_ulong (attrs, 101UL, 888);
+	gp11_attributes_add_string (attrs, 202UL, "string");
+	gp11_attributes_add_date (attrs, 303UL, date);
 	g_date_free (date);
-	gp11_attributes_add_data (attrs, 404, ATTR_DATA, N_ATTR_DATA);
-	gp11_attributes_add_invalid (attrs, 505);
-	gp11_attributes_add_empty (attrs, 606);
+	gp11_attributes_add_data (attrs, 404UL, ATTR_DATA, N_ATTR_DATA);
+	gp11_attributes_add_invalid (attrs, 505UL);
+	gp11_attributes_add_empty (attrs, 606UL);
 	test_attributes_contents (attrs, TRUE);
 	gp11_attributes_unref (attrs);
 }
@@ -450,32 +450,32 @@
 	GDate *date = g_date_new_dmy (11, 12, 2008);
 	attrs = gp11_attributes_new ();
 	
-	gp11_attribute_init_boolean (&attr, 0, TRUE);
+	gp11_attribute_init_boolean (&attr, 0UL, TRUE);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 	
-	gp11_attribute_init_ulong (&attr, 101, 888);
+	gp11_attribute_init_ulong (&attr, 101UL, 888);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 	
-	gp11_attribute_init_string (&attr, 202, "string");
+	gp11_attribute_init_string (&attr, 202UL, "string");
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 
-	gp11_attribute_init_date (&attr, 303, date);
+	gp11_attribute_init_date (&attr, 303UL, date);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 	g_date_free (date);
 	
-	gp11_attribute_init (&attr, 404, ATTR_DATA, N_ATTR_DATA);
+	gp11_attribute_init (&attr, 404UL, ATTR_DATA, N_ATTR_DATA);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 	
-	gp11_attribute_init_invalid (&attr, 505);
+	gp11_attribute_init_invalid (&attr, 505UL);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 
-	gp11_attribute_init_empty (&attr, 606);
+	gp11_attribute_init_empty (&attr, 606UL);
 	gp11_attributes_add (attrs, &attr);
 	gp11_attribute_clear (&attr);
 
@@ -493,33 +493,33 @@
 	gchar *svalue;
 	
 	GP11Attributes *attrs;
-	attrs = gp11_attributes_newv (0, GP11_BOOLEAN, TRUE, 
-	                              101, GP11_ULONG, 888,
-	                              202, GP11_STRING, "string",
-	                              303, GP11_DATE, date,
-	                              404, N_ATTR_DATA, ATTR_DATA,
-	                              -1);
+	attrs = gp11_attributes_newv (0UL, GP11_BOOLEAN, TRUE, 
+	                              101UL, GP11_ULONG, 888,
+	                              202UL, GP11_STRING, "string",
+	                              303UL, GP11_DATE, date,
+	                              404UL, N_ATTR_DATA, ATTR_DATA,
+	                              GP11_INVALID);
 
 	attr = gp11_attributes_find (attrs, 404);
 	g_assert (attr != NULL);
 	g_assert (attr->length == N_ATTR_DATA);
 	g_assert (memcmp (attr->value, ATTR_DATA, N_ATTR_DATA) == 0);
 	
-	ret = gp11_attributes_find_boolean (attrs, 0, &bvalue);
+	ret = gp11_attributes_find_boolean (attrs, 0UL, &bvalue);
 	g_assert (ret == TRUE);
 	g_assert (bvalue == TRUE);
 	
-	ret = gp11_attributes_find_ulong (attrs, 101, &uvalue);
+	ret = gp11_attributes_find_ulong (attrs, 101UL, &uvalue);
 	g_assert (ret == TRUE);
 	g_assert (uvalue == 888);
 
-	ret = gp11_attributes_find_string (attrs, 202, &svalue);
+	ret = gp11_attributes_find_string (attrs, 202UL, &svalue);
 	g_assert (ret == TRUE);
 	g_assert (svalue != NULL);
 	g_assert (strcmp (svalue, "string") == 0);
 	g_free (svalue);
 	
-	ret = gp11_attributes_find_date (attrs, 303, &check);
+	ret = gp11_attributes_find_date (attrs, 303UL, &check);
 	g_assert (ret == TRUE);
 	g_assert (g_date_compare (date, &check) == 0);
 	

Modified: trunk/gp11/tests/unit-test-gp11-object.c
==============================================================================
--- trunk/gp11/tests/unit-test-gp11-object.c	(original)
+++ trunk/gp11/tests/unit-test-gp11-object.c	Mon Feb  2 12:58:29 2009
@@ -110,7 +110,7 @@
 	                                     CKA_LABEL, GP11_STRING, "TEST LABEL",
 	                                     CKA_TOKEN, GP11_BOOLEAN, CK_FALSE,
 	                                     CKA_VALUE, 4, "BLAH",
-	                                     -1);
+	                                     GP11_INVALID);
 	SUCCESS_RES (object, err);
 	g_assert (GP11_IS_OBJECT (object));
 	
@@ -124,7 +124,7 @@
 	                              CKA_LABEL, GP11_STRING, "TEST LABEL",
 	                              CKA_TOKEN, GP11_BOOLEAN, CK_FALSE,
 	                              CKA_VALUE, 4, "BLAH",
-	                              -1);
+	                              GP11_INVALID);
 	
 	object = gp11_session_create_object_full (session, attrs, NULL, &err);
 	g_assert (GP11_IS_OBJECT (object));
@@ -163,7 +163,7 @@
 	                                     CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                                     CKA_LABEL, GP11_STRING, "TEST OBJECT",
 	                                     CKA_TOKEN, GP11_BOOLEAN, CK_TRUE,
-	                                     -1);
+	                                     GP11_INVALID);
 	SUCCESS_RES (object, err);
 	g_assert (GP11_IS_OBJECT (object));
 	
@@ -179,7 +179,7 @@
 	                                     CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                                     CKA_LABEL, GP11_STRING, "TEST OBJECT",
 	                                     CKA_TOKEN, GP11_BOOLEAN, CK_TRUE,
-	                                     -1);
+	                                     GP11_INVALID);
 	SUCCESS_RES (object, err);
 	g_assert (GP11_IS_OBJECT (object));
 	
@@ -195,7 +195,7 @@
 	                                     CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                                     CKA_LABEL, GP11_STRING, "TEST OBJECT",
 	                                     CKA_TOKEN, GP11_BOOLEAN, CK_TRUE,
-	                                     -1);
+	                                     GP11_INVALID);
 	SUCCESS_RES (object, err);
 	g_assert (GP11_IS_OBJECT (object));
 	
@@ -222,7 +222,7 @@
 	gchar *value = NULL;
 	
 	/* Simple */
-	attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, -1);
+	attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, GP11_INVALID);
 	SUCCESS_RES (attrs, err);
 	if (attrs != NULL) {
 		g_assert (gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass) && klass == CKO_DATA);
@@ -232,7 +232,7 @@
 	gp11_attributes_unref (attrs);
 
 	/* Full */
-	attrs = gp11_attributes_new_empty (CKA_CLASS, CKA_LABEL, -1);
+	attrs = gp11_attributes_new_empty (CKA_CLASS, CKA_LABEL, GP11_INVALID);
 	attrs_ret = gp11_object_get_full (object, attrs, NULL, &err);
 	SUCCESS_RES (attrs_ret, err);
 	if (attrs_ret != NULL) {
@@ -244,7 +244,7 @@
 	gp11_attributes_unref (attrs);
 
 	/* Async */
-	attrs = gp11_attributes_new_empty (CKA_CLASS, CKA_LABEL, -1);
+	attrs = gp11_attributes_new_empty (CKA_CLASS, CKA_LABEL, GP11_INVALID);
 	gp11_object_get_async (object, attrs, NULL, fetch_async_result, &result);
 	WAIT_UNTIL (result);
 	g_assert (result != NULL);
@@ -315,10 +315,10 @@
 	ret = gp11_object_set (object, &err, 
 	                       CKA_CLASS, GP11_ULONG, 5, 
 	                       CKA_LABEL, GP11_STRING, "CHANGE ONE", 
-	                       -1);
+	                       GP11_INVALID);
 	SUCCESS_RES (ret, err);
 	if (ret) {
-		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, -1);
+		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, GP11_INVALID);
 		g_assert (gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass) && klass == 5);
 		g_assert (gp11_attributes_find_string (attrs, CKA_LABEL, &value) && strcmp (value, "CHANGE ONE") == 0);
 		g_free (value); value = NULL;
@@ -327,14 +327,14 @@
 
 	templ = gp11_attributes_newv (CKA_CLASS, GP11_ULONG, 6,
 	                              CKA_LABEL, GP11_STRING, "CHANGE TWO",
-	                              -1);
+	                              GP11_INVALID);
 	
 	/* Full */
 	ret = gp11_object_set_full (object, templ, NULL, &err);
 	gp11_attributes_unref (templ);
 	SUCCESS_RES (ret, err);
 	if (ret) {
-		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, -1);
+		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, GP11_INVALID);
 		g_assert (gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass) && klass == 6);
 		g_assert (gp11_attributes_find_string (attrs, CKA_LABEL, &value) && strcmp (value, "CHANGE TWO") == 0);
 		g_free (value); value = NULL;
@@ -343,7 +343,7 @@
 
 	templ = gp11_attributes_newv (CKA_CLASS, GP11_ULONG, 7,
 	                              CKA_LABEL, GP11_STRING, "CHANGE THREE",
-	                              -1);
+	                              GP11_INVALID);
 
 	/* Async */
 	gp11_object_set_async (object, templ, NULL, fetch_async_result, &result);
@@ -354,7 +354,7 @@
 	g_object_unref (result);
 	SUCCESS_RES (ret, err);
 	if (ret) {
-		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, -1);
+		attrs = gp11_object_get (object, &err, CKA_CLASS, CKA_LABEL, GP11_INVALID);
 		g_assert (gp11_attributes_find_ulong (attrs, CKA_CLASS, &klass) && klass == 7);
 		g_assert (gp11_attributes_find_string (attrs, CKA_LABEL, &value) && strcmp (value, "CHANGE THREE") == 0);
 		g_free (value); value = NULL;
@@ -373,17 +373,17 @@
 	testobj = gp11_session_create_object (session, &err, 
 	                                      CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                                      CKA_LABEL, GP11_STRING, "UNIQUE LABEL",
-	                                      -1);
+	                                      GP11_INVALID);
 	g_object_unref (testobj);
 
 	testobj = gp11_session_create_object (session, &err, 
 	                                      CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                                      CKA_LABEL, GP11_STRING, "OTHER LABEL",
-	                                      -1);
+	                                      GP11_INVALID);
 	g_object_unref (testobj);
 
 	/* Simple, "TEST LABEL" */
-	objects = gp11_session_find_objects (session, &err, CKA_LABEL, GP11_STRING, "UNIQUE LABEL", -1);
+	objects = gp11_session_find_objects (session, &err, CKA_LABEL, GP11_STRING, "UNIQUE LABEL", GP11_INVALID);
 	SUCCESS_RES (objects, err);
 	g_assert (g_list_length (objects) == 1);
 	gp11_list_unref_free (objects);

Modified: trunk/gp11/tests/unit-test-gp11-session.c
==============================================================================
--- trunk/gp11/tests/unit-test-gp11-session.c	(original)
+++ trunk/gp11/tests/unit-test-gp11-session.c	Mon Feb  2 12:58:29 2009
@@ -230,7 +230,7 @@
 	attrs = gp11_attributes_newv (CKA_CLASS, GP11_ULONG, CKO_DATA,
 	                              CKA_LABEL, GP11_STRING, "TEST OBJECT",
 	                              CKA_PRIVATE, GP11_BOOLEAN, CK_TRUE,
-	                              -1);
+	                              GP11_INVALID);
 	
 	/* Try to do something that requires a login */
 	object = gp11_session_create_object_full (session, attrs, NULL, &err); 

Modified: trunk/pkcs11/gck/gck-attributes.c
==============================================================================
--- trunk/pkcs11/gck/gck-attributes.c	(original)
+++ trunk/pkcs11/gck/gck-attributes.c	Mon Feb  2 12:58:29 2009
@@ -180,7 +180,7 @@
 	/* Convert the var args into an array */
 	types = g_array_new (FALSE, TRUE, sizeof (CK_ATTRIBUTE_TYPE));
 	va_start (va, n_attrs);
-	while ((type = va_arg (va, CK_ATTRIBUTE_TYPE)) != (CK_ULONG)-1)
+	while ((type = va_arg (va, CK_ATTRIBUTE_TYPE)) != G_MAXULONG)
 		 g_array_append_val (types, type);
 	va_end (va);
 	

Modified: trunk/pkcs11/gck/gck-private-key.c
==============================================================================
--- trunk/pkcs11/gck/gck-private-key.c	(original)
+++ trunk/pkcs11/gck/gck-private-key.c	Mon Feb  2 12:58:29 2009
@@ -82,7 +82,7 @@
 	
 	gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, 
 	                        CKA_PRIVATE_EXPONENT, CKA_PRIME_1, CKA_PRIME_2, 
-	                        CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT, -1);
+	                        CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -130,7 +130,7 @@
 	}
 
 	gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME, 
-	                        CKA_BASE, CKA_VALUE, -1);
+	                        CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -369,7 +369,7 @@
 		return;
 	}
 		
- 	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, -1);
+ 	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
 
  	switch (type) {
 	case CKK_RSA:

Modified: trunk/pkcs11/gck/gck-public-key.c
==============================================================================
--- trunk/pkcs11/gck/gck-public-key.c	(original)
+++ trunk/pkcs11/gck/gck-public-key.c	Mon Feb  2 12:58:29 2009
@@ -88,7 +88,7 @@
 		goto done;
 	}
 	
-	gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, -1); 
+	gck_attributes_consume (attrs, n_attrs, CKA_MODULUS, CKA_PUBLIC_EXPONENT, CKA_MODULUS_BITS, G_MAXULONG); 
 	ret = CKR_OK;
 
 done:
@@ -126,7 +126,7 @@
 	}
 
 	gck_attributes_consume (attrs, n_attrs, CKA_PRIME, CKA_SUBPRIME, 
-	                        CKA_BASE, CKA_VALUE, -1);
+	                        CKA_BASE, CKA_VALUE, G_MAXULONG);
 	ret = CKR_OK;
 
 done:
@@ -301,7 +301,7 @@
 		return;
 	}
 		
- 	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, -1);
+ 	gck_attributes_consume (attrs, n_attrs, CKA_KEY_TYPE, CKA_CLASS, G_MAXULONG);
 
  	switch (type) {
 	case CKK_RSA:

Modified: trunk/pkcs11/gck/gck-session.c
==============================================================================
--- trunk/pkcs11/gck/gck-session.c	(original)
+++ trunk/pkcs11/gck/gck-session.c	Mon Feb  2 12:58:29 2009
@@ -778,7 +778,7 @@
 	}
 
 	/* Next go through and set all attributes that weren't used initially */
-	gck_attributes_consume (attrs, n_attrs, CKA_TOKEN, -1);
+	gck_attributes_consume (attrs, n_attrs, CKA_TOKEN, G_MAXULONG);
 	for (i = 0; i < n_attrs && !gck_transaction_get_failed (transaction); ++i) {
 		if (!gck_attribute_consumed (&attrs[i]))
 			gck_object_set_attribute (object, transaction, &attrs[i]);

Modified: trunk/pkcs11/ssh-agent/gck-ssh-agent-ops.c
==============================================================================
--- trunk/pkcs11/ssh-agent/gck-ssh-agent-ops.c	(original)
+++ trunk/pkcs11/ssh-agent/gck-ssh-agent-ops.c	Mon Feb  2 12:58:29 2009
@@ -179,7 +179,7 @@
 	g_return_val_if_fail (*result == NULL, FALSE);
 	
 	/* Get the key identifier and token */
-	attrs = gp11_object_get (object, &error, CKA_ID, CKA_TOKEN, -1);
+	attrs = gp11_object_get (object, &error, CKA_ID, CKA_TOKEN, GP11_INVALID);
 	if (error) {
 		g_warning ("error retrieving attributes for public key: %s", error->message);
 		g_clear_error (&error);
@@ -238,7 +238,7 @@
 	 */
 	
 	attrs = gp11_object_get (object, &error, CKA_ID, CKA_LABEL, CKA_KEY_TYPE, CKA_MODULUS, 
-	                         CKA_PUBLIC_EXPONENT, CKA_CLASS, CKA_MODULUS_BITS, -1);
+	                         CKA_PUBLIC_EXPONENT, CKA_CLASS, CKA_MODULUS_BITS, GP11_INVALID);
 	if (error) {
 		g_warning ("error retrieving attributes for public key: %s", error->message);
 		g_clear_error (&error);
@@ -294,7 +294,7 @@
 	
 	attrs = gp11_object_get (object, &error, CKA_ID, CKA_LABEL, CKA_KEY_TYPE, CKA_MODULUS, 
 	                         CKA_PUBLIC_EXPONENT, CKA_PRIME, CKA_SUBPRIME, CKA_BASE, 
-	                         CKA_VALUE, CKA_CLASS, CKA_MODULUS_BITS, CKA_TOKEN, -1);
+	                         CKA_VALUE, CKA_CLASS, CKA_MODULUS_BITS, CKA_TOKEN, GP11_INVALID);
 	if (error) {
 		g_warning ("error retrieving attributes for public key: %s", error->message);
 		g_clear_error (&error);
@@ -558,7 +558,7 @@
 		return FALSE;
 		
 	algo = gck_ssh_agent_proto_keytype_to_algo (stype);
-	if (algo == (gulong)-1) {
+	if (algo == G_MAXULONG) {
 		g_warning ("unsupported algorithm from SSH: %s", stype);
 		g_free (stype);
 		return FALSE;

Modified: trunk/pkcs11/ssh-agent/gck-ssh-agent-proto.c
==============================================================================
--- trunk/pkcs11/ssh-agent/gck-ssh-agent-proto.c	(original)
+++ trunk/pkcs11/ssh-agent/gck-ssh-agent-proto.c	Mon Feb  2 12:58:29 2009
@@ -35,12 +35,12 @@
 gulong
 gck_ssh_agent_proto_keytype_to_algo (const gchar *salgo)
 {
-	g_return_val_if_fail (salgo, (gulong)-1);
+	g_return_val_if_fail (salgo, G_MAXULONG);
 	if (strcmp (salgo, "ssh-rsa") == 0)
 		return CKK_RSA;
 	else if (strcmp (salgo, "ssh-dss") == 0)
 		return CKK_DSA;
-	return (gulong)-1;
+	return G_MAXULONG;
 }
 
 const gchar*
@@ -180,7 +180,7 @@
 		return FALSE;
 	
 	alg = gck_ssh_agent_proto_keytype_to_algo (stype);
-	if (alg == (gulong)-1) {
+	if (alg == G_MAXULONG) {
 		g_warning ("unsupported algorithm from SSH: %s", stype);
 		g_free (stype);
 		return FALSE;

Modified: trunk/tool/gkr-tool-import.c
==============================================================================
--- trunk/tool/gkr-tool-import.c	(original)
+++ trunk/tool/gkr-tool-import.c	Mon Feb  2 12:58:29 2009
@@ -49,7 +49,7 @@
 	GError *err = NULL;
 	gchar *label, *hex;
 	
-	attrs = gp11_attributes_new_empty (CKA_LABEL, CKA_CLASS, CKA_ID, -1);
+	attrs = gp11_attributes_new_empty (CKA_LABEL, CKA_CLASS, CKA_ID, GP11_INVALID);
 	if (!gp11_object_get_full (object, attrs, NULL, &err)) {
 		gkr_tool_handle_error (&err, "couldn't get imported object info");
 		return;



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