aboutsummaryrefslogtreecommitdiff
path: root/libcmix-crypto
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix-crypto')
-rw-r--r--libcmix-crypto/api.h7
-rw-r--r--libcmix-crypto/elgamal/elgamal.h29
2 files changed, 36 insertions, 0 deletions
diff --git a/libcmix-crypto/api.h b/libcmix-crypto/api.h
index 06afcd2..c6f904f 100644
--- a/libcmix-crypto/api.h
+++ b/libcmix-crypto/api.h
@@ -47,8 +47,15 @@ struct Api {
SharedKeyDeleter free_shared_key; ///< Pointer to shared key deleter function
};
+/*!
+ * A Pointer to function typedef to facilitate multiple implementations.
+ */
typedef struct Api(*ImplementationGetter)();
+/*!
+ * \brief get_implementation The pointer to member function variable to implement when
+ * defining a an implementation
+ */
extern ImplementationGetter get_implementation;
#ifdef __cplusplus
diff --git a/libcmix-crypto/elgamal/elgamal.h b/libcmix-crypto/elgamal/elgamal.h
index feac7f5..826ea49 100644
--- a/libcmix-crypto/elgamal/elgamal.h
+++ b/libcmix-crypto/elgamal/elgamal.h
@@ -1,17 +1,46 @@
#pragma once
+/*!
+ * \file
+ */
+
#ifdef __cplusplus
extern "C" {
#endif
#include "api.h"
+/*!
+ * \brief elgamal_create_keypair
+ * \return The new keypair
+ */
extern struct KeyPair elgamal_create_keypair();
+
+/*!
+ * \brief elgamal_keypair_deleter
+ * \param p the keypair to be freed
+ */
extern void elgamal_keypair_deleter(struct KeyPair p);
+/*!
+ * \brief elgamal_derive_shared_key
+ * \param pair Our keypair.
+ * \param pub_key The public key of the other party.
+ * \param swap_pub_order Should we swap the order in which we feed the public keys to the hash function.
+ * \return A Shared key
+ */
extern struct SharedKey elgamal_derive_shared_key(struct KeyPair pair, unsigned char const* pub_key, bool swap_pub_order);
+
+/*!
+ * \brief elgamal_shared_key_deleter
+ * \param s The shared key to be freed.
+ */
extern void elgamal_shared_key_deleter(struct SharedKey s);
+/*!
+ * \brief get_elgamal_implementation
+ * \return
+ */
struct Api get_elgamal_implementation();
#ifdef __cplusplus