From 74cea534fd189a2db423ae60997447e66265922b Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sun, 27 Nov 2016 10:08:19 +0100 Subject: Implements message delivery. Adds a minimum number of messages per mix. Embeds the destination in the message. Clients now send messages to themselves. --- libcmix-crypto/api.h | 8 +++++++- libcmix-crypto/elgamal/elgamal.c | 1 + libcmix-crypto/elgamal/elgamal.h | 2 ++ libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) (limited to 'libcmix-crypto') diff --git a/libcmix-crypto/api.h b/libcmix-crypto/api.h index caf97b6..0fa4916 100644 --- a/libcmix-crypto/api.h +++ b/libcmix-crypto/api.h @@ -65,6 +65,11 @@ typedef GroupElement(*ArrayToElement)(char const*, size_t size, bool); */ typedef void(*PubKeyHashGetter)(char** buffer, size_t* len, GroupElement const pub); +/*! + * + */ +typedef size_t(*PubKeyHashLengthGetter)(); + /*! * \brief PublicShareAdder typedef */ @@ -124,8 +129,9 @@ struct Api { KeyPairDeleter free_keypair; ///< Pointer to keypair deletor function ElementToArray element_to_array; ///< Get the array representation of a public key BufferDeleter free_buffer; ///< frees library allocated buffers. - ArrayToElement array_to_element; ///< The the GroupElement representation of this array; + ArrayToElement array_to_element; ///< The the GroupElement representation of this array. PubKeyHashGetter get_pub_key_hash; ///< Get the hash of the public key. + PubKeyHashLengthGetter get_pub_key_hash_length; ///< Get the length of the pubkey hash. GroupElementGetter get_group_element; ///< get group element GroupElementArraySizeGetter get_group_element_array_size; ///< Return the size required to store a groupelement in an array; GroupElementDeleter free_group_element; ///< frees a base type of the cryptolibrary. diff --git a/libcmix-crypto/elgamal/elgamal.c b/libcmix-crypto/elgamal/elgamal.c index 8f26a3c..399d952 100644 --- a/libcmix-crypto/elgamal/elgamal.c +++ b/libcmix-crypto/elgamal/elgamal.c @@ -11,6 +11,7 @@ struct Api get_elgamal_implementation() .free_buffer = elgamal_free_buffer, .array_to_element = elgamal_array_to_element, .get_pub_key_hash = elgamal_get_pub_key_hash, + .get_pub_key_hash_length = elgamal_get_pub_key_hash_length, .get_group_element = elgamal_get_group_element, .get_group_element_array_size = elgamal_get_group_element_array_size, .free_group_element = elgamal_delete_group_element, diff --git a/libcmix-crypto/elgamal/elgamal.h b/libcmix-crypto/elgamal/elgamal.h index f937899..1fe4447 100644 --- a/libcmix-crypto/elgamal/elgamal.h +++ b/libcmix-crypto/elgamal/elgamal.h @@ -24,6 +24,8 @@ extern ArrayToElement elgamal_array_to_element; extern PubKeyHashGetter elgamal_get_pub_key_hash; +extern PubKeyHashLengthGetter elgamal_get_pub_key_hash_length; + extern GroupElementGetter elgamal_get_group_element; extern GroupElementDeleter elgamal_delete_group_element; diff --git a/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c b/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c index c9db28c..28c61c3 100644 --- a/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c +++ b/libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c @@ -158,6 +158,10 @@ void gcrypt_elgamal_get_pub_key_hash(char** buffer, size_t* len, GroupElement co gcry_sexp_release(pubkey); } +size_t gcrypt_elgamal_get_pub_key_hash_length() { + return 20u; +} + void* gcrypt_elgamal_get_group_element(bool secure) { size_t parse_error_offset; gcry_error_t error; @@ -337,6 +341,7 @@ ElementToArray elgamal_element_to_array = &gcrypt_elgamal_element_to_array; BufferDeleter elgamal_free_buffer = &gcrypt_elgamal_free_buffer; ArrayToElement elgamal_array_to_element = &gcrypt_elgamal_array_to_element; PubKeyHashGetter elgamal_get_pub_key_hash = &gcrypt_elgamal_get_pub_key_hash; +PubKeyHashLengthGetter elgamal_get_pub_key_hash_length = &gcrypt_elgamal_get_pub_key_hash_length; GroupElementGetter elgamal_get_group_element = &gcrypt_elgamal_get_group_element; GroupElementDeleter elgamal_delete_group_element = &gcrypt_elgamal_delete_group_element; KeyExchangeValueGetter elgamal_get_key_exchange_value = &gcrypt_elgamal_get_key_exchange_value; -- cgit v1.2.3-70-g09d2