aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brandt.c2
-rw-r--r--brandt.h34
-rw-r--r--crypto.c37
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/brandt.doxy2
-rw-r--r--test_crypto.c4
-rw-r--r--uncrustify/file_header2
-rw-r--r--util.c68
8 files changed, 78 insertions, 73 deletions
diff --git a/brandt.c b/brandt.c
index 30cfd92..6a9f7c8 100644
--- a/brandt.c
+++ b/brandt.c
@@ -16,7 +16,7 @@
16 16
17/** 17/**
18 * @file brandt.c 18 * @file brandt.c
19 * @brief TODO 19 * @brief \todo
20 */ 20 */
21#include <gcrypt.h> 21#include <gcrypt.h>
22 22
diff --git a/brandt.h b/brandt.h
index b7ebf5b..0e41021 100644
--- a/brandt.h
+++ b/brandt.h
@@ -26,7 +26,7 @@
26#include <stdint.h> 26#include <stdint.h>
27 27
28/** 28/**
29 * FIXME. 29 * \todo.
30 */ 30 */
31struct BRANDT_Auction; 31struct BRANDT_Auction;
32 32
@@ -34,7 +34,7 @@ struct BRANDT_Auction;
34 * Functions of this type are called by libbrandt to broadcast messages to the 34 * Functions of this type are called by libbrandt to broadcast messages to the
35 * blackboard of a specific auction. 35 * blackboard of a specific auction.
36 * 36 *
37 * TODO: how must the message be handled? (encryption, auth, reliability, …) 37 * \todo: how must the message be handled? (encryption, auth, reliability, …)
38 * 38 *
39 * @param[in] auction_closure Closure pointer representing the respective 39 * @param[in] auction_closure Closure pointer representing the respective
40 * auction. This is the Pointer given to BRANDT_join(). 40 * auction. This is the Pointer given to BRANDT_join().
@@ -53,7 +53,7 @@ typedef int
53 * Functions of this type are called by libbrandt to unicast messages to the 53 * Functions of this type are called by libbrandt to unicast messages to the
54 * seller of a specific auction. 54 * seller of a specific auction.
55 * 55 *
56 * TODO: how must the message be handled? (encryption, auth, reliability, …) 56 * \todo: how must the message be handled? (encryption, auth, reliability, …)
57 * 57 *
58 * @param[in] auction_closure Closure pointer representing the respective 58 * @param[in] auction_closure Closure pointer representing the respective
59 * auction. This is the Pointer given to BRANDT_join(). 59 * auction. This is the Pointer given to BRANDT_join().
@@ -71,8 +71,8 @@ typedef int
71 * Functions of this type are called by libbrandt to report the auction outcome 71 * Functions of this type are called by libbrandt to report the auction outcome
72 * or malicious/erroneous participants. 72 * or malicious/erroneous participants.
73 * 73 *
74 * TODO: update price type. 74 * \todo: update price type.
75 * TODO: export proof of erroneous behaviour. 75 * \todo: export proof of erroneous behaviour.
76 * 76 *
77 * @param[in] auction_closure Closure pointer representing the respective 77 * @param[in] auction_closure Closure pointer representing the respective
78 * auction. This is the Pointer given to BRANDT_join() / BRANDT_new(). 78 * auction. This is the Pointer given to BRANDT_join() / BRANDT_new().
@@ -115,16 +115,16 @@ BRANDT_join (BRANDT_BroadcastCallback broadcast,
115 const void * auction_closure, 115 const void * auction_closure,
116 const void * auction_data, 116 const void * auction_data,
117 size_t auction_data_len); 117 size_t auction_data_len);
118/* FIXME: where do I specify my bid? */ 118/* \todo: where do I specify my bid? */
119 119
120 120
121/* FIXME: Distinguish handles for seller/buyers */ 121/* \todo: Distinguish handles for seller/buyers */
122/* FIXME: have cancellation (BRANDT_join_cancel()) */ 122/* \todo: have cancellation (BRANDT_join_cancel()) */
123/* FIXME: provide means to extract a hash from auction data to */ 123/* \todo: provide means to extract a hash from auction data to */
124/* tie cryptographic operations to application-readable proposal */ 124/* tie cryptographic operations to application-readable proposal */
125/* FIXME: have separate function to export 'out' variables */ 125/* \todo: have separate function to export 'out' variables */
126/* FIXME: might want to specify timeout? How do we deal with time? */ 126/* \todo: might want to specify timeout? How do we deal with time? */
127/* FIXME: separate creating an auction from starting it; initial */ 127/* \todo: separate creating an auction from starting it; initial */
128/* setup needs more auction proposal details (hash, timeout, */ 128/* setup needs more auction proposal details (hash, timeout, */
129/* bid structure), later we need to know # participants */ 129/* bid structure), later we need to know # participants */
130/** 130/**
@@ -140,15 +140,15 @@ BRANDT_join (BRANDT_BroadcastCallback broadcast,
140 * @param[out] auction_data_len The length in bytes of the @a auction_data 140 * @param[out] auction_data_len The length in bytes of the @a auction_data
141 * structure. Will be filled by BRANDT_new(). 141 * structure. Will be filled by BRANDT_new().
142 * @param[in] num_prices The amount of possible valuations for the sold item(s). 142 * @param[in] num_prices The amount of possible valuations for the sold item(s).
143 * If 0, a default of 256 will be used. TODO: what about 1, does it work with 143 * If 0, a default of 256 will be used. \todo: what about 1, does it work with
144 * second price auctions? 144 * second price auctions?
145 * @param[in] m The mode of the auction. If 0, it will be a first price auction 145 * @param[in] m The mode of the auction. If 0, it will be a first price auction
146 * where the winner has to pay the price of his bid. If >0 it will be a second 146 * where the winner has to pay the price of his bid. If >0 it will be a second
147 * price auction selling exactly that amount of items and each winner has to pay 147 * price auction selling exactly that amount of items and each winner has to pay
148 * the price of the highest loosing bid. TODO: what if bidders < m? 148 * the price of the highest loosing bid. \todo: what if bidders < m?
149 * @param[in] outcome_public If 1, the auction winner and price will be public 149 * @param[in] outcome_public If 1, the auction winner and price will be public
150 * to all participants, if 0, this information will only be revealed to the 150 * to all participants, if 0, this information will only be revealed to the
151 * winner and the seller. => FIXME: Turn into AuctionMode bit flag! 151 * winner and the seller. => \todo: Turn into AuctionMode bit flag!
152 * @return A pointer, which should only be remembered and passed to 152 * @return A pointer, which should only be remembered and passed to
153 * libbrandt functions when the client needs to refer to this auction. This is a 153 * libbrandt functions when the client needs to refer to this auction. This is a
154 * black-box pointer, do NOT access/change it or the data it points to! 154 * black-box pointer, do NOT access/change it or the data it points to!
@@ -185,7 +185,7 @@ BRANDT_got_broadcast (struct BRANDT_Auction *auction,
185 * @a msg was received. 185 * @a msg was received.
186 * @param[in] msg The message that was received. 186 * @param[in] msg The message that was received.
187 * @param[in] msg_len The length in bytes of @a msg. 187 * @param[in] msg_len The length in bytes of @a msg.
188 * TODO: how to link message to sender id within auction? 188 * \todo: how to link message to sender id within auction?
189 * ANSWER: on start, know that we have 'n' participants, here give 189 * ANSWER: on start, know that we have 'n' participants, here give
190 * participant number (1..n) 190 * participant number (1..n)
191 */ 191 */
@@ -195,6 +195,6 @@ BRANDT_got_unicast (struct BRANDT_Auction *auction,
195 size_t msg_len); 195 size_t msg_len);
196 196
197 197
198/**TODO: Error handling functions? */ 198/**\todo: Error handling functions? */
199 199
200#endif /* ifndef _BRANDT_BRANDT_H */ 200#endif /* ifndef _BRANDT_BRANDT_H */
diff --git a/crypto.c b/crypto.c
index 0c2597d..044db00 100644
--- a/crypto.c
+++ b/crypto.c
@@ -324,7 +324,7 @@ smc_free2 (gcry_mpi_point_t **dst, uint16_t size1, uint16_t size2)
324 324
325/** 325/**
326 * smc_sums_partial calculates sums up until the current index and stores them 326 * smc_sums_partial calculates sums up until the current index and stores them
327 * in @a out. @$f\forall i \leq len: out_i=sum_{h=1}^iin_h@$f 327 * in @a out. \f$\forall i \leq len: out_i=\sum_{h=1}^iin_h\f$
328 * 328 *
329 * @param[out] out Where to store the resulting sums. Points may be given 329 * @param[out] out Where to store the resulting sums. Points may be given
330 * uninitialized, but the appropriate amount of memory has to be allocated 330 * uninitialized, but the appropriate amount of memory has to be allocated
@@ -347,7 +347,8 @@ smc_sums_partial (gcry_mpi_point_t out[], gcry_mpi_point_t in[], uint16_t len)
347 347
348 348
349/** 349/**
350 * smc_sum calculates the sum of all input points. @$fout=sum_{i=1}^{len}in_i@$f 350 * smc_sum calculates the sum of all input points.
351 * \f$out=\sum_{i=1}^{len}in_i\f$
351 * 352 *
352 * @param[out] out Where to store the result 353 * @param[out] out Where to store the result
353 * @param[in] in Input points. 354 * @param[in] in Input points.
@@ -359,7 +360,7 @@ smc_sum (gcry_mpi_point_t out, gcry_mpi_point_t in[], uint16_t len)
359 uint16_t i; 360 uint16_t i;
360 361
361 brandt_assert (NULL != out); 362 brandt_assert (NULL != out);
362 /**TODO: how to copy a point more efficiently? */ 363 /**\todo: how to copy a point more efficiently? */
363 gcry_mpi_ec_add (out, ec_zero, ec_zero, ec_ctx); 364 gcry_mpi_ec_add (out, ec_zero, ec_zero, ec_ctx);
364 for (i = 0; i < len; i++) 365 for (i = 0; i < len; i++)
365 gcry_mpi_ec_add (out, out, in[i], ec_ctx); 366 gcry_mpi_ec_add (out, out, in[i], ec_ctx);
@@ -382,12 +383,12 @@ smc_compute_pkey (struct AuctionData *ad)
382/** 383/**
383 * smc_zkp_dl 384 * smc_zkp_dl
384 * 385 *
385 * @param v TODO 386 * @param v \todo
386 * @param g TODO 387 * @param g \todo
387 * @param x TODO 388 * @param x \todo
388 * @param a TODO 389 * @param a \todo
389 * @param c TODO 390 * @param c \todo
390 * @param r TODO 391 * @param r \todo
391 */ 392 */
392void 393void
393smc_zkp_dl (const gcry_mpi_point_t v, 394smc_zkp_dl (const gcry_mpi_point_t v,
@@ -402,7 +403,7 @@ smc_zkp_dl (const gcry_mpi_point_t v,
402 ec_keypair_create_base (a, z, g); 403 ec_keypair_create_base (a, z, g);
403 404
404 /* compute challange c */ 405 /* compute challange c */
405 /**TODO: generate c from HASH(g,v,a) and don't output it */ 406 /**\todo: generate c from HASH(g,v,a) and don't output it */
406 ec_skey_create (c); 407 ec_skey_create (c);
407 gcry_mpi_mod (c, c, ec_n); 408 gcry_mpi_mod (c, c, ec_n);
408 409
@@ -416,11 +417,11 @@ smc_zkp_dl (const gcry_mpi_point_t v,
416/** 417/**
417 * smc_zkp_dl_check 418 * smc_zkp_dl_check
418 * 419 *
419 * @param v TODO 420 * @param v \todo
420 * @param g TODO 421 * @param g \todo
421 * @param a TODO 422 * @param a \todo
422 * @param c TODO 423 * @param c \todo
423 * @param r TODO 424 * @param r \todo
424 * @return 0 if the proof is correct, something else otherwise 425 * @return 0 if the proof is correct, something else otherwise
425 */ 426 */
426int 427int
@@ -463,7 +464,7 @@ smc_zkp_2dle (const gcry_mpi_point_t v,
463 gcry_mpi_ec_mul (b, z, g2, ec_ctx); 464 gcry_mpi_ec_mul (b, z, g2, ec_ctx);
464 465
465 /* compute challange c */ 466 /* compute challange c */
466 /**TODO: generate c from HASH(g1,g2,v,w,a,b) and don't output it */ 467 /* \todo: generate c from HASH(g1,g2,v,w,a,b) and don't output it */
467 ec_skey_create (c); 468 ec_skey_create (c);
468 gcry_mpi_mod (c, c, ec_n); 469 gcry_mpi_mod (c, c, ec_n);
469 470
@@ -560,7 +561,7 @@ smc_zkp_0og (gcry_mpi_point_t alpha,
560 gcry_mpi_ec_mul (b2, w, y, ec_ctx); 561 gcry_mpi_ec_mul (b2, w, y, ec_ctx);
561 562
562 /* compute challange c */ 563 /* compute challange c */
563 /**TODO: generate c from HASH(alpha,beta,a1,b1,a2,b2) and don't output it */ 564 /* \todo: generate c from HASH(alpha,beta,a1,b1,a2,b2) and don't output it */
564 ec_skey_create (c); 565 ec_skey_create (c);
565 gcry_mpi_mod (c, c, ec_n); 566 gcry_mpi_mod (c, c, ec_n);
566 567
@@ -596,7 +597,7 @@ smc_zkp_0og (gcry_mpi_point_t alpha,
596 gcry_mpi_ec_mul (b1, w, y, ec_ctx); 597 gcry_mpi_ec_mul (b1, w, y, ec_ctx);
597 598
598 /* compute challange c */ 599 /* compute challange c */
599 /**TODO: generate c from HASH(alpha,beta,a1,b1,a2,b2) and don't output it */ 600 /* \todo: generate c from HASH(alpha,beta,a1,b1,a2,b2) and don't output it */
600 ec_skey_create (c); 601 ec_skey_create (c);
601 gcry_mpi_mod (c, c, ec_n); 602 gcry_mpi_mod (c, c, ec_n);
602 603
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9a68059..5e09f24 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -11,4 +11,4 @@ fast: brandt.doxy
11 sed 's/\(HAVE_DOT.*=\).*/\1 NO/' $< | doxygen - 11 sed 's/\(HAVE_DOT.*=\).*/\1 NO/' $< | doxygen -
12 12
13clean: 13clean:
14 rm -rf html 14 rm -rf html man
diff --git a/doc/brandt.doxy b/doc/brandt.doxy
index 944d13b..76b1538 100644
--- a/doc/brandt.doxy
+++ b/doc/brandt.doxy
@@ -44,7 +44,7 @@ PROJECT_NUMBER =
44# for a project that appears at the top of each page and should give viewer a 44# for a project that appears at the top of each page and should give viewer a
45# quick idea about the purpose of the project. Keep the description short. 45# quick idea about the purpose of the project. Keep the description short.
46 46
47PROJECT_BRIEF = "confidential and deniable group chats" 47PROJECT_BRIEF = "fully private and secure auctions"
48 48
49# With the PROJECT_LOGO tag one can specify a logo or an icon that is included 49# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
50# in the documentation. The maximum height of the logo should not exceed 55 50# in the documentation. The maximum height of the logo should not exceed 55
diff --git a/test_crypto.c b/test_crypto.c
index a42a643..6d4a029 100644
--- a/test_crypto.c
+++ b/test_crypto.c
@@ -60,7 +60,7 @@ test_smc_zkp_dl ()
60 60
61 if (0 == tests_run) 61 if (0 == tests_run)
62 { 62 {
63 /**TODO: there has to be a better way to copy a point */ 63 /* \todo: there has to be a better way to copy a point */
64 gcry_mpi_ec_mul (g, GCRYMPI_CONST_ONE, ec_gen, ec_ctx); 64 gcry_mpi_ec_mul (g, GCRYMPI_CONST_ONE, ec_gen, ec_ctx);
65 } 65 }
66 66
@@ -100,7 +100,7 @@ test_smc_zkp_2dle ()
100 100
101 if (0 == tests_run) 101 if (0 == tests_run)
102 { 102 {
103 /**TODO: there has to be a better way to copy a point */ 103 /* \todo: there has to be a better way to copy a point */
104 gcry_mpi_ec_mul (g1, GCRYMPI_CONST_ONE, ec_gen, ec_ctx); 104 gcry_mpi_ec_mul (g1, GCRYMPI_CONST_ONE, ec_gen, ec_ctx);
105 gcry_mpi_ec_mul (g2, GCRYMPI_CONST_ONE, ec_gen, ec_ctx); 105 gcry_mpi_ec_mul (g2, GCRYMPI_CONST_ONE, ec_gen, ec_ctx);
106 } 106 }
diff --git a/uncrustify/file_header b/uncrustify/file_header
index a490afe..04db3a9 100644
--- a/uncrustify/file_header
+++ b/uncrustify/file_header
@@ -16,5 +16,5 @@
16 16
17/** 17/**
18 * @file $(filename) 18 * @file $(filename)
19 * @brief TODO 19 * @brief \todo
20 */ 20 */
diff --git a/util.c b/util.c
index 2acd726..5eebd3c 100644
--- a/util.c
+++ b/util.c
@@ -16,7 +16,7 @@
16 16
17/** 17/**
18 * @file util.c 18 * @file util.c
19 * @brief TODO 19 * @brief \todo
20 */ 20 */
21#include <stdarg.h> 21#include <stdarg.h>
22#include <stdio.h> 22#include <stdio.h>
@@ -25,63 +25,67 @@
25 25
26#include "util.h" 26#include "util.h"
27 27
28static void xvprintf (const char *, va_list);
29 28
30/** 29/**
31 * eprintf 30 * xvprintf prints a formatstring with prefix "libbrandt: ". If the format
31 * string ends with a ':', the strerror() from errno.h output will be appended.
32 * The output is always terminated with a newline.
32 * 33 *
33 * @param fmt TODO 34 * @param fmt The format string
34 * @param 35 * @param ap The inputs to the format string
35 */ 36 */
36void 37void
37eprintf (const char *fmt, ...) 38xvprintf (const char *fmt, va_list ap)
38{ 39{
39 va_list ap; 40 /**\todo: provide other logging target than stderr */
41 fputs ("libbrandt: ", stderr);
40 42
41 va_start (ap, fmt); 43 vfprintf (stderr, fmt, ap);
42 xvprintf (fmt, ap);
43 va_end (ap);
44 44
45 abort (); 45 if (fmt[0] && fmt[strlen (fmt) - 1] == ':')
46 {
47 fputc (' ', stderr);
48 perror (NULL);
49 }
50 else
51 {
52 fputc ('\n', stderr);
53 }
46} 54}
47 55
56
48/** 57/**
49 * weprintf 58 * eprintf prints an error message and then calls abort() to terminate the
59 * process.
50 * 60 *
51 * @param fmt TODO 61 * @param fmt The format string
52 * @param 62 * @param ... The inputs to the format string
53 */ 63 */
54void 64void
55weprintf (const char *fmt, ...) 65eprintf (const char *fmt, ...)
56{ 66{
57 va_list ap; 67 va_list ap;
58 68
59 va_start (ap, fmt); 69 va_start (ap, fmt);
60 xvprintf (fmt, ap); 70 xvprintf (fmt, ap);
61 va_end (ap); 71 va_end (ap);
72
73 abort ();
62} 74}
63 75
76
64/** 77/**
65 * xvprintf 78 * weprintf prints a warning message
66 * 79 *
67 * @param fmt TODO 80 * @param fmt The format string
68 * @param ap TODO 81 * @param ... The inputs to the format string
69 */ 82 */
70void 83void
71xvprintf (const char *fmt, va_list ap) 84weprintf (const char *fmt, ...)
72{ 85{
73 /**TODO: provide other logging target than stderr */ 86 va_list ap;
74 fputs ("libbrandt: ", stderr);
75
76 vfprintf (stderr, fmt, ap);
77 87
78 if (fmt[0] && fmt[strlen (fmt) - 1] == ':') 88 va_start (ap, fmt);
79 { 89 xvprintf (fmt, ap);
80 fputc (' ', stderr); 90 va_end (ap);
81 perror (NULL);
82 }
83 else
84 {
85 fputc ('\n', stderr);
86 }
87} 91}