diff options
Diffstat (limited to 'brandt.c')
-rw-r--r-- | brandt.c | 62 |
1 files changed, 42 insertions, 20 deletions
@@ -28,7 +28,7 @@ void -BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx) +BRANDT_init () { gcry_error_t err = 0; @@ -56,7 +56,7 @@ BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx) gcry_strerror (err)); gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); - brandt_crypto_init (dlogctx); + brandt_crypto_init (); } @@ -184,17 +184,18 @@ seller_start (void *arg) struct BRANDT_Auction * -BRANDT_new (BRANDT_CbResult result, - BRANDT_CbDeliver broadcast, - BRANDT_CbStart start, - void *auction_closure, - void **auction_desc, - size_t *auction_desc_len, - struct GNUNET_TIME_Absolute time_start, - struct GNUNET_TIME_Relative time_round, - uint16_t num_prices, - uint16_t m, - int outcome_public) +BRANDT_new (BRANDT_CbResult result, + BRANDT_CbDeliver broadcast, + BRANDT_CbStart start, + void *auction_closure, + void **auction_desc, + size_t *auction_desc_len, + struct GNUNET_TIME_Absolute time_start, + struct GNUNET_TIME_Relative time_round, + uint16_t num_prices, + uint16_t m, + int outcome_public, + struct GNUNET_CRYPTO_EccDlogContext *dlogctx) { struct BRANDT_Auction *ret; struct BRANDT_DescrP *desc; @@ -208,6 +209,14 @@ BRANDT_new (BRANDT_CbResult result, return NULL; } + if (1 == outcome_public && NULL == dlogctx) + { + GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, + "libbrandt", + "need dlogctx for public outcome auctions\n"); + return NULL; + } + desc = GNUNET_new (struct BRANDT_DescrP); desc->time_start = GNUNET_TIME_absolute_hton (time_start); desc->time_round = GNUNET_TIME_relative_hton (time_round); @@ -223,6 +232,7 @@ BRANDT_new (BRANDT_CbResult result, ret->outcome_public = outcome_public; ret->cur_round = msg_init; ret->round_progress = gcry_mpi_new (256); + ret->dlogctx = dlogctx; /* we are the seller */ ret->seller_mode = 1; @@ -288,13 +298,14 @@ BRANDT_parse_desc (const void *auction_desc, struct BRANDT_Auction * -BRANDT_join (BRANDT_CbResult result, - BRANDT_CbDeliver broadcast, - BRANDT_CbDeliver unicast, - void *auction_closure, - const void *auction_desc, - size_t auction_desc_len, - uint16_t bid) +BRANDT_join (BRANDT_CbResult result, + BRANDT_CbDeliver broadcast, + BRANDT_CbDeliver unicast, + void *auction_closure, + const void *auction_desc, + size_t auction_desc_len, + uint16_t bid, + struct GNUNET_CRYPTO_EccDlogContext *dlogctx) { struct BRANDT_Auction *ret = GNUNET_new (struct BRANDT_Auction); @@ -312,9 +323,20 @@ BRANDT_join (BRANDT_CbResult result, "failed to parse auction description blob\n"); return NULL; } + + if (1 == ret->outcome_public && NULL == dlogctx) + { + GNUNET_free (ret); + GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, + "libbrandt", + "need dlogctx for public outcome auctions\n"); + return NULL; + } + ret->cur_round = msg_init; ret->round_progress = gcry_mpi_new (256); ret->b = bid; + ret->dlogctx = dlogctx; /* we are the seller */ ret->seller_mode = 0; |