diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-28 22:05:30 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-28 22:05:30 +0200 |
commit | 7975df02197ad12b323a0b000434ff794cdc94c2 (patch) | |
tree | 20772708dce88cb761992b6a216cdb5d4cb30148 /test_crypto.c | |
parent | e25578ad259462ba0d8a5d8174507561ef4e900a (diff) |
add outcome determination plus test
- also fix bug in smc_sum()
Diffstat (limited to 'test_crypto.c')
-rw-r--r-- | test_crypto.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/test_crypto.c b/test_crypto.c index 7f6430e..c1774e4 100644 --- a/test_crypto.c +++ b/test_crypto.c @@ -317,19 +317,38 @@ test_round3 () } +int +test_outcome () +{ + int32_t ret = -1; + + for (uint16_t i = 0; i < ad->n; i++) + { + if (-1 != smc_determine_outcome (&ad[i])) + { + check (-1 == ret, "multiple winners detected"); + ret = i; + } + } + check (-1 != ret, "no winner detected"); + fputs ("winner detected", stderr); + return 1; +} + + void cleanup_auction_data () { for (uint16_t i = 0; i < bidders; i++) { - for (uint16_t h = 0; h < bidders; h++) - gcry_mpi_point_release (ad[i].y[h]); - gcry_mpi_point_release (ad[i].Y); gcry_mpi_release (ad[i].x); - free (ad[i].y); + smc_free1 (ad[i].y, ad[i].n); smc_free2 (ad[i].alpha, ad[i].n, ad[i].k); smc_free2 (ad[i].beta, ad[i].n, ad[i].k); + smc_free3 (ad[i].gamma, ad[i].n, ad[i].n, ad[i].k); + smc_free3 (ad[i].delta, ad[i].n, ad[i].n, ad[i].k); + smc_free3 (ad[i].phi, ad[i].n, ad[i].n, ad[i].k); } free (ad); } @@ -361,6 +380,7 @@ main (int argc, char *argv[]) run (test_round1); run (test_round2); run (test_round3); + run (test_outcome); cleanup_auction_data (); } |