From 2c63da0ed17dd5403a81c9b8462bd8c1f66ca3d5 Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Wed, 22 Jun 2016 02:12:54 +0200 Subject: create proof for public key share --- crypto.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'crypto.c') diff --git a/crypto.c b/crypto.c index 3619f3c..fa37f5e 100644 --- a/crypto.c +++ b/crypto.c @@ -527,27 +527,16 @@ smc_sum (gcry_mpi_point_t out, gcry_mpi_point_t in[], uint16_t len) } -/** - * smc_compute_pkey calculates the shared public key - * - * @param[in,out] ad The struct AuctionData used - */ -void -smc_compute_pkey (struct AuctionData *ad) -{ - ad->Y = gcry_mpi_point_new (0); - smc_sum (ad->Y, ad->y, ad->n); -} - - /** * smc_gen_keyshare creates the private additive keyshare and computes the * public multiplicative key share * * @param[in,out] ad Pointer to the AuctionData struct to operate on + * @param[out] proof Pointer to where the proof of knowledge should be saved. + * Must be allocated memory with apropriate size for one proof struct. */ void -smc_gen_keyshare (struct AuctionData *ad) +smc_gen_keyshare (struct AuctionData *ad, struct proof_dl *proof) { uint16_t i; @@ -556,7 +545,21 @@ smc_gen_keyshare (struct AuctionData *ad) ad->y[0] = gcry_mpi_point_new (0); ad->x = gcry_mpi_new (0); - ec_keypair_create (ad->y[ad->i], ad->x); + ec_skey_create (ad->x); + smc_zkp_dl (ad->y[ad->i], ad->x, proof); +} + + +/** + * smc_compute_pkey calculates the shared public key + * + * @param[in,out] ad The struct AuctionData used + */ +void +smc_compute_pkey (struct AuctionData *ad) +{ + ad->Y = gcry_mpi_point_new (0); + smc_sum (ad->Y, ad->y, ad->n); } -- cgit v1.2.3