diff --git a/crypto.c b/crypto.c index 537dd66..186a704 100644 --- a/crypto.c +++ b/crypto.c @@ -336,7 +336,7 @@ smc_init3 (uint16_t size1, uint16_t size2, uint16_t size3) brandt_assert (NULL != ret); layer1 = (gcry_mpi_point_t **)&ret[size1]; - layer2 = (gcry_mpi_point_t *)&layer1[size1*size2]; + layer2 = (gcry_mpi_point_t *)&layer1[size1 * size2]; for (i = 0; i < size1; i++) { ret[i] = &layer1[i * size2]; @@ -430,7 +430,7 @@ smc_gen_keyshare (struct AuctionData *ad) { uint16_t i; - ad->y = calloc(ad->n, sizeof(*ad->y)); + ad->y = calloc (ad->n, sizeof (*ad->y)); for (i = 0; i < ad->n; i++) ad->y[0] = gcry_mpi_point_new (0); @@ -439,6 +439,24 @@ smc_gen_keyshare (struct AuctionData *ad) } +void +smc_encrypt_bid (struct AuctionData *ad, + uint16_t j, + gcry_mpi_point_t a1, + gcry_mpi_point_t a2, + gcry_mpi_point_t b1, + gcry_mpi_point_t b2, + gcry_mpi_t c, + gcry_mpi_t d1, + gcry_mpi_t d2, + gcry_mpi_t r1, + gcry_mpi_t r2) +{ + smc_zkp_0og (ad->alpha[ad->i][j], (j == ad->b ? ec_gen : ec_zero), ad->Y, + ad->beta[ad->i][j], a1, a2, b1, b2, c, d1, d2, r1, r2); +} + + /** * smc_zkp_dl * diff --git a/internals.h b/internals.h index f705c6d..06ec88c 100644 --- a/internals.h +++ b/internals.h @@ -28,13 +28,12 @@ struct AuctionData { uint16_t n; /** The amount of bidders/agents */ uint16_t k; /** The amount of possible prices */ uint16_t i; /** Own agents index, only used when bidding */ + uint16_t b; /** Own bid */ gcry_mpi_t x; /** Own private additive key share */ gcry_mpi_point_t *y; /** public multiplicative key shares, size: n */ gcry_mpi_point_t Y; /** Shared public key */ - gcry_mpi_point_t *b; /** Own bid, size: k */ - gcry_mpi_point_t **alpha; /** alphas, size: n*k */ gcry_mpi_point_t **beta; /** betas, size: n*k */