Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unambiguous encoding #65

Merged
merged 9 commits into from
Nov 22, 2023
Merged

Unambiguous encoding #65

merged 9 commits into from
Nov 22, 2023

Conversation

survived
Copy link
Contributor

@survived survived commented Nov 3, 2023

Note: CI is currently failing because of patched deps which will be resolved when LFDT-Lockness/generic-ec#10 and LFDT-Lockness/udigest#1 are merged.

Copy link

github-actions bot commented Nov 3, 2023

Crate direct deps

Direct deps
digest v0.10.6
futures v0.3.24
generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
hex v0.4.3
paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#17212a3b)
rand_chacha v0.3.1
rand_core v0.6.4
round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#f626f96e)
serde v1.0.188
serde_with v2.3.3
sha2 v0.10.6
thiserror v1.0.48
udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)

Compared to base branch

Diff
--- direct-deps-base	2023-11-03 11:14:05.042387325 +0000
+++ direct-deps-pr	2023-11-03 11:14:08.694452378 +0000
@@ -3,2 +3,2 @@
-generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#8ada3181)
-generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#8ada3181)
+generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
+generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
@@ -11 +10,0 @@
-serde_json v1.0.107
@@ -14,0 +14 @@
+udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)

All deps

cargo tree
cggmp21 v0.0.0 (/home/runner/work/cggmp21/cggmp21/pr_branch/cggmp21)
├── digest v0.10.6
│   ├── block-buffer v0.10.3
│   │   └── generic-array v0.14.6
│   │       ├── serde v1.0.188
│   │       │   └── serde_derive v1.0.188 (proc-macro)
│   │       │       ├── proc-macro2 v1.0.66
│   │       │       │   └── unicode-ident v1.0.4
│   │       │       ├── quote v1.0.33
│   │       │       │   └── proc-macro2 v1.0.66 (*)
│   │       │       └── syn v2.0.32
│   │       │           ├── proc-macro2 v1.0.66 (*)
│   │       │           ├── quote v1.0.33 (*)
│   │       │           └── unicode-ident v1.0.4
│   │       └── typenum v1.15.0
│   └── crypto-common v0.1.6
│       ├── generic-array v0.14.6 (*)
│       └── typenum v1.15.0
├── futures v0.3.24
│   ├── futures-channel v0.3.24
│   │   ├── futures-core v0.3.24
│   │   └── futures-sink v0.3.24
│   ├── futures-core v0.3.24
│   ├── futures-executor v0.3.24
│   │   ├── futures-core v0.3.24
│   │   ├── futures-task v0.3.24
│   │   └── futures-util v0.3.24
│   │       ├── futures-channel v0.3.24 (*)
│   │       ├── futures-core v0.3.24
│   │       ├── futures-io v0.3.24
│   │       ├── futures-macro v0.3.24 (proc-macro)
│   │       │   ├── proc-macro2 v1.0.66 (*)
│   │       │   ├── quote v1.0.33 (*)
│   │       │   └── syn v1.0.101
│   │       │       ├── proc-macro2 v1.0.66 (*)
│   │       │       ├── quote v1.0.33 (*)
│   │       │       └── unicode-ident v1.0.4
│   │       ├── futures-sink v0.3.24
│   │       ├── futures-task v0.3.24
│   │       ├── memchr v2.5.0
│   │       ├── pin-project-lite v0.2.9
│   │       ├── pin-utils v0.1.0
│   │       └── slab v0.4.7
│   ├── futures-io v0.3.24
│   ├── futures-sink v0.3.24
│   ├── futures-task v0.3.24
│   └── futures-util v0.3.24 (*)
├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
│   ├── generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
│   │   ├── generic-array v0.14.6 (*)
│   │   ├── rand_core v0.6.4
│   │   ├── serde v1.0.188 (*)
│   │   ├── subtle v2.4.1
│   │   └── zeroize v1.6.0
│   │       └── zeroize_derive v1.3.2 (proc-macro)
│   │           ├── proc-macro2 v1.0.66 (*)
│   │           ├── quote v1.0.33 (*)
│   │           ├── syn v1.0.101 (*)
│   │           └── synstructure v0.12.6
│   │               ├── proc-macro2 v1.0.66 (*)
│   │               ├── quote v1.0.33 (*)
│   │               ├── syn v1.0.101 (*)
│   │               └── unicode-xid v0.2.4
│   ├── getrandom v0.2.10
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.148
│   ├── hex v0.4.3
│   │   └── serde v1.0.188 (*)
│   ├── phantom-type v0.4.2
│   │   └── educe v0.4.19 (proc-macro)
│   │       ├── enum-ordinalize v3.1.11 (proc-macro)
│   │       │   ├── num-bigint v0.4.3
│   │       │   │   ├── num-integer v0.1.45
│   │       │   │   │   └── num-traits v0.2.15
│   │       │   │   └── num-traits v0.2.15
│   │       │   ├── num-traits v0.2.15
│   │       │   ├── proc-macro2 v1.0.66 (*)
│   │       │   ├── quote v1.0.33 (*)
│   │       │   └── syn v1.0.101 (*)
│   │       ├── proc-macro2 v1.0.66 (*)
│   │       ├── quote v1.0.33 (*)
│   │       └── syn v1.0.101 (*)
│   ├── rand_core v0.6.4
│   ├── serde v1.0.188 (*)
│   ├── serde_with v2.3.3
│   │   ├── serde v1.0.188 (*)
│   │   └── serde_with_macros v2.3.3 (proc-macro)
│   │       ├── darling v0.20.1
│   │       │   ├── darling_core v0.20.1
│   │       │   │   ├── fnv v1.0.7
│   │       │   │   ├── ident_case v1.0.1
│   │       │   │   ├── proc-macro2 v1.0.66 (*)
│   │       │   │   ├── quote v1.0.33 (*)
│   │       │   │   ├── strsim v0.10.0
│   │       │   │   └── syn v2.0.32 (*)
│   │       │   └── darling_macro v0.20.1 (proc-macro)
│   │       │       ├── darling_core v0.20.1 (*)
│   │       │       ├── quote v1.0.33 (*)
│   │       │       └── syn v2.0.32 (*)
│   │       ├── proc-macro2 v1.0.66 (*)
│   │       ├── quote v1.0.33 (*)
│   │       └── syn v2.0.32 (*)
│   ├── subtle v2.4.1
│   ├── udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)
│   │   ├── digest v0.10.6 (*)
│   │   └── udigest-derive v0.1.0 (proc-macro) (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)
│   │       ├── proc-macro2 v1.0.66 (*)
│   │       ├── quote v1.0.33 (*)
│   │       └── syn v2.0.32 (*)
│   └── zeroize v1.6.0 (*)
├── generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
│   ├── generic-array v0.14.6 (*)
│   ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf) (*)
│   ├── rand_core v0.6.4
│   ├── serde v1.0.188 (*)
│   ├── subtle v2.4.1
│   └── udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7) (*)
├── hex v0.4.3 (*)
├── paillier-zk v0.1.0 (https://github.com/dfns-labs/paillier-zk?branch=m#17212a3b)
│   ├── digest v0.10.6 (*)
│   ├── fast-paillier v0.1.0 (https://github.com/dfns-labs/fast-paillier?branch=m#b44b00a0)
│   │   ├── bytemuck v1.13.1
│   │   │   └── bytemuck_derive v1.4.1 (proc-macro)
│   │   │       ├── proc-macro2 v1.0.66 (*)
│   │   │       ├── quote v1.0.33 (*)
│   │   │       └── syn v2.0.32 (*)
│   │   ├── rand_core v0.6.4
│   │   ├── rug v1.21.0
│   │   │   ├── az v1.2.1
│   │   │   ├── gmp-mpfr-sys v1.6.1
│   │   │   │   └── libc v0.2.148
│   │   │   ├── libc v0.2.148
│   │   │   └── serde v1.0.188 (*)
│   │   ├── serde v1.0.188 (*)
│   │   └── thiserror v1.0.48
│   │       └── thiserror-impl v1.0.48 (proc-macro)
│   │           ├── proc-macro2 v1.0.66 (*)
│   │           ├── quote v1.0.33 (*)
│   │           └── syn v2.0.32 (*)
│   ├── generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=m#8ada3181)
│   │   ├── generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#8ada3181)
│   │   │   ├── generic-array v0.14.6 (*)
│   │   │   ├── rand_core v0.6.4
│   │   │   ├── serde v1.0.188 (*)
│   │   │   ├── subtle v2.4.1
│   │   │   └── zeroize v1.6.0 (*)
│   │   ├── getrandom v0.2.10 (*)
│   │   ├── hex v0.4.3 (*)
│   │   ├── phantom-type v0.4.2 (*)
│   │   ├── rand_core v0.6.4
│   │   ├── serde v1.0.188 (*)
│   │   ├── serde_with v2.3.3 (*)
│   │   ├── subtle v2.4.1
│   │   └── zeroize v1.6.0 (*)
│   ├── rand_core v0.6.4
│   ├── rug v1.21.0 (*)
│   ├── serde v1.0.188 (*)
│   ├── serde_with v3.0.0
│   │   ├── serde v1.0.188 (*)
│   │   └── serde_with_macros v3.0.0 (proc-macro)
│   │       ├── darling v0.20.1 (*)
│   │       ├── proc-macro2 v1.0.66 (*)
│   │       ├── quote v1.0.33 (*)
│   │       └── syn v2.0.32 (*)
│   └── thiserror v1.0.48 (*)
├── rand_chacha v0.3.1
│   ├── ppv-lite86 v0.2.17
│   └── rand_core v0.6.4
├── rand_core v0.6.4
├── round-based v0.2.0 (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#f626f96e)
│   ├── async-stream v0.3.3
│   │   ├── async-stream-impl v0.3.3 (proc-macro)
│   │   │   ├── proc-macro2 v1.0.66 (*)
│   │   │   ├── quote v1.0.33 (*)
│   │   │   └── syn v1.0.101 (*)
│   │   └── futures-core v0.3.24
│   ├── bincode v1.3.3
│   │   └── serde v1.0.188 (*)
│   ├── futures v0.3.24 (*)
│   ├── never v0.1.0
│   ├── phantom-type v0.3.1
│   │   └── educe v0.4.19 (proc-macro) (*)
│   ├── round-based-derive v0.1.0 (proc-macro) (https://github.com/Zengo-X/round-based-protocol?branch=round-based2#f626f96e)
│   │   ├── proc-macro2 v1.0.66 (*)
│   │   ├── quote v1.0.33 (*)
│   │   └── syn v1.0.101 (*)
│   ├── serde v1.0.188 (*)
│   ├── thiserror v1.0.48 (*)
│   ├── tokio v1.21.2
│   │   └── pin-project-lite v0.2.9
│   ├── tokio-stream v0.1.10
│   │   ├── futures-core v0.3.24
│   │   ├── pin-project-lite v0.2.9
│   │   ├── tokio v1.21.2 (*)
│   │   └── tokio-util v0.7.4
│   │       ├── bytes v1.2.1
│   │       ├── futures-core v0.3.24
│   │       ├── futures-sink v0.3.24
│   │       ├── pin-project-lite v0.2.9
│   │       └── tokio v1.21.2 (*)
│   └── tracing v0.1.36
│       ├── cfg-if v1.0.0
│       ├── pin-project-lite v0.2.9
│       ├── tracing-attributes v0.1.22 (proc-macro)
│       │   ├── proc-macro2 v1.0.66 (*)
│       │   ├── quote v1.0.33 (*)
│       │   └── syn v1.0.101 (*)
│       └── tracing-core v0.1.29
│           └── once_cell v1.17.0
├── serde v1.0.188 (*)
├── serde_with v2.3.3 (*)
├── sha2 v0.10.6
│   ├── cfg-if v1.0.0
│   ├── cpufeatures v0.2.5
│   └── digest v0.10.6 (*)
├── thiserror v1.0.48 (*)
└── udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7) (*)

Compared to base branch

Diff
--- all-deps-base	2023-11-03 11:14:05.234390787 +0000
+++ all-deps-pr	2023-11-03 11:14:08.870455497 +0000
@@ -30,0 +31 @@
+generic-ec v0.0.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
@@ -32 +33,2 @@
-generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=m#8ada3181)
+generic-ec-core v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
+generic-ec-zkp v0.1.0 (https://github.com/dfns-labs/generic-ec?branch=udigest#158ae9bf)
@@ -37 +38,0 @@
-itoa v1.0.4
@@ -58 +58,0 @@
-ryu v1.0.11
@@ -61 +60,0 @@
-serde_json v1.0.107
@@ -81,0 +81,2 @@
+udigest v0.1.0 (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)
+udigest-derive v0.1.0 (proc-macro) (https://github.com/dfns-labs/udigest?branch=version-0#0b5f41b7)

@survived survived marked this pull request as ready for review November 3, 2023 11:22
Comment on lines +154 to +159
let tag = |j| {
udigest::Tag::<D>::new_structured(Tag::Indexed {
party_index: j,
sid,
})
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also include n to match how we hashed round2 message previously?

Copy link
Contributor Author

@survived survived Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't bring much value, but it'll make it look a bit weird that this is the only place we include n to the tag, so I'll leave it as is

@OrestisAlpos
Copy link
Contributor

The changes seem logical and consistent to me.
Since the changes concern encoding of fields, hashing, etc., I think tests are ideal to give us confidence on their correctness. @survived I guess all the changes are covered in tests, right?

@survived
Copy link
Contributor Author

@OrestisAlpos We have tests in udigest library that test that encoding is correct. In cggmp21, we have only e2e tests that ensure that keygen/signing still works correctly

@survived survived merged commit da1e92a into m Nov 22, 2023
4 checks passed
@survived survived deleted the unambiguous-encoding branch November 22, 2023 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants