public firstprice auction working in test_brandt

This commit is contained in:
Markus Teich 2016-09-11 20:52:11 +02:00
parent de5ea20b55
commit 658cb96846
3 changed files with 19 additions and 9 deletions

View File

@ -317,10 +317,11 @@ advance_round (struct BRANDT_Auction *ad,
unsigned char *buf; unsigned char *buf;
size_t buflen; size_t buflen;
if (!ad->seller_mode && msg_decrypt == ad->cur_round) if (!ad->seller_mode && msg_decrypt == ad->cur_round && !outcome)
{ {
/* we are a bidder and successfully parsed the msg_decrypt from the /* we are a bidder on a private outcome auction and
* seller => we can determine the auction result */ * successfully parsed the msg_decrypt from the seller
* => we can determine the auction result */
report_outcome (ad, atype, outcome); report_outcome (ad, atype, outcome);
return; return;
} }
@ -330,7 +331,13 @@ advance_round (struct BRANDT_Auction *ad,
if (!gcry_mpi_test_bit (ad->round_progress, i)) if (!gcry_mpi_test_bit (ad->round_progress, i))
return; return;
if (ad->seller_mode && msg_decrypt == ad->cur_round) if (msg_decrypt == ad->cur_round)
{
report_outcome (ad, atype, outcome);
return;
}
if (ad->seller_mode && msg_decrypt == ad->cur_round && !ad->outcome_public)
{ {
/* all bidders msg_decrypt received, broadcast combined msg_decrypt */ /* all bidders msg_decrypt received, broadcast combined msg_decrypt */
if (!handler_out[atype][outcome][ad->cur_round] || if (!handler_out[atype][outcome][ad->cur_round] ||
@ -370,8 +377,9 @@ advance_round (struct BRANDT_Auction *ad,
return; return;
} }
/* msg_decrypt unicast to seller. All other messages are broadcasted */ /* msg_decrypt unicast to seller if private outcome mode.
if (msg_decrypt == ad->cur_round) * All other messages are broadcasted */
if (msg_decrypt == ad->cur_round && !outcome)
ad->ucast (ad->closure, buf, buflen); ad->ucast (ad->closure, buf, buflen);
else else
ad->bcast (ad->closure, buf, buflen); ad->bcast (ad->closure, buf, buflen);

View File

@ -154,8 +154,10 @@ struct BRANDT_Auction {
gcry_mpi_point_t **phi2; /** phi2, for public outcome, size: n*k */ gcry_mpi_point_t **phi2; /** phi2, for public outcome, size: n*k */
gcry_mpi_point_t ***phi3; /** phi3, for private outcome, size: n*n*k */ gcry_mpi_point_t ***phi3; /** phi3, for private outcome, size: n*n*k */
/** proofs for the correctnes of the phi values for private outcomes, /** proofs for the correctnes of the phi values, size: n*k */
* size: n*n*k */ struct proof_2dle ***phiproofs2;
/** proofs for the correctnes of the phi values, size: n*n*k */
struct proof_2dle ***phiproofs3; struct proof_2dle ***phiproofs3;
gcry_mpi_point_t *tmpa1; /** used for temporary storage, size: k */ gcry_mpi_point_t *tmpa1; /** used for temporary storage, size: k */

View File

@ -169,7 +169,7 @@ run_new_join (void *arg)
GNUNET_TIME_UNIT_MINUTES, GNUNET_TIME_UNIT_MINUTES,
prizes, /* amount of possible prizes */ prizes, /* amount of possible prizes */
0, /* m */ 0, /* m */
0); 1); /* outcome public */
if (!ad[bidders]) if (!ad[bidders])
{ {
weprintf ("BRANDT_new() failed."); weprintf ("BRANDT_new() failed.");