Skip to content

Commit

Permalink
Apply domain separation in the right order
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneider-bensch committed Oct 1, 2024
1 parent 5b86dc3 commit 5c3fc21
Show file tree
Hide file tree
Showing 8 changed files with 1,803 additions and 1,803 deletions.
4 changes: 2 additions & 2 deletions libcrux-ml-dsa/src/ml_dsa_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ pub(crate) fn generate_key_pair<
// 128 = SEED_FOR_A_SIZE + SEED_FOR_ERROR_VECTORS_SIZE + SEED_FOR_SIGNING_SIZE
let mut seed_expanded = [0; 128];
let mut shake = Shake256Absorb::new();
shake.absorb(&[ROWS_IN_A as u8, COLUMNS_IN_A as u8]);
let mut shake = shake.absorb_final(&randomness);
shake.absorb(&randomness);
let mut shake = shake.absorb_final(&[ROWS_IN_A as u8, COLUMNS_IN_A as u8]);
shake.squeeze(&mut seed_expanded);

let (seed_for_a, seed_expanded) = seed_expanded.split_at(SEED_FOR_A_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion libcrux-ml-dsa/tests/kats/dilithium.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def _unpack_sig(self, sig_bytes):
def keygen(self):
# Random seed (with domain separation)
zeta = self.random_bytes(32)
domain_separated_zeta = self.k.to_bytes(1, "little") + self.l.to_bytes(1, "little") + zeta
domain_separated_zeta = zeta + self.k.to_bytes(1, "little") + self.l.to_bytes(1, "little")
self.keygen_seed = zeta
# Expand with an XOF (SHAKE256)
seed_bytes = self._h(domain_separated_zeta, 128)
Expand Down
600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats-44.json

Large diffs are not rendered by default.

600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats-65.json

Large diffs are not rendered by default.

600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats-87.json

Large diffs are not rendered by default.

600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats_pre_hashed-44.json

Large diffs are not rendered by default.

600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats_pre_hashed-65.json

Large diffs are not rendered by default.

600 changes: 300 additions & 300 deletions libcrux-ml-dsa/tests/kats/nistkats_pre_hashed-87.json

Large diffs are not rendered by default.

0 comments on commit 5c3fc21

Please sign in to comment.