Skip to content

Commit

Permalink
fix: sample sign bit for Pi-Fac challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokub committed Jan 31, 2024
1 parent b4a3c66 commit cd89fc2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tss-core/src/zkproof/fac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,13 @@ impl PiFacProof {
.append_message(b"PiFacCommitment", &bincode::serialize(&cmt)?);
let mut challenge_bytes = [0u8; SEC_BYTES];
transcript.challenge_bytes(b"PiFacChallenge", &mut challenge_bytes);
let e = BigInt::from_bytes(&challenge_bytes);
// TODO: also sample the sign bit?
let mut e = BigInt::from_bytes(&challenge_bytes);
let mut challenge_sign_byte = [0u8; 1];
transcript
.challenge_bytes(b"PiFacChallengeSign", &mut challenge_sign_byte);
if challenge_sign_byte[0] % 2 == 0 {
e = -e;
}

let sigmahat = &sigma.sub(&nu.mul(&witness.p));

Expand Down Expand Up @@ -223,7 +228,13 @@ impl PiFacProof {
);
let mut challenge_bytes = [0u8; SEC_BYTES];
transcript.challenge_bytes(b"PiFacChallenge", &mut challenge_bytes);
let e = BigInt::from_bytes(&challenge_bytes);
let mut e = BigInt::from_bytes(&challenge_bytes);
let mut challenge_sign_byte = [0u8; 1];
transcript
.challenge_bytes(b"PiFacChallengeSign", &mut challenge_sign_byte);
if challenge_sign_byte[0] % 2 == 0 {
e = -e;
}
// TODO: also sample the sign bit?

let R = BigInt::mod_mul(
Expand Down

0 comments on commit cd89fc2

Please sign in to comment.