diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-19 22:37:31 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-19 22:41:03 +0200 |
commit | 0d2f95ffba76a338b5820f862d826a7ac1812ec3 (patch) | |
tree | 8eaf9b97f41999920043d46911270295f053aec0 /crypto.h | |
parent | 3f81885ee3e44486505935760da7c812efc4c76f (diff) |
merge smc into crypto module. add 2dim array helpers
Diffstat (limited to 'crypto.h')
-rw-r--r-- | crypto.h | 78 |
1 files changed, 71 insertions, 7 deletions
@@ -52,12 +52,76 @@ void brandt_mpi_scan_unsigned (gcry_mpi_t *result, /* --- EC --- */ -void brandt_ec_skey_create (gcry_mpi_t skey); -void brandt_ec_pkey_compute (gcry_mpi_point_t *pkey, const gcry_mpi_t skey); -void brandt_ec_keypair_create (gcry_mpi_point_t pkey, gcry_mpi_t skey); -void brandt_ec_keypair_create_base (gcry_mpi_point_t pkey, - gcry_mpi_t skey, - const gcry_mpi_point_t base); -int brandt_ec_point_cmp (const gcry_mpi_point_t a, const gcry_mpi_point_t b); +struct ec_point { + unsigned char data[256 / 8]; +}; + +int ec_point_cmp (const gcry_mpi_point_t a, const gcry_mpi_point_t b); +void ec_skey_create (gcry_mpi_t skey); +void ec_keypair_create (gcry_mpi_point_t pkey, gcry_mpi_t skey); +void ec_keypair_create_base (gcry_mpi_point_t pkey, + gcry_mpi_t skey, + const gcry_mpi_point_t base); + + + + +/* --- Zero knowledge proofs --- */ + +void smc_zkp_dl (const gcry_mpi_point_t v, + const gcry_mpi_point_t g, + const gcry_mpi_t x, + const gcry_mpi_point_t a, + gcry_mpi_t c, + gcry_mpi_t r); +int smc_zkp_dl_check (const gcry_mpi_point_t v, + const gcry_mpi_point_t g, + const gcry_mpi_point_t a, + const gcry_mpi_t c, + const gcry_mpi_t r); + +void smc_zkp_2dle (const gcry_mpi_point_t v, + const gcry_mpi_point_t w, + const gcry_mpi_point_t g1, + const gcry_mpi_point_t g2, + const gcry_mpi_t x, + gcry_mpi_point_t a, + gcry_mpi_point_t b, + gcry_mpi_t c, + gcry_mpi_t r); +int smc_zkp_2dle_check (const gcry_mpi_point_t v, + const gcry_mpi_point_t w, + const gcry_mpi_point_t g1, + const gcry_mpi_point_t g2, + const gcry_mpi_point_t a, + const gcry_mpi_point_t b, + const gcry_mpi_t c, + const gcry_mpi_t r); + +void smc_zkp_0og (gcry_mpi_point_t alpha, + const gcry_mpi_point_t m, + const gcry_mpi_point_t y, + gcry_mpi_point_t beta, + gcry_mpi_point_t a1, + gcry_mpi_point_t a2, + gcry_mpi_point_t b1, + gcry_mpi_point_t b2, + gcry_mpi_t c, + gcry_mpi_t d1, + gcry_mpi_t d2, + gcry_mpi_t r1, + gcry_mpi_t r2); +int smc_zkp_0og_check (const gcry_mpi_point_t alpha, + const gcry_mpi_point_t y, + const gcry_mpi_point_t beta, + const gcry_mpi_point_t a1, + const gcry_mpi_point_t a2, + const gcry_mpi_point_t b1, + const gcry_mpi_point_t b2, + const gcry_mpi_t c, + const gcry_mpi_t d1, + const gcry_mpi_t d2, + const gcry_mpi_t r1, + const gcry_mpi_t r2); #endif /* ifndef _BRANDT_CRYPTO_H */ |