Fixed critical issue
This commit is contained in:
parent
6c406867c3
commit
b7e05e5766
1 changed files with 5 additions and 3 deletions
|
@ -111,10 +111,11 @@ impl Ratchet {
|
|||
return Err("Skipped to many keys");
|
||||
}
|
||||
match self.ckr {
|
||||
Some(d) => {
|
||||
Some(mut d) => {
|
||||
while self.nr < until {
|
||||
let (ckr, mk) = kdf_ck(&d);
|
||||
self.ckr = Some(ckr);
|
||||
d = ckr;
|
||||
self.mkskipped.insert((self.dhr.unwrap().to_string().as_bytes().to_vec(), self.nr), mk);
|
||||
self.nr += 1
|
||||
}
|
||||
|
@ -372,10 +373,11 @@ impl RatchetEncHeader {
|
|||
if self.nr + MAX_SKIP < until {
|
||||
return Err("Skipping went wrong")
|
||||
}
|
||||
if let Some(d) = self.ckr {
|
||||
if let Some(mut d) = self.ckr {
|
||||
while self.nr < until {
|
||||
let (ckr, mk) = kdf_ck(&d);
|
||||
self.ckr = Some(ckr);
|
||||
d = ckr;
|
||||
self.mkskipped.insert((self.hkr, self.nr), mk);
|
||||
self.nr += 1
|
||||
}
|
||||
|
@ -444,4 +446,4 @@ impl RatchetEncHeader {
|
|||
let ex: ExRatchetEncHeader = bincode::deserialize(inp).unwrap();
|
||||
RatchetEncHeader::from(&ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue