diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-27 10:08:19 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-27 10:08:19 +0100 |
| commit | 74cea534fd189a2db423ae60997447e66265922b (patch) | |
| tree | decc06fa5da1f3f42612d527462d22ee487bf2db /libcmix-crypto | |
| parent | fa7a48172a3c9d9c2f96d6f9c05d80f497bc304d (diff) | |
| download | cmix-74cea534fd189a2db423ae60997447e66265922b.tar.gz cmix-74cea534fd189a2db423ae60997447e66265922b.tar.bz2 cmix-74cea534fd189a2db423ae60997447e66265922b.zip | |
Implements message delivery.
Adds a minimum number of messages per mix.
Embeds the destination in the message.
Clients now send messages to themselves.
Diffstat (limited to 'libcmix-crypto')
| -rw-r--r-- | libcmix-crypto/api.h | 8 | ||||
| -rw-r--r-- | libcmix-crypto/elgamal/elgamal.c | 1 | ||||
| -rw-r--r-- | libcmix-crypto/elgamal/elgamal.h | 2 | ||||
| -rw-r--r-- | libcmix-crypto/elgamal/gcrypt/gcrypt_elgamal.c | 5 |
4 files changed, 15 insertions, 1 deletions
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 @@ -66,6 +66,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 */ typedef void(*PublicShareAdder)(GroupElement*, char const*, size_t, GroupElement); @@ -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; |
