Skip to content

Commit

Permalink
prg: Fix a bug in convert()
Browse files Browse the repository at this point in the history
Previously we were generating a correction word that was only partially
pseudorandom. In particular, the last element of the vector (the counter
value in Mastic) was set to `0`. This allows an attacker to easily
deduce if a given prefix is on path or off path.
  • Loading branch information
cjpatton committed Jan 31, 2024
1 parent 11e6f2c commit 19a8320
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl PrgSeed {
s.fill_bytes(&mut out.seed.key);
unsafe {
let sp = s_in.as_ptr();
for i in 0..input_len {
out.word[i].from_rng(&mut *sp);
for x in out.word.iter_mut() {
x.from_rng(&mut *sp);
}
}
});
Expand Down

0 comments on commit 19a8320

Please sign in to comment.