diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-28 13:07:37 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-28 13:07:37 +0100 |
| commit | f8a927984a56e75718bfc273b61693442c9ce649 (patch) | |
| tree | 30c9d3f7b6e0252647cf94a51d018678f22154f0 /libcmix-bignum/bignum.h | |
| parent | 74cea534fd189a2db423ae60997447e66265922b (diff) | |
| download | cmix-f8a927984a56e75718bfc273b61693442c9ce649.tar.gz cmix-f8a927984a56e75718bfc273b61693442c9ce649.tar.bz2 cmix-f8a927984a56e75718bfc273b61693442c9ce649.zip | |
Removed the Bignum abstraction library, as it was not needed.
Diffstat (limited to 'libcmix-bignum/bignum.h')
| -rw-r--r-- | libcmix-bignum/bignum.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/libcmix-bignum/bignum.h b/libcmix-bignum/bignum.h deleted file mode 100644 index fe690cc..0000000 --- a/libcmix-bignum/bignum.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include <stddef.h> -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * \file - */ - -/*! - * \brief The bignum_error enum - */ -enum bignum_error { - NoError = 0, - error = -1 -}; - -/*! - * \brief cMix internal bignum representation. - */ -struct Bignum { - unsigned char* data; ///< Pointer to the start of the bignum. - size_t len; ///< The length of the data array. -}; - -/*! - * \brief allocate_bignum. Reserves space for a len size Bignum. - * \param len The length of the bignum data array. - * \return The Bignum array just allocated. - */ -inline struct Bignum allocate_bignum(size_t len) { - return (struct Bignum){ - (unsigned char*) malloc(len), - len - }; -} - -/*! - * \brief free_bignum. Counterpart to allocate_bignum. - * \param b The bignum to free - */ -inline void free_bignum(struct Bignum* b) { - free(b->data); - b->data = 0; - b->len = 0; -} - -/*! - * \brief get_curve25519_mod. Conveniance for now, but this returns the mod of curve25519 algorith (2^255-19) - * \param result The bignum to store the modulus in, has to be preallocated. - * \return Error status code based on backend errors. - */ -extern enum bignum_error get_curve25519_mod(struct Bignum* result); - -/*! - * \brief multiply_mod Multiplies 2 bignums module mod and stores the result in result. - * \param result Preallocated Bignum where the result will be stored. - * \param lh Lefthand of Multiplication. - * \param rh Righthand of Multiplaction. - * \param mod The modulus. - * \return Error status code based on backend errors. - */ -extern enum bignum_error multiply_mod(struct Bignum* result, struct Bignum const lh, struct Bignum const rh, struct Bignum const mod); - - -#ifdef __cplusplus -} -#endif
\ No newline at end of file |
