aboutsummaryrefslogtreecommitdiff
path: root/hal.h
diff options
context:
space:
mode:
Diffstat (limited to 'hal.h')
-rw-r--r--hal.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/hal.h b/hal.h
index df330ae..ee27649 100644
--- a/hal.h
+++ b/hal.h
@@ -39,6 +39,7 @@
#include <stdint.h>
#include <sys/types.h>
#include <stdlib.h>
+#include <string.h>
/*
* A handy macro from cryptlib.
@@ -567,6 +568,26 @@ extern hal_error_t hal_ecdsa_verify(const hal_core_t *core,
const uint8_t * const signature, const size_t signature_len);
/*
+ * UUID stuff. All UUIDs we use (or are likely to use) are type 4 "random" UUIDs
+ */
+
+typedef struct { uint8_t uuid[16]; } hal_uuid_t;
+
+#define HAL_UUID_TEXT_SIZE (sizeof("00112233-4455-6677-8899-aabbccddeeff"))
+
+static inline int hal_uuid_cmp(const hal_uuid_t * const a, const hal_uuid_t * const b)
+{
+ return memcmp(a, b, sizeof(hal_uuid_t));
+}
+
+extern hal_error_t hal_uuid_gen(hal_uuid_t *uuid);
+
+extern hal_error_t hal_uuid_parse(hal_uuid_t *uuid, const char * const string);
+
+extern hal_error_t hal_uuid_format(const hal_uuid_t * const uuid,
+ char *buffer, const size_t buffer_len);
+
+/*
* Higher level RPC-based mechanism for working with HSM at arm's
* length, using handles instead of direct access to the cores.
*
@@ -689,8 +710,6 @@ extern hal_error_t hal_rpc_hash_finalize(const hal_hash_handle_t hash,
* a session handle and which ones don't...).
*/
-typedef struct { uint8_t uuid[16]; } hal_uuid_t;
-
typedef struct { uint32_t handle; } hal_pkey_handle_t;
typedef uint32_t hal_key_flags_t;
@@ -762,7 +781,7 @@ extern hal_error_t hal_rpc_pkey_verify(const hal_pkey_handle_t pkey,
typedef struct {
uint32_t type;
size_t length;
- const uint8_t *value;
+ const void *value;
} hal_rpc_pkey_attribute_t;
extern hal_error_t hal_rpc_pkey_match(const hal_client_handle_t client,