-
Notifications
You must be signed in to change notification settings - Fork 10
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
c-split vulnerability fixes #34
Conversation
What do you think about if for development mode instead of using we would use safe primes but shorter so they are quicker to sample? So instead of 2048 bits we would sample 512 etc bits. If we use safe primes, then it is also simpler to ensure that h1 (and correspondingly h2) are quadratic residues by taking square of randomly sampled value mod p*q. Then, we can also ensure that ord(h1) = (p-1)/2 * (q-1)/2. If it seems good than can implement the changes. |
@ivokub I think it's worth trying.
Yeah, this is what CGGMP20 does when generating the ring-Pedersen parameters ( However, for |
I started doing it, but its a bit more involved than I anticipated. There are a few parameters and verifiers in the protocols also check that the values are in some expected ranges. Will continue on it.
Yes, I think the prover also has to give the proof for the order of |
On a second thought - I'm not sure we need to show |
Suggested edit: diff --git a/multi-party-ecdsa/src/utilities/zk_composite_dlog.rs b/multi-party-ecdsa/src/utilities/zk_composite_dlog.rs
index f69f39a..7a8e21a 100644
--- a/multi-party-ecdsa/src/utilities/zk_composite_dlog.rs
+++ b/multi-party-ecdsa/src/utilities/zk_composite_dlog.rs
@@ -94,13 +94,11 @@ fn compute_challenges(
// Parses challenge bits.
let mut challenge_bits = [ChallengeBit::ZERO; STAT_SECURITY];
for (idx, byte) in challenge_bytes.iter().enumerate() {
- // We're only looking for non-zero bits (i.e. 1)
- // since the rest are already set to zero by default.
- let bits = format!("{byte:08b}");
- for (i, char) in bits.chars().enumerate() {
- if char == '1' {
- challenge_bits[idx * 8 + i] = ChallengeBit::ONE;
- }
+ for i in 0..8 {
+ challenge_bits[idx * 8 + i] = match (byte & (1 << i)) > 0 {
+ false => ChallengeBit::ZERO,
+ true => ChallengeBit::ONE,
+ };
}
}
|
Thanks, incorporated but slightly modified to preserve the bit order and to skip leading and trailing zero bits |
@ivokub Shouldn't Jacobi symbol of |
@ivokub For PI-prm, sure ... |
I'm a bit lost - do we still need Pointcheval's proof anywhere after implementing DLNProof/PI-prm? |
Sorry, we don't 🙂 See here, I thought the motivation for checking quadratic residues was for the possibility of initializing Pointcheval's proof securely, which you seemed to confirm in the next comment 🙂 For PI-prm, I think we can simply follow section 6.4.1 when generating |
Oh yes, I guess it was just a confusion. Yup, we don't need Jacobi symbol and it is sufficient to follow 6.4.1 (i.e. sample random tau and take h1=tau^2). In that case, I would say I'm good with the PR. I would still try to have different configurations for parameters depending if in test/dev mode (and using safe primes everywhere for compatibility), but I will do it in a separate PR. It would impact different places and makes reading this PR more difficult. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@drewstone This should be good enough to merge, other stuff (see Ivo's suggestions above) can be addressed in subsequent PRs. |
Merged @davidsemakula @ivokub awesome work! |
Summary of changes
Fixes c-split vulnerability
Changes introduced in this pull request:
See this comment (and preceding thread) for more details.
NOTE: This is the same proof that ring-Pedersen parameters parameter ($\tilde N$ , $s$ , $t$ ) are generated correctly in CGGMP20. However, I'm not confident the existing similar proof in the FS-DKR crate isn't using ambiguous encoding for the commitment data, so I opted to implement this instead using merlin for the Fiat-Shamir transformation.
Reference issue to close (if applicable)
Closes #23