aboutsummaryrefslogtreecommitdiff
path: root/test_crypto.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-28 16:29:18 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-28 16:29:18 +0200
commitfb2bf04d382da6ec2f823dacaf4962aca713bac6 (patch)
tree61e798df4b817d7843a1e3dce6c01c3ffd4913c8 /test_crypto.c
parent5dbbef588dc7247570c9c5f9797b38d907313288 (diff)
add outcome computation with test
also: - enhance smc_zkp_2dle: secret can now be auto generated. - enhance sum functions: can now use custom step advancing. - add init1 and free1 for 1-dimensional point arrays. - declare loop variables inside loop header. - narrow some variable scopes.
Diffstat (limited to 'test_crypto.c')
-rw-r--r--test_crypto.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test_crypto.c b/test_crypto.c
index c0e9740..52db0f3 100644
--- a/test_crypto.c
+++ b/test_crypto.c
@@ -257,6 +257,36 @@ test_round1 ()
}
+int
+test_round2 ()
+{
+ uint16_t i, s;
+ unsigned char *bufs[bidders];
+ size_t lens[bidders];
+
+ for (i = 0; i < bidders; i++)
+ {
+ bufs[i] = smc_compute_outcome (&ad[i], &lens[i]);
+ check (bufs[i], "failed to encrypt bid");
+ }
+
+ for (i = 0; i < bidders; i++)
+ {
+ for (s = 0; s < bidders; s++)
+ {
+ if (s == i)
+ continue;
+ check (smc_recv_outcome (&ad[i], bufs[s], lens[s], s),
+ "failed checking outcome");
+ }
+ }
+
+ for (i = 0; i < bidders; i++)
+ free (bufs[i]);
+ return 1;
+}
+
+
void
cleanup_auction_data ()
{
@@ -299,6 +329,7 @@ main (int argc, char *argv[])
run (test_setup_auction_data);
run (test_prologue);
run (test_round1);
+ run (test_round2);
cleanup_auction_data ();
}