aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-20 00:47:20 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-20 00:47:20 +0200
commitcbb47140278e6e6f759107e10a442d98d04392f7 (patch)
treee0704849834dd90522de436a4840827a84024d9e
parent6824ebe0088c8b7ecb9feebf4ae998381be5fb61 (diff)
add key-share generation
-rw-r--r--crypto.c14
-rw-r--r--crypto.h9
2 files changed, 21 insertions, 2 deletions
diff --git a/crypto.c b/crypto.c
index e7397d5..537dd66 100644
--- a/crypto.c
+++ b/crypto.c
@@ -425,6 +425,20 @@ smc_compute_pkey (struct AuctionData *ad)
}
+void
+smc_gen_keyshare (struct AuctionData *ad)
+{
+ uint16_t i;
+
+ ad->y = calloc(ad->n, sizeof(*ad->y));
+ for (i = 0; i < ad->n; i++)
+ ad->y[0] = gcry_mpi_point_new (0);
+
+ ad->x = gcry_mpi_new (0);
+ ec_keypair_create (ad->y[ad->i], ad->x);
+}
+
+
/**
* smc_zkp_dl
*
diff --git a/crypto.h b/crypto.h
index e736236..aa518cd 100644
--- a/crypto.h
+++ b/crypto.h
@@ -25,6 +25,8 @@
#include <gcrypt.h>
#include <stdint.h>
+#include "internals.h"
+
void brandt_crypto_init ();
@@ -64,8 +66,6 @@ void ec_keypair_create_base (gcry_mpi_point_t pkey,
const gcry_mpi_point_t base);
-
-
/* --- Zero knowledge proofs --- */
void smc_zkp_dl (const gcry_mpi_point_t v,
@@ -124,4 +124,9 @@ int smc_zkp_0og_check (const gcry_mpi_point_t alpha,
const gcry_mpi_t r1,
const gcry_mpi_t r2);
+/* --- Protocol implementation --- */
+
+void smc_gen_keyshare (struct AuctionData *ad);
+void smc_compute_pkey (struct AuctionData *ad);
+
#endif /* ifndef _BRANDT_CRYPTO_H */