[gnome-keyring] gck: More introspection and documentation cleanup
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] gck: More introspection and documentation cleanup
- Date: Thu, 29 Sep 2011 14:28:46 +0000 (UTC)
commit 86841eb8e1f297840e91c7e252bbeba109ddf56b
Author: Stef Walter <stefw collabora co uk>
Date: Thu Sep 29 15:02:46 2011 +0200
gck: More introspection and documentation cleanup
* In particular, use guchar * for arrays of bytes.
daemon/dbus/gkd-secret-property.c | 4 +-
daemon/gpg-agent/gkd-gpg-agent-ops.c | 2 +-
gck/gck-attributes.c | 143 +++++++++++++--------------------
gck/gck-misc.c | 23 ++++--
gck/gck-mock.c | 8 +-
gck/gck-module.c | 8 +-
gck/gck-object.c | 29 ++++---
gck/gck-session.c | 45 +++++++----
gck/gck-slot.c | 32 ++++----
gck/gck-uri.c | 4 +-
gck/gck.h | 14 ++--
gck/tests/test-gck-attributes.c | 20 +++---
gck/tests/test-gck-crypto.c | 20 +++---
gck/tests/test-gck-object.c | 2 +-
gck/tests/test-gck-uri.c | 2 +-
15 files changed, 174 insertions(+), 182 deletions(-)
---
diff --git a/daemon/dbus/gkd-secret-property.c b/daemon/dbus/gkd-secret-property.c
index 35c7d38..fa1fc07 100644
--- a/daemon/dbus/gkd-secret-property.c
+++ b/daemon/dbus/gkd-secret-property.c
@@ -274,7 +274,7 @@ iter_get_time (DBusMessageIter *iter, GckAttribute* attr)
if (!strftime (buf, sizeof (buf), "%Y%m%d%H%M%S00", &tm))
g_return_val_if_reached (FALSE);
- gck_attribute_init (attr, attr->type, buf, 16);
+ gck_attribute_init (attr, attr->type, (const guchar *)buf, 16);
return TRUE;
}
@@ -368,7 +368,7 @@ iter_get_fields (DBusMessageIter *iter, GckAttribute* attr)
dbus_message_iter_next (&array);
}
- gck_attribute_init (attr, attr->type, result->str, result->len);
+ gck_attribute_init (attr, attr->type, (const guchar *)result->str, result->len);
g_string_free (result, TRUE);
return TRUE;
}
diff --git a/daemon/gpg-agent/gkd-gpg-agent-ops.c b/daemon/gpg-agent/gkd-gpg-agent-ops.c
index 44ae8cf..a8ffefc 100644
--- a/daemon/gpg-agent/gkd-gpg-agent-ops.c
+++ b/daemon/gpg-agent/gkd-gpg-agent-ops.c
@@ -70,7 +70,7 @@ keyid_to_field_attribute (const gchar *keyid, GckAttributes *attrs)
g_string_append (fields, "gnome-keyring:gpg-agent");
g_string_append_c (fields, '\0');
- gck_attributes_add_data (attrs, CKA_G_FIELDS, fields->str, fields->len);
+ gck_attributes_add_data (attrs, CKA_G_FIELDS, (const guchar *)fields->str, fields->len);
g_string_free (fields, TRUE);
}
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index c5d56a8..cee4d8c 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -77,7 +77,7 @@ attribute_init (GckAttribute *attr, gulong attr_type,
* gck_attribute_init: (skip)
* @attr: An uninitialized attribute.
* @attr_type: The PKCS\#11 attribute type to set on the attribute.
- * @value: The raw value of the attribute.
+ * @value: (array length=length): The raw value of the attribute.
* @length: The length of the raw value.
*
* Initialize a PKCS\#11 attribute. This copies the value memory
@@ -87,8 +87,10 @@ attribute_init (GckAttribute *attr, gulong attr_type,
* to free the internal memory.
**/
void
-gck_attribute_init (GckAttribute *attr, gulong attr_type,
- gconstpointer value, gsize length)
+gck_attribute_init (GckAttribute *attr,
+ gulong attr_type,
+ const guchar *value,
+ gsize length)
{
g_return_if_fail (attr);
attribute_init (attr, attr_type, value, length, g_realloc);
@@ -285,8 +287,8 @@ gck_attribute_get_type (void)
* Create a new PKCS\#11 attribute. The value will be copied
* into the new attribute.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute
+ * use gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new (gulong attr_type, gpointer value, gsize length)
@@ -304,8 +306,8 @@ gck_attribute_new (gulong attr_type, gpointer value, gsize length)
* state. Specifically this sets the value length to (CK_ULONG)-1
* as specified in the PKCS\#11 specification.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute
+ * use gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new_invalid (gulong attr_type)
@@ -321,8 +323,8 @@ gck_attribute_new_invalid (gulong attr_type)
*
* Create a new PKCS\#11 attribute with empty data.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute
+ * use gck_attribute_free() to free it
*/
GckAttribute*
gck_attribute_new_empty (gulong attr_type)
@@ -340,8 +342,8 @@ gck_attribute_new_empty (gulong attr_type)
* Initialize a PKCS\#11 attribute to boolean. This will result
* in a CK_BBOOL attribute from the PKCS\#11 specs.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute use
+ * gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new_boolean (gulong attr_type, gboolean value)
@@ -359,8 +361,8 @@ gck_attribute_new_boolean (gulong attr_type, gboolean value)
* Initialize a PKCS\#11 attribute to a date. This will result
* in a CK_DATE attribute from the PKCS\#11 specs.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute use
+ * gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new_date (gulong attr_type, const GDate *value)
@@ -378,8 +380,8 @@ gck_attribute_new_date (gulong attr_type, const GDate *value)
* Initialize a PKCS\#11 attribute to a unsigned long. This will result
* in a CK_ULONG attribute from the PKCS\#11 specs.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute use
+ * gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new_ulong (gulong attr_type, gulong value)
@@ -399,8 +401,8 @@ gck_attribute_new_ulong (gulong attr_type, gulong value)
* The text in the attribute will be of the same encoding as you pass
* to this function.
*
- * Return value: The new attribute. When done with the attribute use
- * gck_attribute_free() to free it.
+ * Returns: (transfer full): the new attribute; when done with the attribute use
+ * gck_attribute_free() to free it
**/
GckAttribute*
gck_attribute_new_string (gulong attr_type, const gchar *value)
@@ -554,8 +556,8 @@ gck_attribute_get_date (GckAttribute *attr, GDate *value)
* Duplicate the PKCS\#11 attribute. All value memory is
* also copied.
*
- * Return value: The duplicated attribute. Use gck_attribute_free()
- * to free it.
+ * Returns: (transfer full): the duplicated attribute; use gck_attribute_free()
+ * to free it
*/
GckAttribute*
gck_attribute_dup (GckAttribute *attr)
@@ -656,8 +658,8 @@ gck_attribute_free (GckAttribute *attr)
/**
* gck_attribute_equal:
- * @a: First attribute to compare.
- * @b: Second attribute to compare.
+ * @a: (type Gck.Attribute): first attribute to compare
+ * @b: (type Gck.Attribute): second attribute to compare
*
* Compare two attributes. Useful with <code>GHashTable</code>.
*
@@ -708,42 +710,6 @@ struct _GckAttributes {
};
/**
- * gck_BOOLEAN:
- *
- * The attribute data is a gboolean. Used with variable argument functions.
- **/
-
-/**
- * gck_ULONG:
- *
- * The attribute data is a gulong. Used with variable argument functions.
- **/
-
-/**
- * gck_STRING:
- *
- * The attribute data is a gchar. Used with variable argument functions.
- **/
-
-/**
- * gck_DATE:
- *
- * The attribute data is a GDate. Used with variable argument functions.
- **/
-
-/**
- * gck_DATE:
- *
- * Signifies that no more attributes follow. Used with variable argument functions.
- **/
-
-/**
- * gck_ATTRIBUTES_TYPE:
- *
- * A boxed type that can be used to hold a GckAttributes object.
- **/
-
-/**
* GckAllocator:
* @data: Memory to allocate or deallocate.
* @length: New length of memory.
@@ -783,8 +749,8 @@ gck_attributes_get_boxed_type (void)
*
* Create a new GckAttributes array.
*
- * Return value: The new attributes array. When done with the array
- * release it with gck_attributes_unref().
+ * Returns: (transfer full): the new attributes array; when done with the array
+ * release it with gck_attributes_unref().
**/
GckAttributes*
gck_attributes_new (void)
@@ -798,8 +764,8 @@ gck_attributes_new (void)
*
* Create a new GckAttributes array.
*
- * Return value: The new attributes array. When done with the array
- * release it with gck_attributes_unref().
+ * Returns: (transfer full): the new attributes array; when done with the array
+ * release it with gck_attributes_unref()
**/
GckAttributes*
gck_attributes_new_full (GckAllocator allocator)
@@ -826,8 +792,8 @@ gck_attributes_new_full (GckAllocator allocator)
* Creates an GckAttributes array with empty attributes. The arguments
* should be values of attribute types, terminated with gck_INVALID.
*
- * Return value: The new attributes array. When done with the array
- * release it with gck_attributes_unref().
+ * Returns: (transfer full): the new attributes array; when done with the array
+ * release it with gck_attributes_unref()
**/
GckAttributes*
gck_attributes_new_empty (gulong attr_type, ...)
@@ -857,7 +823,7 @@ gck_attributes_new_empty (gulong attr_type, ...)
* Use gck_attributes_count() to determine how many attributes are
* in the array.
*
- * Return value: The specified attribute.
+ * Returns: (transfer none): the specified attribute
**/
GckAttribute*
gck_attributes_at (GckAttributes *attrs, guint index)
@@ -887,9 +853,9 @@ attributes_push (GckAttributes *attrs)
*
* The value stored in the attribute will be copied.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add (GckAttributes *attrs, GckAttribute *attr)
{
GckAttribute *added;
@@ -905,18 +871,20 @@ gck_attributes_add (GckAttributes *attrs, GckAttribute *attr)
* gck_attributes_add_data:
* @attrs: The attributes array to add to.
* @attr_type: The type of attribute to add.
- * @value: The raw memory of the attribute value.
+ * @value: (array length=length): the raw memory of the attribute value
* @length: The length of the attribute value.
*
* Add an attribute with the specified type and value to the array.
*
* The value stored in the attribute will be copied.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
-gck_attributes_add_data (GckAttributes *attrs, gulong attr_type,
- gconstpointer value, gsize length)
+GckAttribute *
+gck_attributes_add_data (GckAttributes *attrs,
+ gulong attr_type,
+ const guchar *value,
+ gsize length)
{
GckAttribute *added;
g_return_val_if_fail (attrs, NULL);
@@ -933,9 +901,9 @@ gck_attributes_add_data (GckAttributes *attrs, gulong attr_type,
*
* Add an attribute with the specified type and an 'invalid' value to the array.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_invalid (GckAttributes *attrs, gulong attr_type)
{
GckAttribute *added;
@@ -953,9 +921,9 @@ gck_attributes_add_invalid (GckAttributes *attrs, gulong attr_type)
*
* Add an attribute with the specified type, with empty data.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_empty (GckAttributes *attrs, gulong attr_type)
{
GckAttribute *added;
@@ -976,9 +944,9 @@ gck_attributes_add_empty (GckAttributes *attrs, gulong attr_type)
*
* The value will be stored as a CK_BBOOL PKCS\#11 style attribute.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_boolean (GckAttributes *attrs, gulong attr_type, gboolean value)
{
GckAttribute *added;
@@ -999,9 +967,9 @@ gck_attributes_add_boolean (GckAttributes *attrs, gulong attr_type, gboolean val
*
* The value will be copied into the attribute.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_string (GckAttributes *attrs, gulong attr_type, const gchar *value)
{
GckAttribute *added;
@@ -1022,9 +990,9 @@ gck_attributes_add_string (GckAttributes *attrs, gulong attr_type, const gchar *
*
* The value will be stored as a CK_DATE PKCS\#11 style attribute.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_date (GckAttributes *attrs, gulong attr_type, const GDate *value)
{
GckAttribute *added;
@@ -1045,9 +1013,9 @@ gck_attributes_add_date (GckAttributes *attrs, gulong attr_type, const GDate *va
*
* The value will be stored as a CK_ULONG PKCS\#11 style attribute.
*
- * Return value: The attribute that was added.
+ * Returns: (transfer none): the attribute that was added
**/
-GckAttribute*
+GckAttribute *
gck_attributes_add_ulong (GckAttributes *attrs, gulong attr_type, gulong value)
{
GckAttribute *added;
@@ -1104,9 +1072,10 @@ gck_attributes_count (GckAttributes *attrs)
*
* Find an attribute with the specified type in the array.
*
- * Return value: The first attribute found with the specified type, or NULL.
+ * Returns: (transfer none): the first attribute found with the specified type,
+ * or %NULL
**/
-GckAttribute*
+GckAttribute *
gck_attributes_find (GckAttributes *attrs, gulong attr_type)
{
GckAttribute *attr;
@@ -1246,9 +1215,9 @@ gck_attributes_find_date (GckAttributes *attrs, gulong attr_type, GDate *value)
*
* Reference this attributes array.
*
- * Returns: The attributes.
+ * Returns: (transfer full): the attributes
**/
-GckAttributes*
+GckAttributes *
gck_attributes_ref (GckAttributes *attrs)
{
g_return_val_if_fail (attrs, NULL);
diff --git a/gck/gck-misc.c b/gck/gck-misc.c
index 74b5059..ca8fcd5 100644
--- a/gck/gck-misc.c
+++ b/gck/gck-misc.c
@@ -241,7 +241,7 @@ gck_list_get_boxed_type (void)
/**
* gck_list_unref_free: (skip)
- * @reflist: List of Gobject reference counted pointers.
+ * @reflist: (element-type GLib.Object): list of Gobject reference counted pointers
*
* Free a list of GObject based pointers. All objects in the list
* will be unreffed and then the list itself will be freed.
@@ -259,15 +259,16 @@ gck_list_unref_free (GList *reflist)
/**
* gck_list_ref_copy: (skip)
- * @reflist: List of GObject reference counted objects.
+ * @reflist: (element-type GLib.Object): list of GObject reference counted
+ * objects
*
* Copy a list of GObject based pointers. All objects
* in the list will be reffed and the list will be copied.
*
- * Return value: The copied and reffed list. When done, free it with
- * gck_list_unref_free ()
+ * Return value: (transfer full) (element-type GLib.Object): the copied and
+ * reffed list, when done, free it with gck_list_unref_free ()
**/
-GList*
+GList *
gck_list_ref_copy (GList *reflist)
{
GList *l, *copy = g_list_copy (reflist);
@@ -367,7 +368,7 @@ _gck_ulong_equal (gconstpointer v1, gconstpointer v2)
/**
* gck_value_to_ulong:
- * @value: memory to convert
+ * @value: (array length=length): memory to convert
* @length: length of memory
* @result: A location to store the result
*
@@ -376,7 +377,9 @@ _gck_ulong_equal (gconstpointer v1, gconstpointer v2)
* Returns: Whether the conversion was successful.
*/
gboolean
-gck_value_to_ulong (gconstpointer value, gsize length, gulong *result)
+gck_value_to_ulong (const guchar *value,
+ gsize length,
+ gulong *result)
{
if (!value || length != sizeof (CK_ULONG))
return FALSE;
@@ -387,7 +390,7 @@ gck_value_to_ulong (gconstpointer value, gsize length, gulong *result)
/**
* gck_value_to_boolean:
- * @value: memory to convert
+ * @value: (array length=length): memory to convert
* @length: length of memory
* @result: A location to store the result
*
@@ -396,7 +399,9 @@ gck_value_to_ulong (gconstpointer value, gsize length, gulong *result)
* Returns: Whether the conversion was successful.
*/
gboolean
-gck_value_to_boolean (gconstpointer value, gsize length, gboolean *result)
+gck_value_to_boolean (const guchar *value,
+ gsize length,
+ gboolean *result)
{
if (!value || length != sizeof (CK_BBOOL))
return FALSE;
diff --git a/gck/gck-mock.c b/gck/gck-mock.c
index 58c9b99..5e7ccd2 100644
--- a/gck/gck-mock.c
+++ b/gck/gck-mock.c
@@ -286,7 +286,7 @@ gck_mock_C_Initialize (CK_VOID_PTR pInitArgs)
attrs = gck_attributes_new ();
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_PRIVATE_KEY);
gck_attributes_add_string (attrs, CKA_LABEL, "Private Capitalize Key");
- gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, &value, sizeof (value));
+ gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, (const guchar *)&value, sizeof (value));
gck_attributes_add_boolean (attrs, CKA_DECRYPT, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_PRIVATE, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_WRAP, CK_TRUE);
@@ -301,7 +301,7 @@ gck_mock_C_Initialize (CK_VOID_PTR pInitArgs)
attrs = gck_attributes_new ();
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_PUBLIC_KEY);
gck_attributes_add_string (attrs, CKA_LABEL, "Public Capitalize Key");
- gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, &value, sizeof (value));
+ gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, (const guchar *)&value, sizeof (value));
gck_attributes_add_boolean (attrs, CKA_ENCRYPT, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_PRIVATE, CK_FALSE);
gck_attributes_add_string (attrs, CKA_VALUE, "value");
@@ -313,7 +313,7 @@ gck_mock_C_Initialize (CK_VOID_PTR pInitArgs)
attrs = gck_attributes_new ();
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_PRIVATE_KEY);
gck_attributes_add_string (attrs, CKA_LABEL, "Private prefix key");
- gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, &value, sizeof (value));
+ gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, (const guchar *)&value, sizeof (value));
gck_attributes_add_boolean (attrs, CKA_SIGN, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_PRIVATE, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_ALWAYS_AUTHENTICATE, CK_TRUE);
@@ -326,7 +326,7 @@ gck_mock_C_Initialize (CK_VOID_PTR pInitArgs)
attrs = gck_attributes_new ();
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_PUBLIC_KEY);
gck_attributes_add_string (attrs, CKA_LABEL, "Public prefix key");
- gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, &value, sizeof (value));
+ gck_attributes_add_data (attrs, CKA_ALLOWED_MECHANISMS, (const guchar *)&value, sizeof (value));
gck_attributes_add_boolean (attrs, CKA_VERIFY, CK_TRUE);
gck_attributes_add_boolean (attrs, CKA_PRIVATE, CK_FALSE);
gck_attributes_add_string (attrs, CKA_VALUE, "value");
diff --git a/gck/gck-module.c b/gck/gck-module.c
index d3a76bd..524f331 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -598,8 +598,8 @@ _gck_module_new_initialized (CK_FUNCTION_LIST_PTR funcs)
/**
* gck_module_equal:
- * @module1: A pointer to the first GckModule
- * @module2: A pointer to the second GckModule
+ * @module1: (type Gck.Module): a pointer to the first #GckModule
+ * @module2: (type Gck.Module): a pointer to the second #GckModule
*
* Checks equality of two modules. Two GckModule objects can point to the same
* underlying PKCS\#11 module.
@@ -624,7 +624,7 @@ gck_module_equal (gconstpointer module1, gconstpointer module2)
/**
* gck_module_hash:
- * @module: A pointer to a GckModule
+ * @module: (type Gck.Module): a pointer to a #GckModule
*
* Create a hash value for the GckModule.
*
@@ -687,7 +687,7 @@ _gck_module_info_to_pkcs11 (GckModuleInfo* module_info, CK_INFO_PTR info)
*
* Get the info about a PKCS\#11 module.
*
- * Return value: The module info. Release this with gck_module_info_free().
+ * Returns: (transfer full): the module info; release this with gck_module_info_free()
**/
GckModuleInfo*
gck_module_get_info (GckModule *self)
diff --git a/gck/gck-object.c b/gck/gck-object.c
index 8231635..45bec74 100644
--- a/gck/gck-object.c
+++ b/gck/gck-object.c
@@ -251,8 +251,8 @@ gck_objects_from_handle_array (GckSession *session,
/**
* gck_object_equal:
- * @object1: A pointer to the first GckObject
- * @object2: A pointer to the second GckObject
+ * @object1: (type Gck.Object): a pointer to the first #GckObject
+ * @object2: (type Gck.Object): a pointer to the second #GckObject
*
* Checks equality of two objects. Two GckObject objects can point to the same
* underlying PKCS\#11 object.
@@ -288,7 +288,7 @@ gck_object_equal (gconstpointer object1, gconstpointer object2)
/**
* gck_object_hash:
- * @object: A pointer to a GckObject
+ * @object: (type Gck.Object): a pointer to a #GckObject
*
* Create a hash value for the GckObject.
*
@@ -658,10 +658,11 @@ free_get_attributes (GetAttributes *args)
* Get the specified attributes from the object. This call may
* block for an indefinite period.
*
- * Return value: The resulting PKCS\#11 attributes, or NULL if an error occurred.
- * The result must be unreffed when you're finished with it.
+ * Returns: (transfer full): the resulting PKCS\#11 attributes, or %NULL if an
+ * error occurred; the result must be unreffed when you're finished
+ * with it
**/
-GckAttributes*
+GckAttributes *
gck_object_get (GckObject *self, GCancellable *cancellable, GError **error, ...)
{
GckAttributes *attrs;
@@ -702,10 +703,10 @@ gck_object_get (GckObject *self, GCancellable *cancellable, GError **error, ...)
* No extra references are added to the returned attributes pointer.
* During this call you may not access the attributes in any way.
*
- * Return value: A pointer to the filled in attributes if successful,
- * or NULL if not.
+ * Returns: (transfer full): a pointer to the filled in attributes if successful,
+ * or %NULL if not
**/
-GckAttributes*
+GckAttributes *
gck_object_get_full (GckObject *self, gulong *attr_types, guint n_attr_types,
GCancellable *cancellable, GError **error)
{
@@ -1235,9 +1236,10 @@ free_get_template (get_template_args *args)
*
* This call may block for an indefinite period.
*
- * Return value: The resulting PKCS\#11 attribute template, or NULL if an error occurred.
+ * Returns: (transfer full): the resulting PKCS\#11 attribute template, or %NULL
+ * if an error occurred
**/
-GckAttributes*
+GckAttributes *
gck_object_get_template (GckObject *self, gulong attr_type,
GCancellable *cancellable, GError **error)
{
@@ -1304,9 +1306,10 @@ gck_object_get_template_async (GckObject *self, gulong attr_type,
* Get the result of an operation to get attribute template from
* an object.
*
- * Return value: The resulting PKCS\#11 attribute template, or NULL if an error occurred.
+ * Returns: (transfer full): the resulting PKCS\#11 attribute template, or %NULL
+ * if an error occurred
**/
-GckAttributes*
+GckAttributes *
gck_object_get_template_finish (GckObject *self, GAsyncResult *result,
GError **error)
{
diff --git a/gck/gck-session.c b/gck/gck-session.c
index 4edbbd1..5ecfe09 100644
--- a/gck/gck-session.c
+++ b/gck/gck-session.c
@@ -436,8 +436,8 @@ gck_session_get_slot (GckSession *self)
*
* Get information about the session.
*
- * Return value: The session info. Use the gck_session_info_free() to release
- * when done.
+ * Returns: (transfer full): the session info. Use the gck_session_info_free()
+ * to release when done
**/
GckSessionInfo*
gck_session_get_info (GckSession *self)
@@ -1593,7 +1593,7 @@ perform_unwrap_key (UnwrapKey *args)
* @self: The session to use.
* @wrapper: The key to use for unwrapping.
* @mech_type: The mechanism to use for unwrapping.
- * @input: The wrapped data as a byte stream.
+ * @input: (array length=n_input): the wrapped data as a byte stream
* @n_input: The length of the wrapped data.
* @attrs: Additional attributes for the unwrapped key.
* @cancellable: Optional cancellation object, or NULL.
@@ -1606,9 +1606,14 @@ perform_unwrap_key (UnwrapKey *args)
* operation failed
**/
GckObject *
-gck_session_unwrap_key (GckSession *self, GckObject *wrapper, gulong mech_type,
- gconstpointer input, gsize n_input, GckAttributes *attrs,
- GCancellable *cancellable, GError **error)
+gck_session_unwrap_key (GckSession *self,
+ GckObject *wrapper,
+ gulong mech_type,
+ const guchar *input,
+ gsize n_input,
+ GckAttributes *attrs,
+ GCancellable *cancellable,
+ GError **error)
{
GckMechanism mech = { mech_type, NULL, 0 };
return gck_session_unwrap_key_full (self, wrapper, &mech, input, n_input, attrs, cancellable, error);
@@ -1619,7 +1624,7 @@ gck_session_unwrap_key (GckSession *self, GckObject *wrapper, gulong mech_type,
* @self: The session to use.
* @wrapper: The key to use for unwrapping.
* @mechanism: The mechanism to use for unwrapping.
- * @input: The wrapped data as a byte stream.
+ * @input: (array length=n_input): the wrapped data as a byte stream
* @n_input: The length of the wrapped data.
* @attrs: Additional attributes for the unwrapped key.
* @cancellable: Optional cancellation object, or NULL.
@@ -1632,9 +1637,14 @@ gck_session_unwrap_key (GckSession *self, GckObject *wrapper, gulong mech_type,
* failed
**/
GckObject *
-gck_session_unwrap_key_full (GckSession *self, GckObject *wrapper, GckMechanism *mechanism,
- gconstpointer input, gsize n_input, GckAttributes *attrs,
- GCancellable *cancellable, GError **error)
+gck_session_unwrap_key_full (GckSession *self,
+ GckObject *wrapper,
+ GckMechanism *mechanism,
+ const guchar *input,
+ gsize n_input,
+ GckAttributes *attrs,
+ GCancellable *cancellable,
+ GError **error)
{
UnwrapKey args = { GCK_ARGUMENTS_INIT, GCK_MECHANISM_EMPTY, attrs, 0, input, n_input, 0 };
gboolean ret;
@@ -1665,7 +1675,7 @@ gck_session_unwrap_key_full (GckSession *self, GckObject *wrapper, GckMechanism
* @self: The session to use.
* @wrapper: The key to use for unwrapping.
* @mechanism: The mechanism to use for unwrapping.
- * @input: The wrapped data as a byte stream.
+ * @input: (array length=n_input): the wrapped data as a byte stream
* @n_input: The length of the wrapped data.
* @attrs: Additional attributes for the unwrapped key.
* @cancellable: Optional cancellation object or NULL.
@@ -1676,10 +1686,15 @@ gck_session_unwrap_key_full (GckSession *self, GckObject *wrapper, GckMechanism
* return immediately and complete asynchronously.
**/
void
-gck_session_unwrap_key_async (GckSession *self, GckObject *wrapper, GckMechanism *mechanism,
- gconstpointer input, gsize n_input, GckAttributes *attrs,
- GCancellable *cancellable, GAsyncReadyCallback callback,
- gpointer user_data)
+gck_session_unwrap_key_async (GckSession *self,
+ GckObject *wrapper,
+ GckMechanism *mechanism,
+ const guchar *input,
+ gsize n_input,
+ GckAttributes *attrs,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
UnwrapKey *args = _gck_call_async_prep (self, self, perform_unwrap_key,
NULL, sizeof (*args), free_unwrap_key);
diff --git a/gck/gck-slot.c b/gck/gck-slot.c
index 200d043..f7b393f 100644
--- a/gck/gck-slot.c
+++ b/gck/gck-slot.c
@@ -416,11 +416,11 @@ gck_mechanism_info_free (GckMechanismInfo *mech_info)
/**
* gck_mechanisms_at:
* @a: A GckMechanisms set.
- * @i: The index of a GckMechanismInfo.
+ * @i: The index of a mechanism
*
- * Get a specific GckMechanismInfo in a the set.
+ * Get a specific mechanism in a the set.
*
- * Returns: The GckMechanismInfo.
+ * Returns: the mechanism
*/
/**
@@ -477,8 +477,8 @@ gck_mechanisms_check (GArray *mechanisms, ...)
/**
* gck_slot_equal:
- * @slot1: A pointer to the first GckSlot
- * @slot2: A pointer to the second GckSlot
+ * @slot1: (type Gck.Slot): a pointer to the first #GckSlot
+ * @slot2: (type Gck.Slot): a pointer to the second #GckSlot
*
* Checks equality of two slots. Two GckSlot objects can point to the same
* underlying PKCS\#11 slot.
@@ -504,7 +504,7 @@ gck_slot_equal (gconstpointer slot1, gconstpointer slot2)
/**
* gck_slot_hash:
- * @slot: A pointer to a GckSlot
+ * @slot: (type Gck.Slot): a pointer to a #GckSlot
*
* Create a hash value for the GckSlot.
*
@@ -583,10 +583,10 @@ gck_slot_get_module (GckSlot *self)
*
* Get the information for this slot.
*
- * Return value: The slot information. When done, use gck_slot_info_free()
- * to release it.
+ * Returns: (transfer full): the slot information, when done, use gck_slot_info_free()
+ * to release it.
**/
-GckSlotInfo*
+GckSlotInfo *
gck_slot_get_info (GckSlot *self)
{
CK_SLOT_ID handle = (CK_SLOT_ID)-1;
@@ -733,10 +733,10 @@ _gck_token_info_to_pkcs11 (GckTokenInfo *token_info, CK_TOKEN_INFO_PTR info)
*
* Get the token information for this slot.
*
- * Return value: The token information. When done, use gck_token_info_free()
- * to release it.
+ * Returns: (transfer full): the token information; when done, use gck_token_info_free()
+ * to release it
**/
-GckTokenInfo*
+GckTokenInfo *
gck_slot_get_token_info (GckSlot *self)
{
CK_SLOT_ID handle = (CK_SLOT_ID)-1;
@@ -829,8 +829,8 @@ gck_slot_get_mechanisms (GckSlot *self)
*
* Get information for the specified mechanism.
*
- * Return value: The mechanism information, or NULL if failed. Use
- * gck_mechanism_info_free() when done with it.
+ * Returns: (transfer full): the mechanism information, or NULL if failed; use
+ * gck_mechanism_info_free() when done with it
**/
GckMechanismInfo*
gck_slot_get_mechanism_info (GckSlot *self, gulong mech_type)
@@ -1024,7 +1024,7 @@ free_open_session (OpenSession *args)
*
* This call may block for an indefinite period.
*
- * Return value: (transfer full): a new session or %NULL if an error occurs
+ * Returns: (transfer full): a new session or %NULL if an error occurs
**/
GckSession *
gck_slot_open_session (GckSlot *self, guint options, GCancellable *cancellable,
@@ -1048,7 +1048,7 @@ gck_slot_open_session (GckSlot *self, guint options, GCancellable *cancellable,
*
* This call may block for an indefinite period.
*
- * Return value: (transfer full): a new session or %NULL if an error occurs
+ * Returns: (transfer full): a new session or %NULL if an error occurs
**/
GckSession *
gck_slot_open_session_full (GckSlot *self, guint options, gulong pkcs11_flags, gpointer app_data,
diff --git a/gck/gck-uri.c b/gck/gck-uri.c
index aa4bff5..aa7f41c 100644
--- a/gck/gck-uri.c
+++ b/gck/gck-uri.c
@@ -192,8 +192,8 @@ gck_uri_data_new (void)
* the given context. See #GckUriData for more info.
* Other fields will be set to %NULL.
*
- * Return value: a newly allocated #GckUriData, which should be freed with
- * gck_uri_data_free().
+ * Returns: (transfer full): a newly allocated #GckUriData; which should be
+ * freed with gck_uri_data_free()
*/
GckUriData*
gck_uri_parse (const gchar *string, GckUriFlags flags, GError **error)
diff --git a/gck/gck.h b/gck/gck.h
index c627bb6..f071ed8 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -94,17 +94,17 @@ struct _GckAttribute {
#define GCK_INVALID G_MAXULONG
-gboolean gck_value_to_ulong (gconstpointer value,
+gboolean gck_value_to_ulong (const guchar *value,
gsize length,
gulong *result);
-gboolean gck_value_to_boolean (gconstpointer value,
+gboolean gck_value_to_boolean (const guchar *value,
gsize length,
gboolean *result);
void gck_attribute_init (GckAttribute *attr,
gulong attr_type,
- gconstpointer value,
+ const guchar *value,
gsize length);
void gck_attribute_init_invalid (GckAttribute *attr,
@@ -202,7 +202,7 @@ void gck_attributes_add_all (GckAttributes *attr
GckAttribute* gck_attributes_add_data (GckAttributes *attrs,
gulong attr_type,
- gconstpointer value,
+ const guchar *value,
gsize length);
GckAttribute* gck_attributes_add_invalid (GckAttributes *attrs,
@@ -984,7 +984,7 @@ guchar * gck_session_wrap_key_finish (GckSession *self,
GckObject* gck_session_unwrap_key (GckSession *self,
GckObject *wrapper,
gulong mech_type,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
@@ -993,7 +993,7 @@ GckObject* gck_session_unwrap_key (GckSession *self,
GckObject* gck_session_unwrap_key_full (GckSession *self,
GckObject *wrapper,
GckMechanism *mechanism,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
@@ -1002,7 +1002,7 @@ GckObject* gck_session_unwrap_key_full (GckSession *self,
void gck_session_unwrap_key_async (GckSession *self,
GckObject *wrapper,
GckMechanism *mechanism,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
diff --git a/gck/tests/test-gck-attributes.c b/gck/tests/test-gck-attributes.c
index 62a866b..bf2fc03 100644
--- a/gck/tests/test-gck-attributes.c
+++ b/gck/tests/test-gck-attributes.c
@@ -39,7 +39,7 @@ test_init_memory (void)
g_assert (sizeof (attr) == sizeof (CK_ATTRIBUTE));
- gck_attribute_init (&attr, ATTR_TYPE, ATTR_DATA, N_ATTR_DATA);
+ gck_attribute_init (&attr, ATTR_TYPE, (const guchar *)ATTR_DATA, N_ATTR_DATA);
g_assert (attr.type == ATTR_TYPE);
g_assert (attr.length == N_ATTR_DATA);
g_assert (memcmp (attr.value, ATTR_DATA, attr.length) == 0);
@@ -76,20 +76,20 @@ test_value_to_ulong (void)
CK_ULONG data = 34343;
gulong result = 0;
- if (!gck_value_to_ulong (&data, sizeof (data), &result))
+ if (!gck_value_to_ulong ((const guchar *)&data, sizeof (data), &result))
g_assert_not_reached ();
g_assert (result == 34343);
- if (!gck_value_to_ulong (&data, sizeof (data), NULL))
+ if (!gck_value_to_ulong ((const guchar *)&data, sizeof (data), NULL))
g_assert_not_reached ();
/* Should fail */
- if (gck_value_to_ulong (&data, 0, NULL))
+ if (gck_value_to_ulong ((const guchar *)&data, 0, NULL))
g_assert_not_reached ();
- if (gck_value_to_ulong (&data, 2, NULL))
+ if (gck_value_to_ulong ((const guchar *)&data, 2, NULL))
g_assert_not_reached ();
- if (gck_value_to_ulong (&data, (CK_ULONG)-1, NULL))
+ if (gck_value_to_ulong ((const guchar *)&data, (CK_ULONG)-1, NULL))
g_assert_not_reached ();
}
@@ -463,7 +463,7 @@ test_add_data_attributes (void)
gck_attributes_add_string (attrs, 202UL, "string");
gck_attributes_add_date (attrs, 303UL, date);
g_date_free (date);
- gck_attributes_add_data (attrs, 404UL, ATTR_DATA, N_ATTR_DATA);
+ gck_attributes_add_data (attrs, 404UL, (const guchar *)ATTR_DATA, N_ATTR_DATA);
gck_attributes_add_invalid (attrs, 505UL);
gck_attributes_add_empty (attrs, 606UL);
test_attributes_contents (attrs, TRUE);
@@ -495,7 +495,7 @@ test_add_attributes (void)
gck_attribute_clear (&attr);
g_date_free (date);
- gck_attribute_init (&attr, 404UL, ATTR_DATA, N_ATTR_DATA);
+ gck_attribute_init (&attr, 404UL, (const guchar *)ATTR_DATA, N_ATTR_DATA);
gck_attributes_add (attrs, &attr);
gck_attribute_clear (&attr);
@@ -523,7 +523,7 @@ test_add_all_attributes (void)
gck_attributes_add_string (attrs, 202UL, "string");
gck_attributes_add_date (attrs, 303UL, date);
g_date_free (date);
- gck_attributes_add_data (attrs, 404UL, ATTR_DATA, N_ATTR_DATA);
+ gck_attributes_add_data (attrs, 404UL, (const guchar *)ATTR_DATA, N_ATTR_DATA);
gck_attributes_add_invalid (attrs, 505UL);
gck_attributes_add_empty (attrs, 606UL);
@@ -550,7 +550,7 @@ test_find_attributes (void)
gck_attributes_add_ulong (attrs, 101UL, 888UL);
gck_attributes_add_string (attrs, 202UL, "string");
gck_attributes_add_date (attrs, 303UL, date);
- gck_attributes_add_data (attrs, 404UL, ATTR_DATA, N_ATTR_DATA);
+ gck_attributes_add_data (attrs, 404UL, (const guchar *)ATTR_DATA, N_ATTR_DATA);
attr = gck_attributes_find (attrs, 404);
g_assert (attr != NULL);
diff --git a/gck/tests/test-gck-crypto.c b/gck/tests/test-gck-crypto.c
index d778541..3aac0fc 100644
--- a/gck/tests/test-gck-crypto.c
+++ b/gck/tests/test-gck-crypto.c
@@ -287,7 +287,7 @@ test_login_context_specific (Test *test, gconstpointer unused)
static void
test_sign (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_PREFIX, "my-prefix:", 10 };
+ GckMechanism mech = { CKM_MOCK_PREFIX, (guchar *)"my-prefix:", 10 };
GError *error = NULL;
GAsyncResult *result = NULL;
GckObject *key;
@@ -330,7 +330,7 @@ test_sign (Test *test, gconstpointer unused)
static void
test_verify (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_PREFIX, "my-prefix:", 10 };
+ GckMechanism mech = { CKM_MOCK_PREFIX, (guchar *)"my-prefix:", 10 };
GError *error = NULL;
GAsyncResult *result = NULL;
GckObject *key;
@@ -384,7 +384,7 @@ test_verify (Test *test, gconstpointer unused)
static void
test_generate_key_pair (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_GENERATE, "generate", 9 };
+ GckMechanism mech = { CKM_MOCK_GENERATE, (guchar *)"generate", 9 };
GckAttributes *pub_attrs, *prv_attrs;
GError *error = NULL;
GAsyncResult *result = NULL;
@@ -449,7 +449,7 @@ test_generate_key_pair (Test *test, gconstpointer unused)
static void
test_wrap_key (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_WRAP, "wrap", 4 };
+ GckMechanism mech = { CKM_MOCK_WRAP, (guchar *)"wrap", 4 };
GError *error = NULL;
GAsyncResult *result = NULL;
GckObject *wrapper, *wrapped;
@@ -518,7 +518,7 @@ test_wrap_key (Test *test, gconstpointer unused)
static void
test_unwrap_key (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_WRAP, "wrap", 4 };
+ GckMechanism mech = { CKM_MOCK_WRAP, (guchar *)"wrap", 4 };
GError *error = NULL;
GAsyncResult *result = NULL;
GckObject *wrapper, *unwrapped;
@@ -529,7 +529,7 @@ test_unwrap_key (Test *test, gconstpointer unused)
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_SECRET_KEY);
/* Full One*/
- unwrapped = gck_session_unwrap_key_full (test->session, wrapper, &mech, "special", 7, attrs, NULL, &error);
+ unwrapped = gck_session_unwrap_key_full (test->session, wrapper, &mech, (const guchar *)"special", 7, attrs, NULL, &error);
g_assert_no_error (error);
g_assert (GCK_IS_OBJECT (unwrapped));
check_key_with_value (test->session, unwrapped, CKO_SECRET_KEY, "special");
@@ -537,14 +537,14 @@ test_unwrap_key (Test *test, gconstpointer unused)
/* Failure one */
mech.type = 0;
- unwrapped = gck_session_unwrap_key_full (test->session, wrapper, &mech, "special", 7, attrs, NULL, &error);
+ unwrapped = gck_session_unwrap_key_full (test->session, wrapper, &mech, (const guchar *)"special", 7, attrs, NULL, &error);
g_assert (error != NULL);
g_assert (!unwrapped);
g_clear_error (&error);
/* Asynchronous one */
mech.type = CKM_MOCK_WRAP;
- gck_session_unwrap_key_async (test->session, wrapper, &mech, "special", 7, attrs, NULL, fetch_async_result, &result);
+ gck_session_unwrap_key_async (test->session, wrapper, &mech, (const guchar *)"special", 7, attrs, NULL, fetch_async_result, &result);
egg_test_wait_until (500);
g_assert (result != NULL);
unwrapped = gck_session_unwrap_key_finish (test->session, result, &error);
@@ -557,7 +557,7 @@ test_unwrap_key (Test *test, gconstpointer unused)
/* Asynchronous failure */
result = NULL;
mech.type = 0;
- gck_session_unwrap_key_async (test->session, wrapper, &mech, "special", 6, attrs, NULL, fetch_async_result, &result);
+ gck_session_unwrap_key_async (test->session, wrapper, &mech, (const guchar *)"special", 6, attrs, NULL, fetch_async_result, &result);
egg_test_wait_until (500);
g_assert (result != NULL);
unwrapped = gck_session_unwrap_key_finish (test->session, result, &error);
@@ -573,7 +573,7 @@ test_unwrap_key (Test *test, gconstpointer unused)
static void
test_derive_key (Test *test, gconstpointer unused)
{
- GckMechanism mech = { CKM_MOCK_DERIVE, "derive", 6 };
+ GckMechanism mech = { CKM_MOCK_DERIVE, (guchar *)"derive", 6 };
GError *error = NULL;
GAsyncResult *result = NULL;
GckObject *wrapper, *derived;
diff --git a/gck/tests/test-gck-object.c b/gck/tests/test-gck-object.c
index 46e883b..f102620 100644
--- a/gck/tests/test-gck-object.c
+++ b/gck/tests/test-gck-object.c
@@ -152,7 +152,7 @@ test_create_object (Test *test, gconstpointer unused)
gck_attributes_add_ulong (attrs, CKA_CLASS, CKO_DATA);
gck_attributes_add_string (attrs, CKA_LABEL, "TEST LABEL");
gck_attributes_add_boolean (attrs, CKA_TOKEN, CK_FALSE);
- gck_attributes_add_data (attrs, CKA_VALUE, "BLAH", 4);
+ gck_attributes_add_data (attrs, CKA_VALUE, (const guchar *)"BLAH", 4);
object = gck_session_create_object (test->session, attrs, NULL, &err);
g_assert (GCK_IS_OBJECT (object));
diff --git a/gck/tests/test-gck-uri.c b/gck/tests/test-gck-uri.c
index 6c9556a..b8d640f 100644
--- a/gck/tests/test-gck-uri.c
+++ b/gck/tests/test-gck-uri.c
@@ -326,7 +326,7 @@ test_build_with_attributes (void)
uri_data.attributes = gck_attributes_new ();
gck_attributes_add_string (uri_data.attributes, CKA_LABEL, "The Label");
gck_attributes_add_ulong (uri_data.attributes, CKA_CLASS, CKO_DATA);
- gck_attributes_add_data (uri_data.attributes, CKA_ID, "TEST", 5);
+ gck_attributes_add_data (uri_data.attributes, CKA_ID, (const guchar *)"TEST", 5);
uri = gck_uri_build (&uri_data, GCK_URI_FOR_OBJECT);
g_assert (uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]