diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-04 13:11:11 +0100 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-11-04 13:11:11 +0100 |
| commit | 58ead6a9a4a2a81f067ad698366bd32841346058 (patch) | |
| tree | 72398158aa8a077b48a9116dbbff629d340208af /libcmix | |
| parent | 837d8336fb5323ff797cbcbce17a05a3838e051f (diff) | |
| download | cmix-58ead6a9a4a2a81f067ad698366bd32841346058.tar.gz cmix-58ead6a9a4a2a81f067ad698366bd32841346058.tar.bz2 cmix-58ead6a9a4a2a81f067ad698366bd32841346058.zip | |
Consolidated all the crypto apis and implemented the Precomputation Postprocessing step
Diffstat (limited to 'libcmix')
| -rw-r--r-- | libcmix/cmix.c | 16 | ||||
| -rw-r--r-- | libcmix/cmix.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libcmix/cmix.c b/libcmix/cmix.c index 4893c6c..28f56db 100644 --- a/libcmix/cmix.c +++ b/libcmix/cmix.c @@ -216,3 +216,19 @@ enum cmix_error key_exchange(struct CMixContext const* ctx, GroupElement* shared return no_error; } + +enum cmix_error post_process(struct CMixContext* ctx, char const* r_epirs, char const* m_epirs, size_t index) { + GroupElement x = ctx->api.array_to_element(r_epirs, get_group_element_array_size(ctx), true); + + GroupElement D = ctx->api.get_decryption_share(x, ctx->keypair.sec); + + GroupElement msg = ctx->api.array_to_element(m_epirs, get_group_element_array_size(ctx), true); + GroupElement pirs = ctx->api.multiply(D, msg, true); + + ctx->pirs[index] = pirs; + ctx->api.free_group_element(x); + ctx->api.free_group_element(D); + ctx->api.free_group_element(msg); + + return no_error; +} diff --git a/libcmix/cmix.h b/libcmix/cmix.h index 3877382..433c3bc 100644 --- a/libcmix/cmix.h +++ b/libcmix/cmix.h @@ -106,6 +106,8 @@ enum cmix_error multiply_s(struct CMixContext const* ctx, char* r_out_buffer, ch enum cmix_error key_exchange(struct CMixContext const* ctx, GroupElement* shared_key, char* public_key_buffer, char* exhange_value_buffer, char const* pubkey, char const* value); +enum cmix_error post_process(struct CMixContext* ctx, char const* r_epirs, char const* m_epirs, size_t index); + #ifdef __cplusplus } // extern "C" #endif |
