aboutsummaryrefslogtreecommitdiff
path: root/test_crypto.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-28 17:24:59 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-28 17:24:59 +0200
commit1a6dc56f1a67cda40da759abc1999022ec523f50 (patch)
tree23a23adb509b63ac242b4fb852b529d059d4a32c /test_crypto.c
parent81fb449262325d074ccf6c7038f2344515c8c658 (diff)
add outcome decryption plus test
Diffstat (limited to 'test_crypto.c')
-rw-r--r--test_crypto.c33
1 files changed, 32 insertions, 1 deletions
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 ();
}