aboutsummaryrefslogtreecommitdiff
path: root/libcmix-crypto/api.h
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-30 13:38:49 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-30 16:37:03 +0100
commita3e62d3bc6e7f75949726f9a8dafe03e757e869b (patch)
tree49e59076a7ffd7ea757f650a64aaba2b16be1886 /libcmix-crypto/api.h
parent158bf81343054982800d44d507e8e50f2eeb6dd4 (diff)
downloadcmix-a3e62d3bc6e7f75949726f9a8dafe03e757e869b.tar.gz
cmix-a3e62d3bc6e7f75949726f9a8dafe03e757e869b.tar.bz2
cmix-a3e62d3bc6e7f75949726f9a8dafe03e757e869b.zip
Added the Preprocessing step for the Precomputation of CMix.
Diffstat (limited to 'libcmix-crypto/api.h')
-rw-r--r--libcmix-crypto/api.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/libcmix-crypto/api.h b/libcmix-crypto/api.h
index 99f6417..f50cee0 100644
--- a/libcmix-crypto/api.h
+++ b/libcmix-crypto/api.h
@@ -10,6 +10,7 @@ extern "C" {
#include <stdbool.h>
+#include "groupelement.h"
#include "keypair.h"
#include "sharedkey.h"
@@ -31,7 +32,7 @@ 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 const*, size_t, unsigned char const*, size_t, void*, bool);
+typedef struct SharedKey (*SharedKeyDeriver)(struct KeyPair, unsigned char const*, size_t, unsigned char const*, size_t, GroupElement, bool);
/*!
* \brief Defines how a Derived Shared Key deleter function should look like.
@@ -47,27 +48,42 @@ typedef void(*Deinitializer)(void);
/*!
* \brief PubKeyArrayGetter typedef
*/
-typedef void(*KeyArrayGetter)(char**, size_t* size, void*);
+typedef void(*ElementToArray)(unsigned char**, size_t* size, GroupElement);
+
+/*!
+ *
+ */
+typedef GroupElement(*ArrayToElement)(char const*, size_t size, bool);
/*!
* \brief PublicShareAdder typedef
*/
-typedef void(*PublicShareAdder)(char**, size_t*, char const*, size_t, void*);
+typedef void(*PublicShareAdder)(char**, size_t*, char const*, size_t, GroupElement);
/*!
*
*/
-typedef void*(*GroupElementGetter)(bool);
+typedef GroupElement(*GroupElementGetter)(bool);
/*!
*
*/
-typedef void*(*KeyExchangeValueGetter)(void*);
+typedef GroupElement(*KeyExchangeValueGetter)(GroupElement);
+
+/*!
+ *
+ */
+typedef GroupElement(*GroupElementMultiplier)(GroupElement, GroupElement, bool);
/*!
*
*/
-typedef void(*GroupElementDeleter)(void*);
+typedef void(*GroupElementDeleter)(GroupElement);
+
+/*!
+ *
+ */
+typedef void (*Encrypter)(GroupElement*, GroupElement*, GroupElement, GroupElement);
/*!
* \brief The Api struct stores pointers to functions of a specific implementation. Like a Curve25519 specific one.
@@ -76,13 +92,16 @@ struct Api {
Initializer initialize; ///< Function that will initialize the crypto library.
KeyPairCreator create_key_pair; ///< Pointer to keypair creation function
KeyPairDeleter free_key_pair; ///< Pointer to keypair deletor function
- KeyArrayGetter get_key_array; ///< Get the array representation of a public key
+ ElementToArray element_to_array; ///< Get the array representation of a public key
+ ArrayToElement array_to_element; ///< The the GroupElement representation of this array;
GroupElementGetter get_group_element; ///< get group element
- KeyExchangeValueGetter get_key_exchange_value; ///< get generator *op* group element.
GroupElementDeleter free_group_element; ///< frees a base type of the cryptolibrary.
+ KeyExchangeValueGetter get_key_exchange_value; ///< get generator *op* group element.
+ GroupElementMultiplier multiply; ///< Multiplies two groupelements modulo group.
PublicShareAdder add_public_share; ///< Adds the public key stored in void* to the existing share.
SharedKeyDeriver derive_shared_key; ///< Pointer to shared key derivation function
SharedKeyDeleter free_shared_key; ///< Pointer to shared key deleter function
+ Encrypter encrypt; ///< encrypt value with key;
Deinitializer deinitialize; ///< Function that will deinitialize the crypto library.
};