diff --git a/Cargo.lock b/Cargo.lock index 3382e74ad54..fc7cd83f1a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,7 +30,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -60,25 +60,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee5cca1ddc8b9dceb55b7f1272a9d1e643d73006f350a20ab4926d24e33f0f0d" -[[package]] -name = "amcl_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c7c7627444413f6a488bf9e6d352aea6fcfa281123cd92ecac0b3c9ef5ef2" -dependencies = [ - "byteorder", - "lazy_static", - "miracl_core", - "rand 0.7.3", - "rayon", - "serde", - "serde_bytes", - "serde_json", - "sha3", - "subtle-encoding", - "zeroize", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -166,6 +147,135 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "arrayref" version = "0.3.7" @@ -390,19 +500,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", + "digest", ] [[package]] @@ -411,16 +509,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -455,12 +544,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byte-unit" version = "4.0.19" @@ -736,6 +819,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "constcat" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" + [[package]] name = "core-foundation" version = "0.9.4" @@ -1030,8 +1119,8 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array 0.14.7", - "rand_core 0.6.4", + "generic-array", + "rand_core", "subtle", "zeroize", ] @@ -1042,7 +1131,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.7", + "generic-array", "typenum", ] @@ -1055,7 +1144,7 @@ dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", - "digest 0.10.7", + "digest", "fiat-crypto", "platforms", "rustc_version", @@ -1206,6 +1295,17 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1228,22 +1328,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -1312,7 +1403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest 0.10.7", + "digest", "elliptic-curve", "rfc6979", "signature", @@ -1337,7 +1428,7 @@ checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ "curve25519-dalek", "ed25519", - "rand_core 0.6.4", + "rand_core", "serde", "sha2", "subtle", @@ -1358,12 +1449,12 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest 0.10.7", + "digest", "ff", - "generic-array 0.14.7", + "generic-array", "group", "pkcs8", - "rand_core 0.6.4", + "rand_core", "sec1", "subtle", "zeroize", @@ -1456,7 +1547,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ - "rand_core 0.6.4", + "rand_core", "subtle", ] @@ -1655,15 +1746,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -1675,17 +1757,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.11" @@ -1694,7 +1765,7 @@ checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -2229,7 +2300,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", - "rand_core 0.6.4", + "rand_core", "subtle", ] @@ -2370,7 +2441,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -2553,7 +2624,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array 0.14.7", + "generic-array", ] [[package]] @@ -2632,7 +2703,7 @@ dependencies = [ "iroha_wasm_builder", "once_cell", "parity-scale-codec", - "rand 0.8.5", + "rand", "serde", "serde_json", "tempfile", @@ -2747,7 +2818,7 @@ dependencies = [ "once_cell", "parity-scale-codec", "parking_lot", - "rand 0.8.5", + "rand", "serde", "serde_json", "tempfile", @@ -2774,13 +2845,12 @@ version = "2.0.0-pre-rc.20" dependencies = [ "aead", "amcl", - "amcl_wrapper", "arrayref", "blake2", "chacha20poly1305", "curve25519-dalek", "derive_more", - "digest 0.10.7", + "digest", "displaydoc", "ed25519-dalek", "elliptic-curve", @@ -2796,8 +2866,8 @@ dependencies = [ "libsodium-sys-stable", "openssl", "parity-scale-codec", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "secp256k1", "serde", "serde_json", @@ -2805,6 +2875,7 @@ dependencies = [ "sha2", "signature", "thiserror", + "w3f-bls", "x25519-dalek", "zeroize", ] @@ -2927,7 +2998,7 @@ dependencies = [ "iroha_config", "iroha_futures_derive", "iroha_logger", - "rand 0.8.5", + "rand", "serde", "serde_json", "tokio", @@ -3016,7 +3087,7 @@ dependencies = [ "iroha_logger", "iroha_primitives", "parity-scale-codec", - "rand 0.8.5", + "rand", "test_network", "thiserror", "tokio", @@ -3095,7 +3166,7 @@ name = "iroha_smart_contract" version = "2.0.0-pre-rc.20" dependencies = [ "derive_more", - "getrandom 0.2.11", + "getrandom", "iroha_data_model", "iroha_macro", "iroha_smart_contract_derive", @@ -3697,16 +3768,10 @@ checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.48.0", ] -[[package]] -name = "miracl_core" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4330eca86d39f2b52d0481aa1e90fe21bfa61f11b0bf9b48ab95595013cefe48" - [[package]] name = "multer" version = "2.1.0" @@ -3772,6 +3837,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.17" @@ -3825,12 +3911,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -4183,7 +4263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", - "opaque-debug 0.3.0", + "opaque-debug", "universal-hash", ] @@ -4284,8 +4364,8 @@ dependencies = [ "bitflags 2.4.1", "lazy_static", "num-traits", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "rand_xorshift", "regex-syntax 0.8.2", "rusty-fork", @@ -4355,19 +4435,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -4375,18 +4442,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -4396,16 +4453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -4414,16 +4462,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -4432,7 +4471,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -4470,7 +4509,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom", "libredox", "thiserror", ] @@ -4555,7 +4594,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", - "getrandom 0.2.11", + "getrandom", "libc", "spin", "untrusted", @@ -4723,7 +4762,7 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", - "generic-array 0.14.7", + "generic-array", "pkcs8", "subtle", "zeroize", @@ -4735,7 +4774,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acea373acb8c21ecb5a23741452acd2593ed44ee3d343e72baaa143bc89d0d5" dependencies = [ - "rand 0.8.5", + "rand", "secp256k1-sys", "serde", ] @@ -4787,15 +4826,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.193" @@ -4898,7 +4928,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -4915,7 +4945,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -4933,15 +4963,12 @@ dependencies = [ [[package]] name = "sha3" -version = "0.8.2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "block-buffer 0.7.3", - "byte-tools", - "digest 0.8.1", + "digest", "keccak", - "opaque-debug 0.2.3", ] [[package]] @@ -4995,8 +5022,8 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", + "digest", + "rand_core", ] [[package]] @@ -5196,15 +5223,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "subtle-encoding" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dcb1ed7b8330c5eed5441052651dd7a12c75e2ed88f2ec024ae1fa3a5e59945" -dependencies = [ - "zeroize", -] - [[package]] name = "supports-color" version = "1.3.1" @@ -5314,7 +5332,7 @@ dependencies = [ "iroha_logger", "iroha_primitives", "parity-scale-codec", - "rand 0.8.5", + "rand", "serde_json", "tempfile", "tokio", @@ -5591,7 +5609,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand 0.8.5", + "rand", "slab", "tokio", "tokio-util", @@ -5740,7 +5758,7 @@ dependencies = [ "httparse", "log", "native-tls", - "rand 0.8.5", + "rand", "rustls", "rustls-native-certs", "sha1", @@ -5904,7 +5922,7 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ - "getrandom 0.2.11", + "getrandom", ] [[package]] @@ -5937,6 +5955,30 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "w3f-bls" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7335e4c132c28cc43caef6adb339789e599e39adbe78da0c4d547fad48cbc331" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-serialize-derive", + "arrayref", + "constcat", + "digest", + "rand", + "rand_chacha", + "rand_core", + "sha2", + "sha3", + "thiserror", + "zeroize", +] + [[package]] name = "wait-timeout" version = "0.2.0" @@ -5996,12 +6038,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -6359,7 +6395,7 @@ dependencies = [ "memfd", "memoffset", "paste", - "rand 0.8.5", + "rand", "rustix", "sptr", "wasm-encoder 0.36.2", @@ -6759,7 +6795,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ "curve25519-dalek", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -6798,6 +6834,20 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index 0d2272f2d10..bf8a269cdc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,7 +116,7 @@ strum = { version = "0.25.0", default-features = false } getset = "0.1.2" hex-literal = "0.4.1" -rand = "0.8.5" +rand = { version = "0.8.5", default-features = false, features = ["getrandom", "alloc"] } warp = { version = "0.3.6", default-features = false } wasmtime = "15.0.0" diff --git a/configs/peer/executor.wasm b/configs/peer/executor.wasm index ad6286a1ccb..fdab6d8a960 100644 Binary files a/configs/peer/executor.wasm and b/configs/peer/executor.wasm differ diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index c16671104f6..fefcb9083e4 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -20,6 +20,7 @@ std = [ "digest/std", "sha2/std", "hkdf/std", + "w3f-bls/std", "signature/std", "ed25519-dalek/std", "rand/std", @@ -58,8 +59,7 @@ digest = { version = "0.10.7", default-features = false, features = ["alloc"]} blake2 = { version = "0.10.6", default-features = false } sha2 = { version = "0.10.8", default-features = false } hkdf = { version = "0.12.3", default-features = false } -amcl = { version = "0.2.0", default-features = false, features = ["secp256k1"] } -amcl_wrapper = { version = "0.4.0" } +w3f-bls = { version = "0.1.3", default-features = false } signature = { version = "2.1.0", default-features = false } ed25519-dalek = { version = "2.0.0", default-features = false, features = ["rand_core"] } @@ -85,6 +85,7 @@ serde_json = { workspace = true } # these crypto libraries are not used to implement actual crypto algorithms # but to test some of the primitives against them +amcl = { version = "0.2.0", default-features = false, features = ["secp256k1"] } secp256k1 = { version = "0.28.0", features = ["rand", "serde"] } libsodium-sys-stable = "1.20.3" openssl = { version = "0.10.59", features = ["vendored"] } diff --git a/crypto/src/lib.rs b/crypto/src/lib.rs index abdb7c322bd..e00f1c3a4b1 100755 --- a/crypto/src/lib.rs +++ b/crypto/src/lib.rs @@ -43,6 +43,7 @@ pub use merkle::MerkleTree; use parity_scale_codec::{Decode, Encode}; use serde::{ser::SerializeStruct, Deserialize, Serialize}; use serde_with::{DeserializeFromStr, SerializeDisplay}; +use w3f_bls::SerializableToBytes; pub use self::signature::*; @@ -248,8 +249,10 @@ impl From<(secp256k1::PublicKey, secp256k1::PrivateKey)> for KeyPair { } } -impl From<(bls::BlsNormalPublicKey, bls::PrivateKey)> for KeyPair { - fn from((public_key, private_key): (bls::BlsNormalPublicKey, bls::PrivateKey)) -> Self { +impl From<(bls::BlsNormalPublicKey, bls::BlsNormalPrivateKey)> for KeyPair { + fn from( + (public_key, private_key): (bls::BlsNormalPublicKey, bls::BlsNormalPrivateKey), + ) -> Self { Self { public_key: PublicKey::BlsNormal(public_key), private_key: PrivateKey::BlsNormal(private_key), @@ -257,8 +260,8 @@ impl From<(bls::BlsNormalPublicKey, bls::PrivateKey)> for KeyPair { } } -impl From<(bls::BlsSmallPublicKey, bls::PrivateKey)> for KeyPair { - fn from((public_key, private_key): (bls::BlsSmallPublicKey, bls::PrivateKey)) -> Self { +impl From<(bls::BlsSmallPublicKey, bls::BlsSmallPrivateKey)> for KeyPair { + fn from((public_key, private_key): (bls::BlsSmallPublicKey, bls::BlsSmallPrivateKey)) -> Self { Self { public_key: PublicKey::BlsSmall(Box::new(public_key)), private_key: PrivateKey::BlsSmall(private_key), @@ -336,6 +339,8 @@ impl PublicKey { /// Key payload fn payload(&self) -> Vec { + use w3f_bls::SerializableToBytes as _; + match self { PublicKey::Ed25519(key) => key.as_bytes().to_vec(), PublicKey::Secp256k1(key) => key.to_sec1_bytes().to_vec(), @@ -509,17 +514,31 @@ impl From for PublicKey { ffi::ffi_item! { /// Private Key used in signatures. - #[derive(Clone, PartialEq, Eq)] + #[derive(Clone)] #[cfg_attr(all(feature = "ffi_export", not(feature = "ffi_import")), ffi_type(opaque))] #[allow(missing_docs)] pub enum PrivateKey { Ed25519(Box), Secp256k1(secp256k1::PrivateKey), - BlsNormal(bls::PrivateKey), - BlsSmall(bls::PrivateKey), + BlsNormal(bls::BlsNormalPrivateKey), + BlsSmall(bls::BlsSmallPrivateKey), } } +impl PartialEq for PrivateKey { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Self::Ed25519(l), Self::Ed25519(r)) => l == r, + (Self::Secp256k1(l), Self::Secp256k1(r)) => l == r, + (Self::BlsNormal(l), Self::BlsNormal(r)) => l.to_bytes() == r.to_bytes(), + (Self::BlsSmall(l), Self::BlsSmall(r)) => l.to_bytes() == r.to_bytes(), + _ => false, + } + } +} + +impl Eq for PrivateKey {} + impl PrivateKey { /// Creates a new public key from raw bytes received from elsewhere /// @@ -567,7 +586,8 @@ impl PrivateKey { match self { Self::Ed25519(key) => key.to_keypair_bytes().to_vec(), Self::Secp256k1(key) => key.to_bytes().to_vec(), - Self::BlsNormal(key) | Self::BlsSmall(key) => key.to_bytes(), + Self::BlsNormal(key) => key.to_bytes(), + Self::BlsSmall(key) => key.to_bytes(), } } } @@ -619,7 +639,6 @@ impl<'de> Deserialize<'de> for PrivateKey { } /// A session key derived from a key exchange. Will usually be used for a symmetric encryption afterwards -#[allow(unused_tuple_struct_fields)] pub struct SessionKey(ConstVec); impl SessionKey { diff --git a/crypto/src/signature/bls/implementation.rs b/crypto/src/signature/bls/implementation.rs index a4cd228d7ab..17a68d3790b 100644 --- a/crypto/src/signature/bls/implementation.rs +++ b/crypto/src/signature/bls/implementation.rs @@ -1,177 +1,22 @@ #[cfg(not(feature = "std"))] -use alloc::{borrow::ToOwned as _, format, string::ToString as _, vec, vec::Vec}; -use core::{hash::Hash, marker::PhantomData}; +use alloc::{borrow::ToOwned as _, string::ToString as _, vec, vec::Vec}; +use core::marker::PhantomData; -/// Implements -/// and -/// -use amcl_wrapper::{ - field_elem::FieldElement, group_elem::GroupElement, group_elem_g1::G1, group_elem_g2::G2, -}; +use rand_chacha::rand_core::OsRng; use sha2::Sha256; +// TODO: Better to use `SecretKey`, not `SecretKeyVT`, but it requires to implement +// interior mutability +use w3f_bls::{EngineBLS as _, PublicKey, SecretKeyVT as SecretKey, SerializableToBytes as _}; pub(super) const MESSAGE_CONTEXT: &[u8; 20] = b"for signing messages"; -// it is not unused? Why am I getting the unused lint here? -#[allow(dead_code)] -const PUBLICKEY_CONTEXT: &[u8; 47] = b"for signing public keys for proof of possession"; - -use super::PRIVATE_KEY_SIZE; use crate::{Algorithm, Error, KeyGenOption, ParseError}; -/// This is a simple alias so the consumer can just use `PrivateKey::random`() to generate a new one -/// instead of wrapping it as a private field -pub type PrivateKey = FieldElement; - pub trait BlsConfiguration { const ALGORITHM: Algorithm; - const PK_SIZE: usize; - const SIG_SIZE: usize; - type Generator: GroupElement + Eq + PartialEq + Hash; - type SignatureGroup: GroupElement + Eq + PartialEq + Hash; - - fn ate_2_pairing_is_one( - g: &Self::Generator, - sig: &Self::SignatureGroup, - pk: &Self::Generator, - hash: &Self::SignatureGroup, - ) -> bool; - - fn set_pairs(p: &(Self::Generator, Self::SignatureGroup)) -> (&G1, &G2); - - /// Creates a new BLS key pair - fn generate(g: &Self::Generator) -> (PublicKey, PrivateKey) { - let sk = PrivateKey::random(); - let pk = PublicKey::new(&sk, g); - (pk, sk) - } - - fn hash_to_point>(v: A, ctx: &[u8]) -> Self::SignatureGroup { - let mut value = Vec::new(); - value.extend_from_slice(ctx); - value.extend_from_slice(v.as_ref()); - Self::SignatureGroup::from_msg_hash(value.as_slice()) - } - - fn hash_msg>( - message: A, - context: Option<&'static [u8]>, - ) -> Self::SignatureGroup { - let ctx: &[u8] = context.unwrap_or(MESSAGE_CONTEXT); - Self::hash_to_point(message, ctx) - } - - fn hash_key(pk: &PublicKey, context: Option<&'static [u8]>) -> Self::SignatureGroup { - let ctx: &[u8] = context.unwrap_or(PUBLICKEY_CONTEXT); - Self::hash_to_point(pk.to_bytes(), ctx) - } - - fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&PrivateKey>; -} - -pub struct PublicKey(C::Generator); - -impl PublicKey { - pub fn new(sk: &PrivateKey, g: &C::Generator) -> Self { - Self(g.scalar_mul_const_time(sk)) - - // Self(g * sk) - } - - pub fn to_bytes(&self) -> Vec { - self.0.to_bytes(false) - } - - pub fn from_bytes(bytes: &[u8]) -> Result { - Ok(Self( - C::Generator::from_bytes(bytes).map_err(|e| ParseError(format!("{e:?}")))?, - )) - } -} - -impl core::fmt::Debug for PublicKey -where - C: BlsConfiguration + ?Sized, - C::Generator: core::fmt::Debug, -{ - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.debug_tuple("PublicKey").field(&self.0).finish() - } -} - -impl PartialEq for PublicKey -where - C: BlsConfiguration + ?Sized, - C::Generator: PartialEq, -{ - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - -impl Eq for PublicKey -where - C: BlsConfiguration + ?Sized, - C::Generator: Eq, -{ -} - -impl Clone for PublicKey -where - C: BlsConfiguration + ?Sized, - C::Generator: Clone, -{ - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} - -/// Signature over a message. One gotcha for BLS signatures -/// is the need to mitigate rogue key attacks. There are two methods to achieve -/// this: compute additional work to make each message distinct -/// in a signature for each `PublicKey` or -/// use `ProofOfPossession`. `Signature` and `ProofOfPossession` MUST -/// use domain separation values that are different -/// to avoid certain types of attacks and make `Signature` -/// distinct from `ProofOfPossession`. If `ProofOfPossession` -/// and `Signature` use the same value for `context` they are effectively the same. -/// Don't do this. You have been warned. -/// -/// To make messages distinct, use `new_with_rk_mitigation`. If using -/// proof of possession mitigation, use `new`. -#[derive(Debug, Clone)] -pub struct Signature(C::SignatureGroup); - -impl Signature { - pub fn new>( - message: A, - context: Option<&'static [u8]>, - sk: &PrivateKey, - ) -> Self { - Self(C::hash_msg(message, context).scalar_mul_const_time(sk)) - } - - // Verify a signature generated by `new` - pub fn verify>( - &self, - message: A, - context: Option<&'static [u8]>, - pk: &PublicKey, - g: &C::Generator, - ) -> bool { - let hash = C::hash_msg(message, context); - C::ate_2_pairing_is_one(g, &self.0, &pk.0, &hash) - } + type Engine: w3f_bls::EngineBLS; - pub fn to_bytes(&self) -> Vec { - self.0.to_bytes(false) - } - - pub fn from_bytes(bytes: &[u8]) -> Result { - Ok(Signature( - C::SignatureGroup::from_bytes(bytes).map_err(|e| ParseError(format!("{e:?}")))?, - )) - } + fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&SecretKey>; } pub struct BlsImpl(PhantomData); @@ -179,25 +24,26 @@ pub struct BlsImpl(PhantomData); impl BlsImpl { // the names are from an RFC, not a good idea to change them #[allow(clippy::similar_names)] - pub fn keypair(option: Option) -> (PublicKey, PrivateKey) { + pub fn keypair(option: Option) -> (PublicKey, SecretKey) { option.map_or_else( - || C::generate(&C::Generator::generator()), + || { + let sk = SecretKey::generate(OsRng); + (sk.into_public(), sk) + }, |o| match o { // Follows https://datatracker.ietf.org/doc/draft-irtf-cfrg-bls-signature/?include_text=1 KeyGenOption::UseSeed(ref seed) => { let salt = b"BLS-SIG-KEYGEN-SALT-"; - let info = [0u8, PRIVATE_KEY_SIZE.try_into().unwrap()]; // key_info || I2OSP(L, 2) + let info = [0u8, C::Engine::SECRET_KEY_SIZE.try_into().unwrap()]; // key_info || I2OSP(L, 2) let mut ikm = vec![0u8; seed.len() + 1]; ikm[..seed.len()].copy_from_slice(seed); // IKM || I2OSP(0, 1) - let mut okm = [0u8; PRIVATE_KEY_SIZE]; + let mut okm = vec![0u8; C::Engine::SECRET_KEY_SIZE]; let h = hkdf::Hkdf::::new(Some(&salt[..]), &ikm); h.expand(&info[..], &mut okm) .expect("`okm` has the correct length"); - let private_key: PrivateKey = PrivateKey::from(&okm); - ( - PublicKey::new(&private_key, &C::Generator::generator()), - private_key, - ) + + let private_key = SecretKey::::from_seed(&okm); + (private_key.into_public(), private_key) } KeyGenOption::FromPrivateKey(ref key) => { let private_key = C::extract_private_key(key).unwrap_or_else(|| { @@ -206,35 +52,38 @@ impl BlsImpl { C::ALGORITHM, ) }); - ( - PublicKey::new(private_key, &C::Generator::generator()), - private_key.clone(), - ) + (private_key.into_public(), private_key.clone()) } }, ) } - pub fn sign(message: &[u8], sk: &PrivateKey) -> Vec { - Signature::::new(message, None, sk).to_bytes() + pub fn sign(message: &[u8], sk: &SecretKey) -> Vec { + let message = w3f_bls::Message::new(MESSAGE_CONTEXT, message); + sk.sign(&message).to_bytes() } - pub fn verify(message: &[u8], signature: &[u8], pk: &PublicKey) -> Result<(), Error> { - let signature = Signature::::from_bytes(signature) + pub fn verify( + message: &[u8], + signature: &[u8], + pk: &PublicKey, + ) -> Result<(), Error> { + let signature = w3f_bls::Signature::::from_bytes(signature) .map_err(|_| ParseError("Failed to parse signature.".to_owned()))?; + let message = w3f_bls::Message::new(MESSAGE_CONTEXT, message); - if !signature.verify(message, None, pk, &C::Generator::generator()) { + if !signature.verify(&message, &pk) { return Err(Error::BadSignature); } Ok(()) } - pub fn parse_public_key(payload: &[u8]) -> Result, ParseError> { + pub fn parse_public_key(payload: &[u8]) -> Result, ParseError> { PublicKey::from_bytes(payload).map_err(|err| ParseError(err.to_string())) } - pub fn parse_private_key(payload: &[u8]) -> Result { - PrivateKey::from_bytes(payload).map_err(|err| ParseError(err.to_string())) + pub fn parse_private_key(payload: &[u8]) -> Result, ParseError> { + SecretKey::from_bytes(payload).map_err(|err| ParseError(err.to_string())) } } diff --git a/crypto/src/signature/bls/mod.rs b/crypto/src/signature/bls/mod.rs index a2cd1ed8ea3..fc837ff7adf 100644 --- a/crypto/src/signature/bls/mod.rs +++ b/crypto/src/signature/bls/mod.rs @@ -1,60 +1,31 @@ -pub use implementation::PrivateKey; -pub use normal::{NormalBls as BlsNormal, NormalPublicKey as BlsNormalPublicKey}; -pub use small::{SmallBls as BlsSmall, SmallPublicKey as BlsSmallPublicKey}; +pub use normal::{ + NormalBls as BlsNormal, NormalPrivateKey as BlsNormalPrivateKey, + NormalPublicKey as BlsNormalPublicKey, +}; +pub use small::{ + SmallBls as BlsSmall, SmallPrivateKey as BlsSmallPrivateKey, + SmallPublicKey as BlsSmallPublicKey, +}; // Do not expose the [implementation] module & the [implementation::BlsConfiguration] trait mod implementation; -pub const PRIVATE_KEY_SIZE: usize = amcl_wrapper::constants::MODBYTES; - /// This version is the "normal" BLS signature scheme /// with the public key group in G1 and signature group in G2. /// 192 byte signatures and 97 byte public keys mod normal { - use amcl_wrapper::{ - constants::{GroupG1_SIZE, GroupG2_SIZE}, - extension_field_gt::GT, - group_elem_g1::G1, - group_elem_g2::G2, - }; - use super::{implementation, implementation::BlsConfiguration}; use crate::Algorithm; - pub type NormalGenerator = G1; - pub type NormalSignatureGroup = G2; - - #[cfg(test)] - pub fn normal_generate( - g: &NormalGenerator, - ) -> (NormalPublicKey, super::implementation::PrivateKey) { - NormalConfiguration::generate(g) - } - #[derive(Debug, Clone, Copy)] pub struct NormalConfiguration; impl BlsConfiguration for NormalConfiguration { const ALGORITHM: Algorithm = Algorithm::BlsNormal; - const PK_SIZE: usize = GroupG1_SIZE; - const SIG_SIZE: usize = GroupG2_SIZE; - type Generator = NormalGenerator; - type SignatureGroup = NormalSignatureGroup; - - fn ate_2_pairing_is_one( - p1: &Self::Generator, - g1: &Self::SignatureGroup, - p2: &Self::Generator, - g2: &Self::SignatureGroup, - ) -> bool { - GT::ate_2_pairing(&-p1, g1, p2, g2).is_one() - } - fn set_pairs((g1, g2): &(Self::Generator, Self::SignatureGroup)) -> (&G1, &G2) { - (g1, g2) - } + type Engine = w3f_bls::ZBLS; - fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&super::PrivateKey> { + fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&NormalPrivateKey> { if let crate::PrivateKey::BlsNormal(key) = private_key { Some(key) } else { @@ -64,9 +35,10 @@ mod normal { } pub type NormalBls = implementation::BlsImpl; - #[cfg(test)] - pub type NormalSignature = implementation::Signature; - pub type NormalPublicKey = implementation::PublicKey; + pub type NormalPublicKey = + w3f_bls::PublicKey<::Engine>; + pub type NormalPrivateKey = + w3f_bls::SecretKeyVT<::Engine>; } /// This version is the small BLS signature scheme @@ -76,49 +48,17 @@ mod normal { /// This results in smaller signatures but slower operations and bigger public key. /// This is good for situations where space is a consideration and verification is infrequent mod small { - use amcl_wrapper::{ - constants::{GroupG1_SIZE, GroupG2_SIZE}, - extension_field_gt::GT, - group_elem_g1::G1, - group_elem_g2::G2, - }; - use super::implementation::{self, BlsConfiguration}; use crate::Algorithm; - pub type SmallGenerator = G2; - pub type SmallSignatureGroup = G1; - - #[cfg(test)] - pub fn small_generate( - g: &SmallGenerator, - ) -> (SmallPublicKey, super::implementation::PrivateKey) { - SmallConfiguration::generate(g) - } - #[derive(Debug, Clone, Copy)] pub struct SmallConfiguration; impl BlsConfiguration for SmallConfiguration { const ALGORITHM: Algorithm = Algorithm::BlsSmall; - const PK_SIZE: usize = GroupG2_SIZE; - const SIG_SIZE: usize = GroupG1_SIZE; - type Generator = SmallGenerator; - type SignatureGroup = SmallSignatureGroup; - fn ate_2_pairing_is_one( - p1: &Self::Generator, - g1: &Self::SignatureGroup, - p2: &Self::Generator, - g2: &Self::SignatureGroup, - ) -> bool { - GT::ate_2_pairing(g1, &-p1, g2, p2).is_one() - } - - fn set_pairs((g2, g1): &(Self::Generator, Self::SignatureGroup)) -> (&G1, &G2) { - (g1, g2) - } + type Engine = w3f_bls::TinyBLS381; - fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&super::PrivateKey> { + fn extract_private_key(private_key: &crate::PrivateKey) -> Option<&SmallPrivateKey> { if let crate::PrivateKey::BlsSmall(key) = private_key { Some(key) } else { @@ -128,10 +68,10 @@ mod small { } pub type SmallBls = implementation::BlsImpl; - #[cfg(test)] - pub type SmallSignature = implementation::Signature; - pub type SmallPublicKey = implementation::PublicKey; + pub type SmallPublicKey = w3f_bls::PublicKey<::Engine>; + pub type SmallPrivateKey = + w3f_bls::SecretKeyVT<::Engine>; } -#[cfg(test)] -mod tests; +// #[cfg(test)] +// mod tests; diff --git a/crypto/src/signature/bls/tests.rs b/crypto/src/signature/bls/tests.rs index 3d187e0af9c..57de7a10dd8 100644 --- a/crypto/src/signature/bls/tests.rs +++ b/crypto/src/signature/bls/tests.rs @@ -1,14 +1,7 @@ -use amcl_wrapper::{ - constants::{GroupG1_SIZE, MODBYTES}, - field_elem::FieldElement, - group_elem::GroupElement, - types_g2::GroupG2_SIZE, -}; - use super::{ - implementation::{BlsConfiguration, BlsImpl, Signature, MESSAGE_CONTEXT}, - normal::{normal_generate, NormalConfiguration, NormalGenerator, NormalSignature}, - small::{small_generate, SmallConfiguration, SmallGenerator, SmallSignature}, + implementation::{BlsConfiguration, BlsImpl, MESSAGE_CONTEXT}, + normal::NormalConfiguration, + small::SmallConfiguration, }; use crate::KeyGenOption; diff --git a/crypto/src/signature/mod.rs b/crypto/src/signature/mod.rs index 337b9ce656d..21e69b6aa9d 100644 --- a/crypto/src/signature/mod.rs +++ b/crypto/src/signature/mod.rs @@ -16,6 +16,8 @@ use alloc::{ vec::Vec, }; use core::marker::PhantomData; +#[cfg(feature = "std")] +use std::collections::btree_set; use derive_more::{Deref, DerefMut}; use iroha_macro::ffi_impl_opaque;