From 127b6d6d55456eb49104d380157a63ef1d1ac546 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Fri, 18 Nov 2016 12:48:53 +0100 Subject: Code cleanup --- libcmix/cmix.c | 30 ------------------------------ libcmix/cmix.h | 25 ------------------------- 2 files changed, 55 deletions(-) (limited to 'libcmix') diff --git a/libcmix/cmix.c b/libcmix/cmix.c index 68a638f..2ba5fd9 100644 --- a/libcmix/cmix.c +++ b/libcmix/cmix.c @@ -5,32 +5,6 @@ #include #include -enum cmix_error permutation(struct CMixBuffer b) { - return no_error; -} - -enum cmix_error get_message(char* message, struct CMixBuffer b, unsigned int index) -{ - if(index >= b.message_length) { - return index_out_of_range; - } - - strncpy(message, b.buffer + index * b.message_length, b.message_length); - - return no_error; -} - -enum cmix_error set_message(char const* message, struct CMixBuffer b, unsigned int index) -{ - if(index >= b.message_length) { - return index_out_of_range; - } - - strncpy(b.buffer + index * b.message_length, message, b.message_length); - - return no_error; -} - enum cmix_error calculate_shared_key_part(struct Bignum* result, struct Bignum partial_shared, struct Bignum my_share, struct Bignum mod) { if(multiply_mod(result, partial_shared, my_share, mod) != NoError) { @@ -285,13 +259,10 @@ enum cmix_error key_exchange_initiator(struct CMixContext const* ctx, GroupEleme enum cmix_error post_process(struct CMixContext* ctx, char* r_out, char* m_out, char const* r_epirs, char const* m_epirs, size_t index) { GroupElement x = ctx->api.array_to_element(r_epirs, get_group_element_array_size(ctx), true); GroupElement D = ctx->api.get_decryption_share(x, ctx->keypair.sec); - //element_to_buffer(ctx, r_out, D); GroupElement msg = ctx->api.array_to_element(m_epirs, get_group_element_array_size(ctx), true); GroupElement pirs = ctx->api.multiply(D, msg, true); element_to_buffer(ctx, m_out, pirs); - //GroupElement new_r = ctx->api.multiply(x, D, true); - //element_to_buffer(ctx, r_out, new_r); memcpy(r_out, r_epirs, get_group_element_array_size(ctx)); @@ -300,7 +271,6 @@ enum cmix_error post_process(struct CMixContext* ctx, char* r_out, char* m_out, ctx->api.free_group_element(x); ctx->api.free_group_element(D); ctx->api.free_group_element(msg); - //ctx->api.free_group_element(new_r); return no_error; } diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 53212fe..f3d071d 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -34,31 +34,6 @@ enum cmix_error { out_of_memory = 4000, }; -/*! - * \brief permutate mixes the messages before sending the messages. - * \param[in,out] b A buffer of \p nr_messages messages, each message of length *message_len* - * \return no_error - */ -enum cmix_error permute(struct CMixBuffer b); - -/*! - * \brief get_message takes the \p index message of the buffer \p b copies it into \p message - * \param[out] message is the output buffer that has to hold at least \p b.message_length bytes. - * \param[in] b is the buffer from which to copy the message. - * \param[in] index is the index of the message to copy. - * \return index_out_of_range if \p index is greater than or equal to \p b.nr_messages , otherwise no_error. - */ -enum cmix_error get_message(char* message, struct CMixBuffer b, unsigned int index); - -/*! - * \brief set_message set the \p index message of the buffer to a copy of \p message. - * \param[in] message The message to set the part of the buffer to. - * \param[in,out] b The buffer - * \param[in] index The index into the buffer - * \return index_out_of_range if \p index is greater than or equal to \p b.nr_messages , otherwise no_error. - */ -enum cmix_error set_message(char const* message, struct CMixBuffer b, unsigned int index); - /*! * \brief calculate_shared_key_part Calculates (partly) the shared key which is needed by all the nodes. * \param result Storage for the result -- cgit v1.2.3-70-g09d2