* In particular, use guchar * for arrays of bytes.
* 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
* 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);
* 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)
* 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)
*
* 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)
* 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)
* 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)
* 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)
* 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)
* 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)
/**
* 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>.
*
};
/**
- * 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.
*
* 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)
*
* 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)
* 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, ...)
* 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)
*
* 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;
* 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);
*
* 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;
*
* 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;
*
* 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;
*
* 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;
*
* 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;
*
* 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;
*
* 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;
*
* 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);
/**
* 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.
/**
* 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);
/**
* 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
*
* 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;
/**
* 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
*
* 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;
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);
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");
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);
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");
/**
* 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.
/**
* 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.
*
*
* 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)
/**
* 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.
/**
* 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.
*
* 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;
* 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)
{
*
* 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)
{
* 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)
{
*
* 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)
* @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.
* 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);
* @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.
* 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;
* @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.
* 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);
/**
* 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
*/
/**
/**
* 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.
/**
* 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.
*
*
* 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;
*
* 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;
*
* 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)
*
* 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,
*
* 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,
* 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)
#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,
GckAttribute* gck_attributes_add_data (GckAttributes *attrs,
gulong attr_type,
- gconstpointer value,
+ const guchar *value,
gsize length);
GckAttribute* gck_attributes_add_invalid (GckAttributes *attrs,
GckObject* gck_session_unwrap_key (GckSession *self,
GckObject *wrapper,
gulong mech_type,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
GckObject* gck_session_unwrap_key_full (GckSession *self,
GckObject *wrapper,
GckMechanism *mechanism,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
void gck_session_unwrap_key_async (GckSession *self,
GckObject *wrapper,
GckMechanism *mechanism,
- gconstpointer input,
+ const guchar *input,
gsize n_input,
GckAttributes *attrs,
GCancellable *cancellable,
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);
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 ();
}
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);
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);
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);
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);
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;
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;
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;
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;
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;
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");
/* 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);
/* 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);
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;
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));
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);