From 4895eff27938fa72e5a638ff173920e823ebb115 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sun, 16 Apr 2017 22:49:17 +0200 Subject: Updated documentation and bumped Cmix to Version 1.0 --- libcmix/cmix.h | 73 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) (limited to 'libcmix/cmix.h') diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 54df573..563fc02 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -48,10 +48,10 @@ struct CMixContext { size_t nr_participants; ///< The number of mix participants. GroupElement* r; ///< An array of random values (R in the paper). GroupElement* s; ///< An array of random values (S in the paper). - unsigned int* permutation; ///< a permutation (π in the paper (called Pi in source)). + unsigned int* permutation; ///< a permutation (Pi in the paper (called Pi in source)). GroupElement* decryption_shares; ///< The decryption share for each slot. - GroupElement* EPiRS; ///< stores teh current π(R) * S for this node. Only usfull for the last node. - GroupElement* PiMRS; ///< stores the current π(M * R) * S for this node. Only usefull for the last node. + GroupElement* EPiRS; ///< stores teh current Pi(R) * S for this node. Only usfull for the last node. + GroupElement* PiMRS; ///< stores the current Pi(M * R) * S for this node. Only usefull for the last node. }; /*! @@ -233,7 +233,7 @@ enum cmix_error encrypt_r(struct CMixContext const* ctx, char** random_buffer, c * \param message_buffer The message component output buffer. * \param random_element The random component of a previous encryption. * \param message_element The message componenet of a previous encryption. - * \return + * \return A cmix_error */ enum cmix_error encrypt_r_and_multiply(struct CMixContext const* ctx, char** random_buffer, char** message_buffer, char const** random_element, char const** message_element); @@ -244,14 +244,14 @@ enum cmix_error encrypt_r_and_multiply(struct CMixContext const* ctx, char** ran * \param message_buffer The message component output buffer. * \param random_element The random component of a previous encryption. * \param message_element The message component of a previous encryption. - * \return + * \return A cmix_error */ enum cmix_error permute_and_multiply_encrypted_s(struct CMixContext const* ctx, char** random_buffer, char** message_buffer, char const** random_element, char const** message_element); /*! - * \brief get_commitment_length - * \param ctx - * \return + * \brief get_commitment_length Function to know how large you need to make the commitment buffer. + * \param ctx The relevant context. + * \return the length of the Mix commitment hash. */ size_t get_commitment_length(struct CMixContext const* ctx); @@ -261,15 +261,16 @@ size_t get_commitment_length(struct CMixContext const* ctx); * \param ctx The relevant context. * \param commitment a buffer of size get_commitment_length() to store the commitment. * \param r_epirs The input buffer for the random components. + * \param m_epirs The input buffer for the message components. * \return A cmix_error */ enum cmix_error precomputation_post_process(struct CMixContext* ctx, char* commitment, const char** r_epirs, const char** m_epirs); /*! - * \brief commit_precomputation_ciphertext - * \param ctx - * \param commitment - * \param m_epirs + * \brief commit_precomputation_ciphertext Generate a hash for the encryption of Pi * R * S + * \param ctx The relevant context. + * \param commitment Buffer that can hold get_commitment_length bytes. + * \param m_epirs The values to calculate the commitment on. * \return */ enum cmix_error commit_precomputation_ciphertext(struct CMixContext* ctx, char* commitment, const char** m_epirs); @@ -294,46 +295,46 @@ enum cmix_error swap_k_for_r(struct CMixContext const* ctx, char** out_buffer, c enum cmix_error permute_and_multiply_s(struct CMixContext* ctx, char** out_buffer, char const** message); /*! - * \brief get_epirs - * \param ctx - * \param out_buffer - * \return + * \brief get_epirs Gets the encrypted pi * R * S values from the context. + * \param ctx The relevant context. + * \param out_buffer a 2 dimensional buffer that can hold number of clients group elements. + * \return A cmix_error */ enum cmix_error get_epirs(struct CMixContext const* ctx, char** out_buffer); /*! - * \brief get_pimrs_commitment - * \param ctx - * \param out_buffer - * \param pimrss - * \return + * \brief get_pimrs_commitment calculate a hash over Pi * R * S * m to commit to this mix. + * \param ctx The relevant context + * \param out_buffer A buffer large enough to hold get_commitment_length bytes. + * \param pimrss The values over which to calculate the commitment. + * \return A cmix_error */ enum cmix_error get_pimrs_commitment(struct CMixContext const* ctx, char* out_buffer, const char** pimrss); /*! - * \brief decrypt_epirs - * \param ctx - * \param out_buffer - * \param epirs - * \return + * \brief decrypt_epirs decrypt the Encrypted Pi * R * S with the decryption chare in ctx. + * \param ctx The relevant context. + * \param out_buffer a 2 dimensional buffer large enough to hold nr_clients arrays of GroupElement size bytes. + * \param epirs The values to decrypt. + * \return A cmix_error */ enum cmix_error decrypt_epirs(struct CMixContext const* ctx, char** out_buffer, const char** epirs); /*! - * \brief remove_pirs - * \param ctx - * \param out_buffer - * \param pirs - * \return + * \brief remove_pirs Remove Pirs form the M * Pirs in the context. + * \param ctx The relevant context. + * \param out_buffer The buffer to place m in + * \param pirs The Pirs to remove from the M * Pirs in the context. + * \return A cmix_error */ enum cmix_error remove_pirs(struct CMixContext const* ctx, char** out_buffer, const char** pirs); /*! - * \brief element_to_message - * \param ctx - * \param buffer - * \param el - * \return + * \brief element_to_message Transforms an Element into a message. + * \param ctx The relevant context. + * \param buffer A buffer large enough to hold get_message_size bytes. + * \param el The group element to convert. + * \return A cmix_error */ enum cmix_error element_to_message(struct CMixContext const* ctx, unsigned char** buffer, char const* el); -- cgit v1.2.3-70-g09d2