aboutsummaryrefslogtreecommitdiff
path: root/test_crypto.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-21 16:12:57 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-21 16:12:57 +0200
commit77f396003c6792c3cad8b41b19dd9e8d9435198c (patch)
treee7d5085c86564e3b3b1a80e5a25f9c80ff3a835c /test_crypto.c
parent24191a69683ca8fb7d01c26ec889f13a3f7d8ba8 (diff)
use hash to generate challange in ZKPs
Diffstat (limited to 'test_crypto.c')
-rw-r--r--test_crypto.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/test_crypto.c b/test_crypto.c
index 5f72c71..93f1cb4 100644
--- a/test_crypto.c
+++ b/test_crypto.c
@@ -98,14 +98,13 @@ test_serialization ()
int
test_smc_zkp_dl ()
{
- gcry_mpi_t c = gcry_mpi_new (0);
gcry_mpi_t r = gcry_mpi_new (0);
gcry_mpi_t x = gcry_mpi_new (0);
gcry_mpi_point_t a = gcry_mpi_point_new (0);
gcry_mpi_point_t g = gcry_mpi_point_new (0);
gcry_mpi_point_t v = gcry_mpi_point_new (0);
- ec_keypair_create (g, c);
+ ec_keypair_create (g, r);
if (0 == tests_run)
{
@@ -115,14 +114,13 @@ test_smc_zkp_dl ()
ec_keypair_create_base (v, x, g);
- smc_zkp_dl (v, g, x, a, c, r);
- check (!smc_zkp_dl_check (v, g, a, c, r), "zkp dl wrong");
+ smc_zkp_dl (v, g, x, a, r);
+ check (!smc_zkp_dl_check (v, g, a, r), "zkp dl wrong");
check (gcry_mpi_ec_curve_point (a, ec_ctx), "not on curve");
check (gcry_mpi_ec_curve_point (g, ec_ctx), "not on curve");
check (gcry_mpi_ec_curve_point (v, ec_ctx), "not on curve");
- gcry_mpi_release (c);
gcry_mpi_release (r);
gcry_mpi_release (x);
gcry_mpi_point_release (a);
@@ -134,7 +132,6 @@ test_smc_zkp_dl ()
int
test_smc_zkp_2dle ()
{
- gcry_mpi_t c = gcry_mpi_new (0);
gcry_mpi_t r = gcry_mpi_new (0);
gcry_mpi_t x = gcry_mpi_new (0);
gcry_mpi_point_t a = gcry_mpi_point_new (0);
@@ -144,8 +141,8 @@ test_smc_zkp_2dle ()
gcry_mpi_point_t v = gcry_mpi_point_new (0);
gcry_mpi_point_t w = gcry_mpi_point_new (0);
- ec_keypair_create (g1, c);
- ec_keypair_create (g2, c);
+ ec_keypair_create (g1, r);
+ ec_keypair_create (g2, r);
if (0 == tests_run)
{
@@ -157,8 +154,8 @@ test_smc_zkp_2dle ()
ec_keypair_create_base (v, x, g1);
gcry_mpi_ec_mul (w, x, g2, ec_ctx);
- smc_zkp_2dle (v, w, g1, g2, x, a, b, c, r);
- check (!smc_zkp_2dle_check (v, w, g1, g2, a, b, c, r), "zkp 2dle wrong");
+ smc_zkp_2dle (v, w, g1, g2, x, a, b, r);
+ check (!smc_zkp_2dle_check (v, w, g1, g2, a, b, r), "zkp 2dle wrong");
check (gcry_mpi_ec_curve_point (a, ec_ctx), "not on curve");
check (gcry_mpi_ec_curve_point (b, ec_ctx), "not on curve");
@@ -167,7 +164,6 @@ test_smc_zkp_2dle ()
check (gcry_mpi_ec_curve_point (v, ec_ctx), "not on curve");
check (gcry_mpi_ec_curve_point (w, ec_ctx), "not on curve");
- gcry_mpi_release (c);
gcry_mpi_release (r);
gcry_mpi_release (x);
gcry_mpi_point_release (a);
@@ -182,7 +178,6 @@ test_smc_zkp_2dle ()
int
test_smc_zkp_0og ()
{
- gcry_mpi_t c = gcry_mpi_new (0);
gcry_mpi_t d1 = gcry_mpi_new (0);
gcry_mpi_t d2 = gcry_mpi_new (0);
gcry_mpi_t r1 = gcry_mpi_new (0);
@@ -195,11 +190,11 @@ test_smc_zkp_0og ()
gcry_mpi_point_t b1 = gcry_mpi_point_new (0);
gcry_mpi_point_t b2 = gcry_mpi_point_new (0);
- ec_keypair_create (y, c);
+ ec_keypair_create (y, r1);
smc_zkp_0og (alpha, (tests_run % 2 ? ec_zero : ec_gen), y, beta, a1, a2, b1,
- b2, c, d1, d2, r1, r2);
- check (!smc_zkp_0og_check (alpha, y, beta, a1, a2, b1, b2, c, d1, d2, r1,
+ b2, d1, d2, r1, r2);
+ check (!smc_zkp_0og_check (alpha, y, beta, a1, a2, b1, b2, d1, d2, r1,
r2), "zkp 0og is wrong");
check (gcry_mpi_ec_curve_point (y, ec_ctx), "not on curve");
@@ -210,7 +205,6 @@ test_smc_zkp_0og ()
check (gcry_mpi_ec_curve_point (b1, ec_ctx), "not on curve");
check (gcry_mpi_ec_curve_point (b2, ec_ctx), "not on curve");
- gcry_mpi_release (c);
gcry_mpi_release (d1);
gcry_mpi_release (d2);
gcry_mpi_release (r1);