Skip to content

Commit 6db2c69

Browse files
author
Varun Chatterji
committed
Fixes bug in Hash-ML-DSA
1 parent 8edc744 commit 6db2c69

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ml_dsa.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub(crate) fn sign_internal<
190190
h256_xof(&[tr, &[0u8], &[ctx.len().to_le_bytes()[0]], ctx, message])
191191
} else {
192192
// 6c. From HashML-DSA.Sign(): 𝑀′ ← BytesToBits(IntegerToBytes(1,1) ∥ IntegerToBytes(|𝑐𝑡𝑥|,1) ∥ 𝑐𝑡𝑥 ∥ OID ∥ PH𝑀 )
193-
h256_xof(&[tr, &[1u8], &[oid.len().to_le_bytes()[0]], ctx, oid, phm])
193+
h256_xof(&[tr, &[1u8], &[ctx.len().to_le_bytes()[0]], ctx, oid, phm])
194194
};
195195
let mut mu = [0u8; 64];
196196
h6.read(&mut mu);
@@ -391,7 +391,7 @@ pub(crate) fn verify_internal<
391391
h256_xof(&[tr, &[0u8], &[ctx.len().to_le_bytes()[0]], ctx, m])
392392
} else {
393393
// 7c. From HashML-DSA.Verify(): 18: 𝑀′ ← BytesToBits(IntegerToBytes(1,1) ∥ IntegerToBytes(|𝑐𝑡𝑥|,1) ∥ 𝑐𝑡𝑥 ∥ OID ∥ PH𝑀 )
394-
h256_xof(&[tr, &[1u8], &[oid.len().to_le_bytes()[0]], ctx, oid, phm])
394+
h256_xof(&[tr, &[1u8], &[ctx.len().to_le_bytes()[0]], ctx, oid, phm])
395395
};
396396
let mut mu = [0u8; 64];
397397
h7.read(&mut mu);

0 commit comments

Comments
 (0)