diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index ac37a4c..4787689 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -22,6 +22,7 @@ jobs: ${{ secrets.GENERIC_EC_KEY }} ${{ secrets.PAILLIER_ZK_KEY }} ${{ secrets.FAST_PAILLIER_KEY }} + ${{ secrets.STARK_CURVE_KEY }} - uses: actions/checkout@v3 with: path: base_branch diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2b1dcb2..2c3eaf6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,6 +26,7 @@ jobs: ${{ secrets.GENERIC_EC_KEY }} ${{ secrets.PAILLIER_ZK_KEY }} ${{ secrets.FAST_PAILLIER_KEY }} + ${{ secrets.STARK_CURVE_KEY }} - name: Build run: cargo build --release - uses: actions/upload-artifact@v3 diff --git a/Cargo.lock b/Cargo.lock index 824193a..914f6bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,17 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -52,9 +63,9 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "base16ct" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -83,6 +94,18 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.10.3" @@ -124,6 +147,12 @@ dependencies = [ "syn 2.0.15", ] +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "1.2.1" @@ -213,9 +242,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.1" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "core-foundation-sys" @@ -234,9 +263,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.4.9" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" dependencies = [ "generic-array", "rand_core", @@ -370,11 +399,12 @@ dependencies = [ [[package]] name = "der" -version = "0.6.0" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", + "pem-rfc7468", "zeroize", ] @@ -385,20 +415,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] [[package]] name = "ecdsa" -version = "0.15.0" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82508ce57bd2b245e9914411800f87fd8fc8288f501bb26919cb9b2ee964028f" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", + "digest", "elliptic-curve", "rfc6979", "signature", + "spki", ] [[package]] @@ -415,17 +448,17 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.12.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", - "der", "digest", "ff", "generic-array", "group", + "pem-rfc7468", "pkcs8", "rand_core", "sec1", @@ -439,7 +472,7 @@ version = "3.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2170fc0efee383079a8bdd05d6ea2a184d2a0f07a1c1dcabdb2fd5e9f24bc36c" dependencies = [ - "num-bigint", + "num-bigint 0.4.3", "num-traits", "proc-macro2", "quote", @@ -450,7 +483,7 @@ dependencies = [ [[package]] name = "fast-paillier" version = "0.1.0" -source = "git+https://github.com/dfns-labs/fast-paillier?branch=m#09ba60ec8c6be5d725433cca6b31d714b8caca61" +source = "git+https://github.com/dfns-labs/fast-paillier?branch=m#2fcc31352601616b1c1bdf7eeae3dcbc5a9afaa8" dependencies = [ "bytemuck", "rand_core", @@ -461,20 +494,45 @@ dependencies = [ [[package]] name = "ff" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec", + "byteorder", + "ff_derive", "rand_core", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.101", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.24" @@ -573,15 +631,17 @@ dependencies = [ "serde", "typenum", "version_check", + "zeroize", ] [[package]] name = "generic-ec" version = "0.0.0" -source = "git+https://github.com/dfns-labs/generic-ec?branch=m#448b0789b9174ef14e9fe0f8a802cef59ba3dc4f" +source = "git+https://github.com/dfns-labs/generic-ec?branch=m#bb2e7109058e8c650cdb1469ecf1f7c486634aef" dependencies = [ "generic-ec-core", "generic-ec-curves", + "getrandom", "hex", "phantom-type 0.4.2", "rand_core", @@ -594,7 +654,7 @@ dependencies = [ [[package]] name = "generic-ec-core" version = "0.1.0" -source = "git+https://github.com/dfns-labs/generic-ec?branch=m#448b0789b9174ef14e9fe0f8a802cef59ba3dc4f" +source = "git+https://github.com/dfns-labs/generic-ec?branch=m#bb2e7109058e8c650cdb1469ecf1f7c486634aef" dependencies = [ "generic-array", "rand_core", @@ -606,14 +666,16 @@ dependencies = [ [[package]] name = "generic-ec-curves" version = "0.1.0" -source = "git+https://github.com/dfns-labs/generic-ec?branch=m#448b0789b9174ef14e9fe0f8a802cef59ba3dc4f" +source = "git+https://github.com/dfns-labs/generic-ec?branch=m#bb2e7109058e8c650cdb1469ecf1f7c486634aef" dependencies = [ + "crypto-bigint", "elliptic-curve", "generic-ec-core", "k256", "p256", "rand_core", "sha2", + "stark-curve", "subtle", "zeroize", ] @@ -621,7 +683,7 @@ dependencies = [ [[package]] name = "generic-ec-zkp" version = "0.1.0" -source = "git+https://github.com/dfns-labs/generic-ec?branch=m#448b0789b9174ef14e9fe0f8a802cef59ba3dc4f" +source = "git+https://github.com/dfns-labs/generic-ec?branch=m#bb2e7109058e8c650cdb1469ecf1f7c486634aef" dependencies = [ "digest", "generic-array", @@ -665,9 +727,9 @@ dependencies = [ [[package]] name = "group" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core", @@ -689,6 +751,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + [[package]] name = "hmac" version = "0.12.1" @@ -756,9 +824,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92a55e0ff3b72c262bcf041d9e97f1b84492b68f1c1a384de2323d3dc9403397" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", @@ -810,6 +878,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c96aba5aa877601bb3f6dd6a63a969e1f82e60646e81e71b14496995e9853c91" +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -848,9 +927,9 @@ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" [[package]] name = "p256" -version = "0.12.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c124b3cbce43bcbac68c58ec181d98ed6cc7e6d0aa7c3ba97b2563410b0e55" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ "ecdsa", "elliptic-curve", @@ -861,7 +940,7 @@ dependencies = [ [[package]] name = "paillier-zk" version = "0.1.0" -source = "git+https://github.com/dfns-labs/paillier-zk?branch=m#b344dd32cb8704e4f730e613e47b6adc6dbc238d" +source = "git+https://github.com/dfns-labs/paillier-zk?branch=m#91cf66651671c9cf1b7a4d5ca4b7827b1d76a802" dependencies = [ "digest", "fast-paillier", @@ -873,6 +952,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "phantom-type" version = "0.3.1" @@ -905,9 +993,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -921,9 +1009,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primeorder" -version = "0.12.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b7e10b3a364b1c813238b1c9a749336cbe51fd4265cd99f57cf29302c90af7" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" dependencies = [ "elliptic-curve", ] @@ -970,6 +1058,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -1013,13 +1107,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint", "hmac", - "zeroize", + "subtle", ] [[package]] @@ -1085,9 +1178,9 @@ checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "sec1" -version = "0.3.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" dependencies = [ "base16ct", "der", @@ -1235,14 +1328,26 @@ dependencies = [ [[package]] name = "spki" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", ] +[[package]] +name = "stark-curve" +version = "0.1.0" +source = "git+https://github.com/dfns-labs/stark-curve#a1de6cc130522565180e7d2fe8ac5520bde45049" +dependencies = [ + "ff", + "hex-literal", + "primeorder", + "subtle", + "zeroize", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1289,6 +1394,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "termcolor" version = "1.1.3" @@ -1624,6 +1735,15 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "zeroize" version = "1.5.7" diff --git a/cggmp21/src/execution_id.rs b/cggmp21/src/execution_id.rs index 31a2998..48497ae 100644 --- a/cggmp21/src/execution_id.rs +++ b/cggmp21/src/execution_id.rs @@ -3,6 +3,7 @@ /// Each protocol execution must have unique execution ID. All signers taking part in the protocol /// (keygen/signing/etc.) must share the same execution ID, otherwise protocol will abort with /// unverbose error. +#[derive(Clone, Copy)] pub struct ExecutionId<'id> { id: &'id [u8], } @@ -18,11 +19,3 @@ impl<'id> ExecutionId<'id> { self.id } } - -impl<'id> Clone for ExecutionId<'id> { - fn clone(&self) -> Self { - Self { id: self.id } - } -} - -impl<'id> Copy for ExecutionId<'id> {} diff --git a/cggmp21/src/signing.rs b/cggmp21/src/signing.rs index 02ef77b..7f8102e 100644 --- a/cggmp21/src/signing.rs +++ b/cggmp21/src/signing.rs @@ -476,7 +476,6 @@ where tracer.stage("Retrieve auxiliary data"); let R_i = &R[usize::from(i)]; let N_i = &R_i.N; - let enc_i = fast_paillier::EncryptionKey::from_n(N_i.clone()); let dec_i: fast_paillier::DecryptionKey = fast_paillier::DecryptionKey::from_primes(p_i.clone(), q_i.clone()) .map_err(|_| Bug::InvalidOwnPaillierKey)?; @@ -506,10 +505,10 @@ where let rho_i = Integer::gen_invertible(N_i, rng); tracer.stage("Encrypt G_i and K_i"); - let G_i = enc_i + let G_i = dec_i .encrypt_with(&utils::scalar_to_bignumber(&gamma_i), &v_i) .map_err(|_| Bug::PaillierEnc(BugSource::G_i))?; - let K_i = enc_i + let K_i = dec_i .encrypt_with(&utils::scalar_to_bignumber(&k_i), &rho_i) .map_err(|_| Bug::PaillierEnc(BugSource::K_i))?; @@ -531,13 +530,13 @@ where let psi0 = pi_enc::non_interactive::prove( parties_shared_state.clone().chain_update(i.to_be_bytes()), &R_j.into(), - &pi_enc::Data { - key: enc_i.clone(), - ciphertext: K_i.clone(), + pi_enc::Data { + key: &dec_i, + ciphertext: &K_i, }, - &pi_enc::PrivateData { - plaintext: utils::scalar_to_bignumber(&k_i), - nonce: rho_i.clone(), + pi_enc::PrivateData { + plaintext: &utils::scalar_to_bignumber(&k_i), + nonce: &rho_i, }, &security_params.pi_enc, &mut *rng, @@ -618,9 +617,9 @@ where if pi_enc::non_interactive::verify( parties_shared_state.clone().chain_update(j.to_be_bytes()), &R_i.into(), - &pi_enc::Data { - key: fast_paillier::EncryptionKey::from_n(R_j.N.clone()), - ciphertext: ciphertext.K.clone(), + pi_enc::Data { + key: &fast_paillier::EncryptionKey::from_n(R_j.N.clone()), + ciphertext: &ciphertext.K, }, &proof.psi0.0, &security_params.pi_enc, @@ -675,7 +674,7 @@ where }; tracer.stage("Encrypt F_ji"); - let F_ji = enc_i + let F_ji = dec_i .encrypt_with(&(-&beta_ij).complete(), &r_ij) .map_err(|_| Bug::PaillierEnc(BugSource::F_ji))?; @@ -694,7 +693,7 @@ where }; tracer.stage("Encrypt hat_F_ji"); - let hat_F_ji = enc_i + let hat_F_ji = dec_i .encrypt_with(&(-&hat_beta_ij).complete(), &hat_r_ij) .map_err(|_| Bug::PaillierEnc(BugSource::hat_F))?; @@ -703,19 +702,19 @@ where let psi_ji = pi_aff::non_interactive::prove( psi_cst.clone(), &R_j.into(), - &pi_aff::Data { - key0: enc_j.clone(), - key1: enc_i.clone(), - c: ciphertext_j.K.clone(), - d: D_ji.clone(), - y: F_ji.clone(), - x: Gamma_i, + pi_aff::Data { + key0: &enc_j, + key1: &dec_i, + c: &ciphertext_j.K, + d: &D_ji, + y: &F_ji, + x: &Gamma_i, }, - &pi_aff::PrivateData { - x: utils::scalar_to_bignumber(&gamma_i), - y: (-&beta_ij).complete(), - nonce: s_ij.clone(), - nonce_y: r_ij.clone(), + pi_aff::PrivateData { + x: &utils::scalar_to_bignumber(&gamma_i), + y: &(-&beta_ij).complete(), + nonce: &s_ij, + nonce_y: &r_ij, }, &security_params.pi_aff, &mut *rng, @@ -726,19 +725,19 @@ where let hat_psi_ji = pi_aff::non_interactive::prove( psi_cst.clone(), &R_j.into(), - &pi_aff::Data { - key0: enc_j.clone(), - key1: enc_i.clone(), - c: ciphertext_j.K.clone(), - d: hat_D_ji.clone(), - y: hat_F_ji.clone(), - x: Point::generator() * x_i, + pi_aff::Data { + key0: &enc_j, + key1: &dec_i, + c: &ciphertext_j.K, + d: &hat_D_ji, + y: &hat_F_ji, + x: &(Point::generator() * x_i), }, - &pi_aff::PrivateData { - x: utils::scalar_to_bignumber(x_i), - y: (-&hat_beta_ij).complete(), - nonce: hat_s_ij.clone(), - nonce_y: hat_r_ij.clone(), + pi_aff::PrivateData { + x: &utils::scalar_to_bignumber(x_i), + y: &(-&hat_beta_ij).complete(), + nonce: &hat_s_ij, + nonce_y: &hat_r_ij, }, &security_params.pi_aff, &mut *rng, @@ -749,15 +748,15 @@ where let psi_prime_ji = pi_log::non_interactive::prove( psi_cst, &R_j.into(), - &pi_log::Data { - key0: enc_i.clone(), - c: G_i.clone(), - x: Gamma_i, - b: Point::::generator().to_point(), + pi_log::Data { + key0: &dec_i, + c: &G_i, + x: &Gamma_i, + b: &Point::::generator().to_point(), }, - &pi_log::PrivateData { - x: utils::scalar_to_bignumber(&gamma_i), - nonce: v_i.clone(), + pi_log::PrivateData { + x: &utils::scalar_to_bignumber(&gamma_i), + nonce: &v_i, }, &security_params.pi_log, &mut *rng, @@ -809,13 +808,13 @@ where let psi_invalid = pi_aff::non_interactive::verify( cst_j.clone(), &R_i.into(), - &pi_aff::Data { - key0: enc_i.clone(), - key1: enc_j.clone(), - c: K_i.clone(), - d: msg.D.clone(), - y: msg.F.clone(), - x: msg.Gamma, + pi_aff::Data { + key0: &dec_i, + key1: &enc_j, + c: &K_i, + d: &msg.D, + y: &msg.F, + x: &msg.Gamma, }, &msg.psi.0, &security_params.pi_aff, @@ -827,13 +826,13 @@ where let hat_psi_invalid = pi_aff::non_interactive::verify( cst_j.clone(), &R_i.into(), - &pi_aff::Data { - key0: enc_i.clone(), - key1: enc_j.clone(), - c: K_i.clone(), - d: msg.hat_D.clone(), - y: msg.hat_F.clone(), - x: X_j, + pi_aff::Data { + key0: &dec_i, + key1: &enc_j, + c: &K_i, + d: &msg.hat_D, + y: &msg.hat_F, + x: &X_j, }, &msg.hat_psi.0, &security_params.pi_aff, @@ -845,11 +844,11 @@ where let psi_prime_invalid = pi_log::non_interactive::verify( cst_j, &R_i.into(), - &pi_log::Data { - key0: enc_j.clone(), - c: ciphertexts.G.clone(), - x: msg.Gamma, - b: Point::::generator().to_point(), + pi_log::Data { + key0: &enc_j, + c: &ciphertexts.G, + x: &msg.Gamma, + b: &Point::::generator().to_point(), }, &msg.psi_prime.0, &security_params.pi_log, @@ -906,15 +905,15 @@ where let psi_prime_prime = pi_log::non_interactive::prove( parties_shared_state.clone().chain_update(i.to_be_bytes()), &R_j.into(), - &pi_log::Data { - key0: enc_i.clone(), - c: K_i.clone(), - x: Delta_i, - b: Gamma, + pi_log::Data { + key0: &dec_i, + c: &K_i, + x: &Delta_i, + b: &Gamma, }, - &pi_log::PrivateData { - x: utils::scalar_to_bignumber(&k_i), - nonce: rho_i.clone(), + pi_log::PrivateData { + x: &utils::scalar_to_bignumber(&k_i), + nonce: &rho_i, }, &security_params.pi_log, &mut *rng, @@ -956,16 +955,16 @@ where let enc_j = fast_paillier::EncryptionKey::from_n(R_j.N.clone()); let data = pi_log::Data { - key0: enc_j.clone(), - c: ciphertext_j.K.clone(), - x: msg_j.Delta, - b: Gamma, + key0: &enc_j, + c: &ciphertext_j.K, + x: &msg_j.Delta, + b: &Gamma, }; if pi_log::non_interactive::verify( parties_shared_state.clone().chain_update(j.to_be_bytes()), &R_i.into(), - &data, + data, &msg_j.psi_prime_prime.0, &security_params.pi_log, &msg_j.psi_prime_prime.1, @@ -1003,9 +1002,9 @@ where // If message is not specified, protocol terminates here and outputs partial // signature let Some(message_to_sign) = message_to_sign else { - tracer.protocol_ends(); - return Ok(ProtocolOutput::Presignature(presig)) - }; + tracer.protocol_ends(); + return Ok(ProtocolOutput::Presignature(presig)); + }; // Signing tracer.named_round_begins("Partial signing");