aboutsummaryrefslogtreecommitdiff
path: root/brandt.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-08-16 20:58:20 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-08-16 20:58:20 +0200
commitfe7b13889217f4268d87d3712cb9ffe265e6a4e2 (patch)
tree59a17a13bdd9f22281bb0a59d8056675814a0cfd /brandt.c
parent01c2b8d710ff5a526d1ae2ed2a7fafdec0b1f973 (diff)
downloadlibbrandt-fe7b13889217f4268d87d3712cb9ffe265e6a4e2.tar.gz
libbrandt-fe7b13889217f4268d87d3712cb9ffe265e6a4e2.zip
some stuff
- finish BRANDT_destroy() - fix include mess related to platform.h and brandt_config.h - add first brandt.c testcase
Diffstat (limited to 'brandt.c')
-rw-r--r--brandt.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/brandt.c b/brandt.c
index 1af19b9..03337c4 100644
--- a/brandt.c
+++ b/brandt.c
@@ -20,7 +20,8 @@
20 * @author Markus Teich 20 * @author Markus Teich
21 */ 21 */
22 22
23#include "brandt_config.h" 23#include "platform.h"
24
24#include "crypto.h" 25#include "crypto.h"
25#include "internals.h" 26#include "internals.h"
26#include "util.h" 27#include "util.h"
@@ -52,7 +53,7 @@ BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx)
52static void 53static void
53start_auction (void *arg) 54start_auction (void *arg)
54{ 55{
55 struct BRANDT_Auction *ad = (struct BRANDT_Auction *)arg; 56// struct BRANDT_Auction *ad = (struct BRANDT_Auction *)arg;
56 57
57 /* \todo: broadcast start message to all participants */ 58 /* \todo: broadcast start message to all participants */
58} 59}
@@ -64,18 +65,18 @@ BRANDT_new (BRANDT_CbBroadcast broadcast,
64 void *auction_closure, 65 void *auction_closure,
65 void **auction_desc, 66 void **auction_desc,
66 size_t *auction_desc_len, 67 size_t *auction_desc_len,
68 const void *description,
69 uint32_t description_len,
67 struct GNUNET_TIME_Absolute time_start, 70 struct GNUNET_TIME_Absolute time_start,
68 struct GNUNET_TIME_Relative time_round, 71 struct GNUNET_TIME_Relative time_round,
69 void *description,
70 uint32_t description_len,
71 uint16_t num_prices, 72 uint16_t num_prices,
72 uint16_t m, 73 uint16_t m,
73 int outcome_public) 74 int outcome_public)
74{ 75{
75 struct BRANDT_Auction *ret = GNUNET_new (struct BRANDT_Auction); 76 struct BRANDT_Auction *ret = GNUNET_new (struct BRANDT_Auction);
76 struct BRANDT_DescrP *desc = GNUNET_new (struct BRANDT_DescrP); 77 struct BRANDT_DescrP *desc = GNUNET_new (struct BRANDT_DescrP);
77 struct GNUNET_TIME_Relative until_start;
78 struct GNUNET_HashContext *hc = GNUNET_CRYPTO_hash_context_start (); 78 struct GNUNET_HashContext *hc = GNUNET_CRYPTO_hash_context_start ();
79 struct GNUNET_TIME_Relative until_start;
79 80
80 desc->time_start = GNUNET_TIME_absolute_hton (time_start); 81 desc->time_start = GNUNET_TIME_absolute_hton (time_start);
81 desc->time_round = GNUNET_TIME_relative_hton (time_round); 82 desc->time_round = GNUNET_TIME_relative_hton (time_round);
@@ -220,7 +221,22 @@ BRANDT_join (BRANDT_CbBroadcast broadcast,
220void 221void
221BRANDT_destroy (struct BRANDT_Auction *auction) 222BRANDT_destroy (struct BRANDT_Auction *auction)
222{ 223{
223 GNUNET_SCHEDULER_cancel (auction->task); 224 if (auction->task)
225 GNUNET_SCHEDULER_cancel (auction->task);
226 gcry_mpi_release (auction->round_progress);
227 gcry_mpi_release (auction->x);
228 smc_free1 (auction->y, auction->n);
229 gcry_mpi_point_release (auction->Y);
230 smc_free2 (auction->alpha, auction->n, auction->k);
231 smc_free2 (auction->beta, auction->n, auction->k);
232 smc_free2 (auction->gamma2, auction->n, auction->k);
233 smc_free3 (auction->gamma3, auction->n, auction->n, auction->k);
234 smc_free2 (auction->delta2, auction->n, auction->k);
235 smc_free3 (auction->delta3, auction->n, auction->n, auction->k);
236 smc_free2 (auction->phi2, auction->n, auction->k);
237 smc_free3 (auction->phi3, auction->n, auction->n, auction->k);
238 smc_free1 (auction->tmpa1, auction->k);
239 smc_free1 (auction->tmpb1, auction->k);
224} 240}
225 241
226 242