#pragma once #include "api.h" #ifdef __cplusplus extern "C" { #endif /*! * \file */ /*! * \brief curve25519_initialize initilalize curve25519 library */ extern void curve25519_initialize(void); /*! * \brief curve25519_create_keypair * \return A curve25519 keypair. */ extern struct KeyPair curve25519_create_keypair(void); /*! * \brief curve25519_keypair_deleter * \param p The keypair to free. */ extern void curve25519_keypair_deleter(struct KeyPair* p); /*! * \brief curve25519_get_pubkey_array * \param pubkey * \param buffer * \param len */ extern void curve25519_key_to_array(unsigned char** buffer, size_t* len, void* pubkey); /*! * \brief curve25519_add_public_share * \param buffer * \param out_len * \param share * \param pubkey */ extern void curve25519_add_public_share(char** buffer, size_t* out_len, char const* share, size_t in_len, void* pubkey); /*! * \brief curve25519_derive_shared_key * \param pair Our keypair. * \param pub_key The public key of the other party. * \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); /*! * \brief curve25519_shared_key_deleter * \param s the Shared key to free. */ extern void curve25519_shared_key_deleter(struct SharedKey* s); extern void curve25519_deinitialize(void); /*! * \brief get_curve25519_implementation * \return An Api struct filled with a curve25519 implementation. */ struct Api get_curve25519_implementation(); #ifdef __cplusplus } #endif