diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-10-27 09:25:53 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-10-27 09:25:53 +0200 |
| commit | 25db9ff8a4cfb4b98aeeaae360e8c718b9c5e20c (patch) | |
| tree | 079ea63fcc874506072a91b13d2612b510cf158e /libcmix-crypto/api.h | |
| parent | 9eaf47d5dfa56ca79ae903aabfc2cf52bdfb981e (diff) | |
| download | cmix-25db9ff8a4cfb4b98aeeaae360e8c718b9c5e20c.tar.gz cmix-25db9ff8a4cfb4b98aeeaae360e8c718b9c5e20c.tar.bz2 cmix-25db9ff8a4cfb4b98aeeaae360e8c718b9c5e20c.zip | |
Adds libgcrypt implementation for elgamal in multiplicative group.
Also adapts the API to both handle sodium and gcrypt libraries.
Diffstat (limited to 'libcmix-crypto/api.h')
| -rw-r--r-- | libcmix-crypto/api.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/libcmix-crypto/api.h b/libcmix-crypto/api.h index c6f904f..5267f33 100644 --- a/libcmix-crypto/api.h +++ b/libcmix-crypto/api.h @@ -13,44 +13,65 @@ extern "C" { #include "keypair.h" #include "sharedkey.h" +typedef void(*Initializer)(void); + /*! * \brief Defines how a KeyPair create function should look like. * Used to store a pointer to function to a implementation. */ -typedef struct KeyPair (*KeyPairCreator)(); +typedef struct KeyPair (*KeyPairCreator)(void); /*! * \brief Defines how a KeyPair deleter function should look like. * Used to store a pointer to function to a implementation. */ -typedef void (*KeyPairDeleter)(struct KeyPair); +typedef void (*KeyPairDeleter)(struct KeyPair*); /*! * \brief Defines how a Derived Shared Key function should look like. * Used to store a pointer to function to a implementation. */ -typedef struct SharedKey (*SharedKeyDeriver)(struct KeyPair, unsigned char const*, bool); +typedef struct SharedKey (*SharedKeyDeriver)(struct KeyPair, void const*, bool); /*! * \brief Defines how a Derived Shared Key deleter function should look like. * Used to store a pointer to function to a implementation. */ -typedef void (*SharedKeyDeleter)(struct SharedKey); +typedef void (*SharedKeyDeleter)(struct SharedKey*); + +/*! + * \brief Defines how the crypto library deinitialization should look. + */ +typedef void(*Deinitializer)(void); + +/*! + * \brief PubKeyArrayGetter typedef + */ +typedef void(*KeyArrayGetter)(char**, size_t* size, void*); + +/*! + * \brief PublicShareAdder typedef + */ +typedef void(*PublicShareAdder)(char**, size_t*, char const*, size_t, void*); /*! * \brief The Api struct stores pointers to functions of a specific implementation. Like a Curve25519 specific one. */ struct Api { + Initializer initialize; ///< Function that will initialize the crypto library. KeyPairCreator create_key_pair; ///< Pointer to keypair creation function KeyPairDeleter free_key_pair; ///< Pointer to keypair deletor function + KeyArrayGetter get_key_array; ///< Get the array representation of a public key; + PublicShareAdder add_public_share; ///< Adds the public key stored in void* to the existing share. SharedKeyDeriver derive_shared_key; ///< Pointer to shared key derivation function SharedKeyDeleter free_shared_key; ///< Pointer to shared key deleter function + Deinitializer deinitialize; ///< Function that will deinitialize the crypto library. }; /*! * A Pointer to function typedef to facilitate multiple implementations. */ -typedef struct Api(*ImplementationGetter)(); +typedef struct Api(*ImplementationGetter)(void); /*! * \brief get_implementation The pointer to member function variable to implement when |
