add bid encryption

This commit is contained in:
Markus Teich 2016-06-20 01:41:41 +02:00
parent 0ebfb634f6
commit 8ffae340b6
2 changed files with 21 additions and 4 deletions

View File

@ -336,7 +336,7 @@ smc_init3 (uint16_t size1, uint16_t size2, uint16_t size3)
brandt_assert (NULL != ret); brandt_assert (NULL != ret);
layer1 = (gcry_mpi_point_t **)&ret[size1]; 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++) for (i = 0; i < size1; i++)
{ {
ret[i] = &layer1[i * size2]; ret[i] = &layer1[i * size2];
@ -430,7 +430,7 @@ smc_gen_keyshare (struct AuctionData *ad)
{ {
uint16_t i; 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++) for (i = 0; i < ad->n; i++)
ad->y[0] = gcry_mpi_point_new (0); 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 * smc_zkp_dl
* *

View File

@ -28,13 +28,12 @@ struct AuctionData {
uint16_t n; /** The amount of bidders/agents */ uint16_t n; /** The amount of bidders/agents */
uint16_t k; /** The amount of possible prices */ uint16_t k; /** The amount of possible prices */
uint16_t i; /** Own agents index, only used when bidding */ 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_t x; /** Own private additive key share */
gcry_mpi_point_t *y; /** public multiplicative key shares, size: n */ gcry_mpi_point_t *y; /** public multiplicative key shares, size: n */
gcry_mpi_point_t Y; /** Shared public key */ 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 **alpha; /** alphas, size: n*k */
gcry_mpi_point_t **beta; /** betas, size: n*k */ gcry_mpi_point_t **beta; /** betas, size: n*k */