aboutsummaryrefslogtreecommitdiff
path: root/crypto.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-22 02:12:54 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-22 02:12:54 +0200
commit2c63da0ed17dd5403a81c9b8462bd8c1f66ca3d5 (patch)
treeea6f4d5ac8569c236c04afaedb3417478462c59a /crypto.c
parent965b4da7794b3fd0812907559c9434f98f4819fc (diff)
downloadlibbrandt-2c63da0ed17dd5403a81c9b8462bd8c1f66ca3d5.tar.gz
libbrandt-2c63da0ed17dd5403a81c9b8462bd8c1f66ca3d5.zip
create proof for public key share
Diffstat (limited to 'crypto.c')
-rw-r--r--crypto.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/crypto.c b/crypto.c
index 3619f3c..fa37f5e 100644
--- a/crypto.c
+++ b/crypto.c
@@ -528,26 +528,15 @@ smc_sum (gcry_mpi_point_t out, gcry_mpi_point_t in[], uint16_t len)
528 528
529 529
530/** 530/**
531 * smc_compute_pkey calculates the shared public key
532 *
533 * @param[in,out] ad The struct AuctionData used
534 */
535void
536smc_compute_pkey (struct AuctionData *ad)
537{
538 ad->Y = gcry_mpi_point_new (0);
539 smc_sum (ad->Y, ad->y, ad->n);
540}
541
542
543/**
544 * smc_gen_keyshare creates the private additive keyshare and computes the 531 * smc_gen_keyshare creates the private additive keyshare and computes the
545 * public multiplicative key share 532 * public multiplicative key share
546 * 533 *
547 * @param[in,out] ad Pointer to the AuctionData struct to operate on 534 * @param[in,out] ad Pointer to the AuctionData struct to operate on
535 * @param[out] proof Pointer to where the proof of knowledge should be saved.
536 * Must be allocated memory with apropriate size for one proof struct.
548 */ 537 */
549void 538void
550smc_gen_keyshare (struct AuctionData *ad) 539smc_gen_keyshare (struct AuctionData *ad, struct proof_dl *proof)
551{ 540{
552 uint16_t i; 541 uint16_t i;
553 542
@@ -556,7 +545,21 @@ smc_gen_keyshare (struct AuctionData *ad)
556 ad->y[0] = gcry_mpi_point_new (0); 545 ad->y[0] = gcry_mpi_point_new (0);
557 546
558 ad->x = gcry_mpi_new (0); 547 ad->x = gcry_mpi_new (0);
559 ec_keypair_create (ad->y[ad->i], ad->x); 548 ec_skey_create (ad->x);
549 smc_zkp_dl (ad->y[ad->i], ad->x, proof);
550}
551
552
553/**
554 * smc_compute_pkey calculates the shared public key
555 *
556 * @param[in,out] ad The struct AuctionData used
557 */
558void
559smc_compute_pkey (struct AuctionData *ad)
560{
561 ad->Y = gcry_mpi_point_new (0);
562 smc_sum (ad->Y, ad->y, ad->n);
560} 563}
561 564
562 565