diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-01 17:40:17 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-01 17:40:17 +0100 |
| commit | 9531b6bea9fb29074c588a4e4e8838f6d9335a2b (patch) | |
| tree | 4d0e9429203bf5976507b43e6663f9fe0b21e6d0 /libcmix-crypto/curve25519 | |
| parent | bdc26e00ad99f4f670df1a65b5e6439d0dfadc87 (diff) | |
| download | cmix-9531b6bea9fb29074c588a4e4e8838f6d9335a2b.tar.gz cmix-9531b6bea9fb29074c588a4e4e8838f6d9335a2b.tar.bz2 cmix-9531b6bea9fb29074c588a4e4e8838f6d9335a2b.zip | |
Moves cmix calculation stuff outisde of the node class.
Moves the computations and cryptography to the the libcmix library
where we can group and memory manage the underlying crypto-library.
Diffstat (limited to 'libcmix-crypto/curve25519')
| -rw-r--r-- | libcmix-crypto/curve25519/curve25519.c | 1 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/curve25519.h | 2 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519/sodium/libsodium_curve25519.c | 6 |
3 files changed, 4 insertions, 5 deletions
diff --git a/libcmix-crypto/curve25519/curve25519.c b/libcmix-crypto/curve25519/curve25519.c index 6eaaafc..db77d9a 100644 --- a/libcmix-crypto/curve25519/curve25519.c +++ b/libcmix-crypto/curve25519/curve25519.c @@ -15,6 +15,7 @@ struct Api get_curve25519_implementation() NULL, NULL, NULL, + NULL, &curve25519_add_public_share, &curve25519_derive_shared_key, &curve25519_shared_key_deleter, diff --git a/libcmix-crypto/curve25519/curve25519.h b/libcmix-crypto/curve25519/curve25519.h index 9b65d4e..762e8db 100644 --- a/libcmix-crypto/curve25519/curve25519.h +++ b/libcmix-crypto/curve25519/curve25519.h @@ -51,7 +51,7 @@ extern void curve25519_add_public_share(char** buffer, size_t* out_len, char con * \param swap_pub_order Should we swap the order in which we feed the public keys to the hash function. * \return A Shared key */ -extern struct SharedKey curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order); +extern GroupElement curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order); /*! * \brief curve25519_shared_key_deleter * \param s the Shared key to free. diff --git a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c b/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c index 6c3fe13..2405442 100644 --- a/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c +++ b/libcmix-crypto/curve25519/sodium/libsodium_curve25519.c @@ -47,7 +47,7 @@ void curve25519_add_public_share(char** buffer, size_t* out_len, char const* sha } -struct SharedKey curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order) { +GroupElement curve25519_derive_shared_key(struct KeyPair pair, unsigned char const* other_pub, size_t pub_len, unsigned char const* value, size_t value_len, void* priv_value, bool swap_pub_order) { unsigned char* shared = (unsigned char*) sodium_malloc(crypto_generichash_BYTES); crypto_generichash_state h; @@ -71,9 +71,7 @@ struct SharedKey curve25519_derive_shared_key(struct KeyPair pair, unsigned char sodium_free(scalarmult_q); - return (struct SharedKey){ - shared, - }; + return shared; } void curve25519_deinitialize(void) {} |
