From 58ead6a9a4a2a81f067ad698366bd32841346058 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Fri, 4 Nov 2016 13:11:11 +0100 Subject: Consolidated all the crypto apis and implemented the Precomputation Postprocessing step --- libcmix/cmix.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libcmix/cmix.c') 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; +} -- cgit v1.2.3-70-g09d2