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

Updates for CGGMP'24 #170

Merged
merged 23 commits into from
Feb 11, 2025
Merged

Updates for CGGMP'24 #170

merged 23 commits into from
Feb 11, 2025

Conversation

fjarri
Copy link
Member

@fjarri fjarri commented Dec 17, 2024

Fixes #157
Fixes #43
Fixes #91

  • Updated paper references in PAPER.md, removed obsolete items.
  • Updated to the new range definition (±2^l now means [-2^(l-1)+1, 2^(l-1)] instead of the previous [-2^l, 2^l]). This caused a bit of a chain reaction:
    • SecretSigned::assert_exponent_range() logic changed.
    • SecretSigned::random_in_exp_range*() logic changed, and also exp was changed to exponent to match the assertion name.
    • PublicSigned::from_xof_reader_bounded() changed its behavior to produce the number according to the new range definition, and was renamed to from_xof_reader_in_range().
    • PublicSigned::in_range_bits() changed its behavior according to the new range definition, and was renamed to is_in_exponent_range().
    • Wherever scalars are passed to proofs and Ciphertext constructor they are passed as SecretSigned, to comply with the range requirements in the proofs.
    • conversions::secret_unsigned_from_scalar() removed.
    • Added SecretSigned::new_modulo() constructor to make a signed number in range [-N/2, N/2] from an Uint in range [0, N).
    • Removed Ciphertext::new() and decrypt() (which took unsigned plaintexts), renamed new_signed() and decrypt_signed() to new() and decrypt().
    • Ciphertext::new_with_randomizer() was renamed to new_with_randomizer_unsigned(), since it's now a special one, only used in P_mul. Renamed new_with_randomizer_signed() to new_with_randomizer(), and new_public_with_randomizer_signed() to new_public_with_randomizer().
  • Following that, wherever in the paper e <-- ±q is used, we are sampling the challenge as a Scalar using the new Scalar::from_xof_reader() method (and using that in П^sch as well).
  • Updated paper references and notation in aff-g proof.
  • Updated paper references in prm proof, and started using BitVec for its commitment.
  • Updated dec proof (there were significant changes). Temporarily, it is located in dec_new.rs, will be moved to dec.rs when Presigning is updated.
  • Added elog proof.
  • Added enc-elg proof.
  • Added aff-g* proof.
  • Updated paper references and notation in fac proof, and implemented necessary changes to the algorithm (some variables are calculated differently, and the challenge is now a signed Uint and not a Scalar)
  • Updated paper references and notation in mod proof, and enforced invertibility conditions that were added in '24
  • Updated paper references and notation sch proof
  • Removed enc, log*, mul, mul* proofs - they are not used anymore.
  • Encapsulated the invertibility check in an IsInvertible trait, documenting the choice between GCD and invert()
  • Updated KeyInit and filled in the code for evidence generation/checking. In particular, fixed Self-contained proof of malicious behavior for Round 3 of KeyGen #103 (by using an echo broadcast in Round 2). Also fixed Should key shares have a non-zero scalar type? #5 - we now check that the shares add up to a non-zero scalar.
  • Updated KeyRefresh to the new version and filled in the code for evidence generation/checking.
  • Updated Presigning/Signing to the new version
  • Updated AuxGen to the new version
  • Renamed ProductionParameters to ProductionParameters112 (since they correspond to 112 bits of security)

Unsolved problems:

@fjarri fjarri self-assigned this Dec 17, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 96.90768% with 139 lines in your changes missing coverage. Please review.

Project coverage is 95.39%. Comparing base (a3bbfc6) to head (c9ea427).

