summaryrefslogtreecommitdiffstats
path: root/ncr-key-storage.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-21 14:03:58 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-07-21 16:40:01 +0200
commite7828004e40592c8cffc9235f72440c802905e16 (patch)
treec46f4aba9a4f1e8014492cd835fce81d7e07017e /ncr-key-storage.c
parent56eb45f752baa978a9ea3573faee44857678597d (diff)
downloadcryptodev-linux-e7828004e40592c8cffc9235f72440c802905e16.tar.gz
cryptodev-linux-e7828004e40592c8cffc9235f72440c802905e16.tar.xz
cryptodev-linux-e7828004e40592c8cffc9235f72440c802905e16.zip
initial support for userspace data.
Diffstat (limited to 'ncr-key-storage.c')
-rw-r--r--ncr-key-storage.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ncr-key-storage.c b/ncr-key-storage.c
index 69e1c50..ca96ddb 100644
--- a/ncr-key-storage.c
+++ b/ncr-key-storage.c
@@ -39,6 +39,17 @@ struct packed_key {
uint32_t raw_size;
} __attribute__((__packed__));
+/**
+ * key_to_storage_data:
+ * @key: The key to pack
+ * @sdata: Output data
+ * @sdata_size: Output data size
+ *
+ * This function will pack the given key and return allocated data with the packed
+ * key.
+ *
+ * Returns: 0 or errno.
+ **/
int key_to_storage_data( uint8_t** sdata, size_t * sdata_size, const struct key_item_st *key)
{
struct packed_key * pkey;
@@ -82,6 +93,16 @@ fail:
return ret;
}
+/**
+ * key_from_storage_data:
+ * @key: The key to unpack on
+ * @data: input data
+ * @data_size: Input data size
+ *
+ * This function will unpack the given packed key and store it into the key item.
+ *
+ * Returns: 0 or errno.
+ **/
int key_from_storage_data(struct key_item_st* key, const void* data, size_t data_size)
{
const struct packed_key * pkey = data;