aboutsummaryrefslogtreecommitdiff
path: root/libcmix-crypto/api.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-crypto/api.h')
-rw-r--r--libcmix-crypto/api.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/libcmix-crypto/api.h b/libcmix-crypto/api.h
index a798876..09b474b 100644
--- a/libcmix-crypto/api.h
+++ b/libcmix-crypto/api.h
@@ -1,5 +1,9 @@
#pragma once
+/*!
+ * \file
+ */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -9,16 +13,38 @@ extern "C" {
#include "keypair.h"
#include "sharedkey.h"
+/*!
+ * \brief Defines how a KeyPair create function should look like.
+ * Used to store a pointer to function to a implementation.
+ */
typedef struct KeyPair (*KeyPairCreator)();
+
+/*!
+ * \brief Defines how a KeyPair deleter function should look like.
+ * Used to store a pointer to function to a implementation.
+ */
typedef void (*KeyPairDeleter)(struct KeyPair);
+
+/*!
+ * \brief Defines how a Derived Shared Key function should look like.
+ * Used to store a pointer to function to a implementation.
+ */
typedef struct SharedKey (*SharedKeyDeriver)(struct KeyPair, unsigned char*, bool);
+
+/*!
+ * \brief Defines how a Derived Shared Key deleter function should look like.
+ * Used to store a pointer to function to a implementation.
+ */
typedef void (*SharedKeyDeleter)(struct SharedKey);
+/*!
+ * \brief The Api struct stores pointers to functions of a specific implementation. Like a Curve25519 specific one.
+ */
struct Api {
- KeyPairCreator create_key_pair;
- KeyPairDeleter free_key_pair;
- SharedKeyDeriver derive_shared_key;
- SharedKeyDeleter free_shared_key;
+ KeyPairCreator create_key_pair; ///< Pointer to keypair creation function
+ KeyPairDeleter free_key_pair; ///< Pointer to keypair deletor function
+ SharedKeyDeriver derive_shared_key; ///< Pointer to shared key derivation function
+ SharedKeyDeleter free_shared_key; ///< Pointer to shared key deleter function
};
#ifdef __cplusplus