Files with missing lines Patch % Lines
synedrion/src/www02/key_resharing.rs 30.55% 25 Missing ⚠️
synedrion/src/cggmp21/entities.rs 80.00% 17 Missing ⚠️
synedrion/src/cggmp21/key_refresh.rs 98.49% 9 Missing ⚠️
synedrion/src/tools/protocol_shortcuts.rs 89.02% 9 Missing ⚠️
synedrion/src/cggmp21/interactive_signing_tests.rs 98.76% 8 Missing ⚠️
synedrion/src/cggmp21/sigma/aff_g_star.rs 96.51% 7 Missing ⚠️
synedrion/src/paillier/encryption.rs 92.78% 7 Missing ⚠️
synedrion/src/tools/protocol_shortcuts_dev.rs 95.59% 7 Missing ⚠️
synedrion/src/cggmp21/aux_gen.rs 98.43% 6 Missing ⚠️
synedrion/src/cggmp21/key_init.rs 97.51% 6 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #170      +/-   ##
==========================================
+ Coverage   92.46%   95.39%   +2.93%     
==========================================
  Files          35       38       +3     
  Lines        7030    10170    +3140     
==========================================
+ Hits         6500     9702    +3202     
+ Misses        530      468      -62     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fjarri fjarri force-pushed the new-cggmp branch 10 times, most recently from 12afc7a to e0565ce Compare December 25, 2024 21:04
@fjarri fjarri force-pushed the new-cggmp branch 2 times, most recently from cdb7c84 to 0ca10d8 Compare December 31, 2024 22:56
@fjarri fjarri force-pushed the new-cggmp branch 2 times, most recently from 0fc38fb to 235afa0 Compare January 3, 2025 22:51
@fjarri fjarri force-pushed the new-cggmp branch 9 times, most recently from 3efcfd4 to 0f86f18 Compare January 10, 2025 02:47
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

I have looked at Key_init and Key_refresh tests only.

As mentioned I think it's very cool to see the fault injection machinery come together, it's going to be a major help. The code is verbose and repetitive at times, but this is a complex protocol and its tests are always going to reflect that complexity.
Having the right testing tools is about finding that delicate balance between readability&maintainability and expressiveness. I'm sure we'll fiddle with this plenty mroe in the future but this strikes me as much better than we had before.

synedrion/src/cggmp21/key_init_tests.rs Show resolved Hide resolved
synedrion/src/cggmp21/key_init_tests.rs Show resolved Hide resolved
synedrion/src/cggmp21/key_init_tests.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/key_refresh_tests.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/key_refresh_tests.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts_dev.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts_dev.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts_dev.rs Outdated Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts_dev.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/key_init_tests.rs Show resolved Hide resolved
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Reviewed aux_gen.rs and entities.rs (I'm half-way through interactive_signing.rs but pheew, that one is intense...)

synedrion/src/cggmp21/sigma/mod_.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/sigma/mod_.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/aux_gen.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/entities.rs Show resolved Hide resolved
synedrion/src/cggmp21/entities.rs Outdated Show resolved Hide resolved
synedrion/src/cggmp21/entities.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Reviewed tools/

synedrion/src/tools/secret.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts.rs Show resolved Hide resolved
synedrion/src/tools/protocol_shortcuts.rs Show resolved Hide resolved
synedrion/src/tools/bitvec.rs Show resolved Hide resolved
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Reviewing this update with any actual accuracy sort of boils down to auditing large parts CGGMP which is not something I can actually do. That said I have done my best to check that the overall structure looks sane and I have done a few deep-dives comparing the code with the paper(s).
I think it's ready to be merged, or rather: reviwing it further adds little value. FWIW I am delighted to see the much expanded test suite.

synedrion/src/tools/protocol_shortcuts.rs Show resolved Hide resolved
synedrion/src/paillier/rsa.rs Show resolved Hide resolved
synedrion/src/paillier/encryption.rs Outdated Show resolved Hide resolved
synedrion/src/paillier/encryption.rs Show resolved Hide resolved
synedrion/src/paillier/encryption.rs Show resolved Hide resolved

/// Returns ``true`` if the parameters satisfy a set of inequalities
/// required for them to be used for the CGGMP scheme.
fn are_self_consistent() -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think is_ is more correct, as in "is this (one) set of params self-consistent"? Alternatively just drop the verb and call it self_consistent() -> bool.

synedrion/src/cggmp21/key_refresh.rs Show resolved Hide resolved
synedrion/src/cggmp21/key_refresh.rs Show resolved Hide resolved
synedrion/src/cggmp21/key_refresh.rs Show resolved Hide resolved
@fjarri fjarri merged commit b20121d into entropyxyz:master Feb 11, 2025
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.