diff options
Diffstat (limited to 'libcmix-crypto')
| -rw-r--r-- | libcmix-crypto/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | libcmix-crypto/groupelement.h | 7 | ||||
| -rw-r--r-- | libcmix-crypto/message.h | 78 |
3 files changed, 8 insertions, 79 deletions
diff --git a/libcmix-crypto/CMakeLists.txt b/libcmix-crypto/CMakeLists.txt index 08036f4..7fa0d29 100644 --- a/libcmix-crypto/CMakeLists.txt +++ b/libcmix-crypto/CMakeLists.txt @@ -9,7 +9,7 @@ set(interface_sources ${CMAKE_CURRENT_SOURCE_DIR}/api.h ${CMAKE_CURRENT_SOURCE_DIR}/keypair.h ${CMAKE_CURRENT_SOURCE_DIR}/sharedkey.h - ${CMAKE_CURRENT_SOURCE_DIR}/message.h + ${CMAKE_CURRENT_SOURCE_DIR}/groupelement.h ) target_sources(cmix-crypto-interface diff --git a/libcmix-crypto/groupelement.h b/libcmix-crypto/groupelement.h index 60c6b21..353e525 100644 --- a/libcmix-crypto/groupelement.h +++ b/libcmix-crypto/groupelement.h @@ -4,6 +4,13 @@ extern "C" { #endif +/*! + * \file + */ + +/*! + * \brief GroupElement Token te represent group elements. + */ typedef void* GroupElement; #ifdef __cplusplus diff --git a/libcmix-crypto/message.h b/libcmix-crypto/message.h deleted file mode 100644 index b1c3b87..0000000 --- a/libcmix-crypto/message.h +++ /dev/null @@ -1,78 +0,0 @@ -#pragma once - -/** - * \file - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> -#include <stdlib.h> - -/*! - * Defines how a cMix Buffer allocater should look like. - */ -typedef char*(*CmixBufferAllocator)(size_t); -/*! - * Defines how a cMix Buffer deallocater should look like. - */ -typedef void(*CmixBufferDeallocator)(void*); -/*! - * Defines how the function looks like that returns the length of one message in this buffer implementation. - */ -typedef size_t(*CmixBufferMessageLength)(); - -/*! - * \brief The CmixBufferImpl struct - */ -struct CmixBufferImpl { - CmixBufferAllocator allocate_cmix_buffer; ///< pointer to function to implementation specific allocater. - CmixBufferDeallocator deallocate_cmix_buffer; ///< pointer to function to implementation specific deallocater. - CmixBufferMessageLength message_length; ///< pointer to function to implementation specific function returning message length. -}; - -/*! - * \def DEFINE_CIPHER(NAME, MESSAGE_SIZE) - * Generates some cipher specific boilerplate for manipulating the message buffer. - */ - -#define DEFINE_CIPHER(NAME, MESSAGE_SIZE)\ -typedef char NAME ## Message[MESSAGE_SIZE];\ -\ -char* allocate_ ## NAME ## _cmix_buffer(size_t size){\ - return (char*) calloc(size, sizeof(NAME ## Message));\ -}\ -\ -void deallocate_ ## NAME ## _cmix_buffer(void* buffer) {\ - free(buffer);\ -}\ -\ -size_t NAME ## _message_length() {\ - return sizeof(NAME ## Message);\ -}\ -\ -struct CmixBufferImpl get_cmix_ ## NAME ## _buffer_implementation() {\ - return (struct CmixBufferImpl) {\ - allocate_ ## NAME ## _cmix_buffer,\ - deallocate_ ## NAME ## _cmix_buffer,\ - NAME ## _message_length\ - };\ -} - -/*! - * #DEFINE_CIPHER(Null, 0) - */ -DEFINE_CIPHER(Null, 0) - -/*! - * #DEFINE_CIPHER(Curve25519, 31) - */ -DEFINE_CIPHER(Curve25519, 31) - -#undef DEFINE_CIPHER - -#ifdef __cplusplus -} // extern "C" -#endif |
