aboutsummaryrefslogtreecommitdiff
path: root/libcmix-crypto/message.h
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-11-28 15:48:59 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2016-11-28 15:48:59 +0100
commita4a912873058e50060561c21e965b4fec1d9b08b (patch)
tree564432cf3f760483a9acfa64f109f5f42be469c1 /libcmix-crypto/message.h
parentb8d2fe28870d1f54aad1fd9fce04e57caa85ba0b (diff)
downloadcmix-a4a912873058e50060561c21e965b4fec1d9b08b.tar.gz
cmix-a4a912873058e50060561c21e965b4fec1d9b08b.tar.bz2
cmix-a4a912873058e50060561c21e965b4fec1d9b08b.zip
Cleans up and documents the whole cmix protocol.
Diffstat (limited to 'libcmix-crypto/message.h')
-rw-r--r--libcmix-crypto/message.h78
1 files changed, 0 insertions, 78 deletions
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