From 1a6dc56f1a67cda40da759abc1999022ec523f50 Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Tue, 28 Jun 2016 17:24:59 +0200 Subject: add outcome decryption plus test --- test_crypto.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'test_crypto.c') diff --git a/test_crypto.c b/test_crypto.c index 52db0f3..7f6430e 100644 --- a/test_crypto.c +++ b/test_crypto.c @@ -267,7 +267,7 @@ test_round2 () for (i = 0; i < bidders; i++) { bufs[i] = smc_compute_outcome (&ad[i], &lens[i]); - check (bufs[i], "failed to encrypt bid"); + check (bufs[i], "failed to compute outcome"); } for (i = 0; i < bidders; i++) @@ -287,6 +287,36 @@ test_round2 () } +int +test_round3 () +{ + uint16_t i, s; + unsigned char *bufs[bidders]; + size_t lens[bidders]; + + for (i = 0; i < bidders; i++) + { + bufs[i] = smc_decrypt_outcome (&ad[i], &lens[i]); + check (bufs[i], "failed to decrypt outcome"); + } + + for (i = 0; i < bidders; i++) + { + for (s = 0; s < bidders; s++) + { + if (s == i) + continue; + check (smc_recv_decryption (&ad[i], bufs[s], lens[s], s), + "failed checking decrypted outcome"); + } + } + + for (i = 0; i < bidders; i++) + free (bufs[i]); + return 1; +} + + void cleanup_auction_data () { @@ -330,6 +360,7 @@ main (int argc, char *argv[]) run (test_prologue); run (test_round1); run (test_round2); + run (test_round3); cleanup_auction_data (); } -- cgit v1.2.3