From a4a912873058e50060561c21e965b4fec1d9b08b Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Mon, 28 Nov 2016 15:48:59 +0100 Subject: Cleans up and documents the whole cmix protocol. --- libcmix-crypto/message.h | 78 ------------------------------------------------ 1 file changed, 78 deletions(-) delete mode 100644 libcmix-crypto/message.h (limited to 'libcmix-crypto/message.h') 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 -#include - -/*! - * 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 -- cgit v1.2.3-70-g09d2