This is an automated email from the ASF dual-hosted git repository. sandreoli pushed a commit to branch issue18-add-python-flow-example in repository https://gitbox.apache.org/repos/asf/incubator-milagro-MPC.git
commit 576b86e5a9d132e96d420a095159e12d167e88df Merge: 0a180eb 8133fdc Author: Samuele Andreoli <[email protected]> AuthorDate: Mon Mar 16 14:23:53 2020 +0000 Merge branch 'develop' into issue18-add-python-flow-example Conflicts: python/amcl/mpc.py src/mpc.c .travis.yml | 31 +++- Dockerfile | 14 -- README.md | 24 ++- cmake/PythonParameters.cmake | 45 +++++ include/amcl/commitments.h | 4 +- include/amcl/mpc.h | 25 ++- include/amcl/mta.h | 8 +- include/amcl/schnorr.h | 12 +- python/CMakeLists.txt | 7 + python/amcl/CMakeLists.txt | 9 +- python/amcl/aes.py | 144 ++++++++++++++++ python/amcl/commitments.py | 4 +- python/amcl/mpc.py | 10 +- python/amcl/rsa.py.in | 323 +++++++++++++++++++++++++++++++++++ python/amcl/schnorr.py | 6 +- python/benchmark/CMakeLists.txt | 5 + python/benchmark/bench_aes.py | 51 ++++++ python/benchmark/bench_rsa.py.in | 67 ++++++++ python/examples/CMakeLists.txt | 5 + python/examples/example_aes.py | 52 ++++++ python/examples/example_rsa.py.in | 56 ++++++ python/test/CMakeLists.txt | 12 ++ python/test/test_aes.py | 97 +++++++++++ python/test/test_nm_commit.py | 10 +- python/test/test_rsa.py.in | 143 ++++++++++++++++ python/test/test_schnorr.py | 1 - python/test/test_zk_factoring.py | 10 +- sonar-project.properties | 24 +++ src/commitments.c | 16 +- src/factoring_zk.c | 4 +- src/mpc.c | 70 ++++---- src/mta.c | 75 +++++--- src/schnorr.c | 14 +- test/smoke/test_bc_setup_smoke.c | 4 +- test/unit/test_mta_rp_challenge.c | 6 +- test/unit/test_mta_zk_challenge.c | 6 +- test/unit/test_mta_zkwc_challenge.c | 6 +- testVectors/gcm/decrypt.json | 122 +++++++++++++ testVectors/gcm/encrypt.json | 122 +++++++++++++ testVectors/mta/mta_challenge.json | 20 +-- testVectors/mta/mta_challenge.txt | 20 +-- testVectors/mta/mtawc_challenge.json | 20 +-- testVectors/mta/mtawc_challenge.txt | 20 +-- testVectors/mta/rp_challenge.json | 20 +-- testVectors/mta/rp_challenge.txt | 20 +-- 45 files changed, 1554 insertions(+), 210 deletions(-) diff --cc include/amcl/mpc.h index 7203578,2e7132c..2b3be46 --- a/include/amcl/mpc.h +++ b/include/amcl/mpc.h @@@ -79,17 -79,17 +79,26 @@@ int MPC_ECDSA_SIGN(int sha, const octe * @param S S component of signature * @return Returns 0 or else error code */ - int MPC_ECDSA_VERIFY(octet *HM,octet *PK, octet *R,octet *S); + int MPC_ECDSA_VERIFY(const octet *HM,octet *PK, octet *R,octet *S); + + /** \brief Generate a random K for and ECDSA signature + * + * Generate a random K modulo the curve order + * + * @param RNG Pointer to a cryptographically secure PRNG + * @param K Destination octet for the randomly generated value + */ + void MPC_K_GENERATE(csprng *RNG, octet *K); +/** \brief Generate a random K for and ECDSA signature + * + * Generate a random K modulo the curve order + * + * @param RNG Pointer to a cryptographically secure PRNG + * @param K Destination octet for the randomly generated value + */ +void MPC_K_GENERATE(csprng *RNG, octet *K); + /** \brief Calculate the inverse of the sum of kgamma values * * Calculate the inverse of the sum of kgamma values diff --cc python/amcl/mpc.py index c0f5ec7,7030202..016d1c3 --- a/python/amcl/mpc.py +++ b/python/amcl/mpc.py @@@ -75,7 -75,7 +75,7 @@@ extern void PAILLIER_PK_fromOctet(PAILL extern int ECP_SECP256K1_PUBLIC_KEY_VALIDATE(octet *W); extern void MPC_ECDSA_KEY_PAIR_GENERATE(csprng *RNG, octet *S, octet *W); - extern int MPC_ECDSA_VERIFY(octet *HM,octet *PK, octet *R,octet *S); -extern int MPC_ECDSA_VERIFY(const octet *HM,octet *PK, octet *R,octet *S); ++extern int MPC_ECDSA_VERIFY(const octet *HM, octet *PK, octet *R, octet *S); extern void MPC_MTA_CLIENT1(csprng *RNG, PAILLIER_public_key* PUB, octet* A, octet* CA, octet* R); extern void MPC_MTA_CLIENT2(PAILLIER_private_key *PRIV, octet* CB, octet *ALPHA); extern void MPC_MTA_SERVER(csprng *RNG, PAILLIER_public_key *PUB, octet *B, octet *CA, octet *Z, octet *R, octet *CB, octet *BETA); diff --cc src/mpc.c index 6a97c46,1c3a6d7..d1014ad --- a/src/mpc.c +++ b/src/mpc.c @@@ -26,8 -26,9 +26,8 @@@ under the License /* Generate ECDSA key pair */ void MPC_ECDSA_KEY_PAIR_GENERATE(csprng *RNG, octet* S, octet *W) { -- - BIG_256_56 s, q; + BIG_256_56 s; + BIG_256_56 q; ECP_SECP256K1 G;
