Skip to content

Commit

Permalink
Fixes bug in Hash-ML-DSA
Browse files Browse the repository at this point in the history
  • Loading branch information
Varun Chatterji committed Nov 4, 2024
1 parent 8edc744 commit 6db2c69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ml_dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub(crate) fn sign_internal<
h256_xof(&[tr, &[0u8], &[ctx.len().to_le_bytes()[0]], ctx, message])
} else {
// 6c. From HashML-DSA.Sign(): 𝑀′ ← BytesToBits(IntegerToBytes(1,1) ∥ IntegerToBytes(|𝑐𝑡𝑥|,1) ∥ 𝑐𝑡𝑥 ∥ OID ∥ PH𝑀 )
h256_xof(&[tr, &[1u8], &[oid.len().to_le_bytes()[0]], ctx, oid, phm])
h256_xof(&[tr, &[1u8], &[ctx.len().to_le_bytes()[0]], ctx, oid, phm])
};
let mut mu = [0u8; 64];
h6.read(&mut mu);
Expand Down Expand Up @@ -391,7 +391,7 @@ pub(crate) fn verify_internal<
h256_xof(&[tr, &[0u8], &[ctx.len().to_le_bytes()[0]], ctx, m])
} else {
// 7c. From HashML-DSA.Verify(): 18: 𝑀′ ← BytesToBits(IntegerToBytes(1,1) ∥ IntegerToBytes(|𝑐𝑡𝑥|,1) ∥ 𝑐𝑡𝑥 ∥ OID ∥ PH𝑀 )
h256_xof(&[tr, &[1u8], &[oid.len().to_le_bytes()[0]], ctx, oid, phm])
h256_xof(&[tr, &[1u8], &[ctx.len().to_le_bytes()[0]], ctx, oid, phm])
};
let mut mu = [0u8; 64];
h7.read(&mut mu);
Expand Down

0 comments on commit 6db2c69

Please sign in to comment.