diff options
Diffstat (limited to 'libcmix/cmix.h')
| -rw-r--r-- | libcmix/cmix.h | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 06fd939..5c6a4c1 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -49,7 +49,9 @@ struct CMixContext { 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)). - GroupElement* pirs; ///< an array containing π(R) * S + 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. }; /*! @@ -240,16 +242,30 @@ enum cmix_error encrypt_r_and_multiply(struct CMixContext const* ctx, char** ran 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 post_process decrypts Pi(R) * S and stores it in the context. + * \brief get_commitment_length + * \param ctx + * \return + */ +size_t get_commitment_length(struct CMixContext const* ctx); + +/*! + * \brief precomputation_post_process Calculates it's decryption shares and it's commitment to them. * \note The stored pirs only has meaning for the last node, but just storing it for the last node just adds unneeded complexity. * \param ctx The relevant context. - * \param r_out The output buffer for the random components. - * \param m_out The output buffer for the message components. + * \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 post_process(struct CMixContext* ctx, char** r_out, char** m_out, char const** r_epirs, char const** m_epirs); +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 + * \return + */ +enum cmix_error commit_precomputation_ciphertext(struct CMixContext* ctx, char* commitment, const char** m_epirs); /*! * \brief swap_k_for_r multiplies with K^-1 and multiplies with R @@ -268,17 +284,42 @@ enum cmix_error swap_k_for_r(struct CMixContext const* ctx, char** out_buffer, c * \param message The input buffer. * \return A cmix_error */ -enum cmix_error permute_and_multiply_s(struct CMixContext const* ctx, char** out_buffer, char const** message); +enum cmix_error permute_and_multiply_s(struct CMixContext* ctx, char** out_buffer, char const** message); /*! - * \brief remove_r_and_s multiply with (Pi(R) * S)^-1 - * \param ctx The relevant context. - * \param out_buffer The ouput buffer, - * \param message The input buffer - * \param index message process message x (take the x'th Pi(R) * S) - * \return A cmix_error + * \brief get_epirs + * \param ctx + * \param out_buffer + * \return + */ +enum cmix_error get_epirs(struct CMixContext const* ctx, char** out_buffer); + +/*! + * \brief get_pimrs_commitment + * \param ctx + * \param out_buffer + * \param pimrss + * \return + */ +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 + */ +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 */ -enum cmix_error remove_r_and_s(struct CMixContext const* ctx, char* out_buffer, char const* message, size_t index); +enum cmix_error remove_pirs(struct CMixContext const* ctx, char** out_buffer, const char** pirs); /*! * \brief split_message Splits a message in its destination and payload components. |
