summaryrefslogtreecommitdiff
path: root/ckcapi-util.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2008-12-03 00:20:13 +0000
committerStef Walter <stef@memberwebs.com>2008-12-03 00:20:13 +0000
commitb00eb56b7ffe5019bb33ad399d351b90f4715132 (patch)
tree0dbf8ab4425a6eb4f8cbc028556403515e516d68 /ckcapi-util.c
parent4b5eb21486d188f57f2bf7a91cd5da225dd3e0d1 (diff)
Add basic key object support. No support yet for actual crypto ops. Not tested. Wanted to check it in so it doesn't get lost as it represents a lot of work.
Diffstat (limited to 'ckcapi-util.c')
-rw-r--r--ckcapi-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ckcapi-util.c b/ckcapi-util.c
index 5c0ab9b..3bd18a5 100644
--- a/ckcapi-util.c
+++ b/ckcapi-util.c
@@ -23,6 +23,23 @@
#include <stdlib.h>
#include <string.h>
+
+void
+ckcapi_reverse_memory (void* data, size_t length)
+{
+ size_t end = length - 1;
+ size_t middle = length / 2;
+ unsigned char* buf = data;
+ size_t i;
+
+ for (i = 0; i < middle; i++)
+ {
+ unsigned char tmp = buf[i];
+ buf[i] = buf[end - i];
+ buf[end - i] = tmp;
+ }
+}
+
/*
* Array code originially from Glib.
* Modified extensively by Stef Walter <nielsen@memberwebs.com>