aboutsummaryrefslogtreecommitdiff
path: root/brandt.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-09-11 20:52:11 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-09-11 20:52:21 +0200
commit658cb968460233a04e77d37558275a894e9d345c (patch)
tree978e0b9e753003dd208039dd28a1323e5b4ec594 /brandt.c
parentde5ea20b5557870119332842ce3a31d608e0e66c (diff)
downloadlibbrandt-658cb968460233a04e77d37558275a894e9d345c.tar.gz
libbrandt-658cb968460233a04e77d37558275a894e9d345c.zip
public firstprice auction working in test_brandt
Diffstat (limited to 'brandt.c')
-rw-r--r--brandt.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/brandt.c b/brandt.c
index b6d3466..2e6a5ed 100644
--- a/brandt.c
+++ b/brandt.c
@@ -317,10 +317,11 @@ advance_round (struct BRANDT_Auction *ad,
317 unsigned char *buf; 317 unsigned char *buf;
318 size_t buflen; 318 size_t buflen;
319 319
320 if (!ad->seller_mode && msg_decrypt == ad->cur_round) 320 if (!ad->seller_mode && msg_decrypt == ad->cur_round && !outcome)
321 { 321 {
322 /* we are a bidder and successfully parsed the msg_decrypt from the 322 /* we are a bidder on a private outcome auction and
323 * seller => we can determine the auction result */ 323 * successfully parsed the msg_decrypt from the seller
324 * => we can determine the auction result */
324 report_outcome (ad, atype, outcome); 325 report_outcome (ad, atype, outcome);
325 return; 326 return;
326 } 327 }
@@ -330,7 +331,13 @@ advance_round (struct BRANDT_Auction *ad,
330 if (!gcry_mpi_test_bit (ad->round_progress, i)) 331 if (!gcry_mpi_test_bit (ad->round_progress, i))
331 return; 332 return;
332 333
333 if (ad->seller_mode && msg_decrypt == ad->cur_round) 334 if (msg_decrypt == ad->cur_round)
335 {
336 report_outcome (ad, atype, outcome);
337 return;
338 }
339
340 if (ad->seller_mode && msg_decrypt == ad->cur_round && !ad->outcome_public)
334 { 341 {
335 /* all bidders msg_decrypt received, broadcast combined msg_decrypt */ 342 /* all bidders msg_decrypt received, broadcast combined msg_decrypt */
336 if (!handler_out[atype][outcome][ad->cur_round] || 343 if (!handler_out[atype][outcome][ad->cur_round] ||
@@ -370,8 +377,9 @@ advance_round (struct BRANDT_Auction *ad,
370 return; 377 return;
371 } 378 }
372 379
373 /* msg_decrypt unicast to seller. All other messages are broadcasted */ 380 /* msg_decrypt unicast to seller if private outcome mode.
374 if (msg_decrypt == ad->cur_round) 381 * All other messages are broadcasted */
382 if (msg_decrypt == ad->cur_round && !outcome)
375 ad->ucast (ad->closure, buf, buflen); 383 ad->ucast (ad->closure, buf, buflen);
376 else 384 else
377 ad->bcast (ad->closure, buf, buflen); 385 ad->bcast (ad->closure, buf, buflen);