diff options
Diffstat (limited to 'libcmix')
| -rw-r--r-- | libcmix/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | libcmix/cmix.c | 10 | ||||
| -rw-r--r-- | libcmix/cmix.h | 7 |
3 files changed, 17 insertions, 1 deletions
diff --git a/libcmix/CMakeLists.txt b/libcmix/CMakeLists.txt index fe65e7a..885a6c8 100644 --- a/libcmix/CMakeLists.txt +++ b/libcmix/CMakeLists.txt @@ -13,4 +13,5 @@ target_compile_options(cmix target_link_libraries(cmix PUBLIC cmix-crypto + PUBLIC cmix-bignum ) diff --git a/libcmix/cmix.c b/libcmix/cmix.c index 944ac9c..db385c6 100644 --- a/libcmix/cmix.c +++ b/libcmix/cmix.c @@ -25,4 +25,14 @@ enum cmix_error set_message(char const* message, struct CMixBuffer b, unsigned i } strncpy(b.buffer + index * b.message_length, message, b.message_length); + + return no_error; +} + +enum cmix_error calculate_shared_secret(struct Bignum* result, struct Bignum partial_shared, struct Bignum my_share, struct Bignum mod) +{ + if(multiply_mod(result, partial_shared, my_share, mod) != NoError) { + return cmix_bignum_error; + } + return no_error; } diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 4a4441b..96d578f 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -2,6 +2,8 @@ extern "C" { #endif +#include "bignum.h" + /*! * \file */ @@ -22,7 +24,8 @@ struct CMixBuffer { */ enum cmix_error { no_error = 0, - index_out_of_range = 1000 + index_out_of_range = 1000, + cmix_bignum_error = 2000, }; /*! @@ -50,6 +53,8 @@ enum cmix_error get_message(char* message, struct CMixBuffer b, unsigned int ind */ enum cmix_error set_message(char const* message, struct CMixBuffer b, unsigned int index); +enum cmix_error calculate_shared_secret(struct Bignum* result, struct Bignum partial_shared, struct Bignum my_share, struct Bignum mod); + #ifdef __cplusplus } // extern "C" #endif |
