refactor EncryptedStream::reset
This commit is contained in:
parent
d5dc6f1350
commit
6d05935d20
1 changed files with 5 additions and 5 deletions
10
src/lib.rs
10
src/lib.rs
|
|
@ -65,7 +65,10 @@ impl EncryptedStream {
|
||||||
self.socket.shutdown(how)
|
self.socket.shutdown(how)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(&mut self, next_nonce: [u32; 3]) {
|
pub fn reset(&mut self, next_nonce_bytes: [u8; 12]) {
|
||||||
|
let mut next_nonce = [0u32; 3];
|
||||||
|
u8_to_u32(&mut next_nonce, &next_nonce_bytes);
|
||||||
|
|
||||||
self.block.reset(next_nonce)
|
self.block.reset(next_nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,10 +79,7 @@ impl EncryptedStream {
|
||||||
return Err(IO(err));
|
return Err(IO(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut nonce = [0u32; 3];
|
self.reset(nonce_bytes);
|
||||||
u8_to_u32(&mut nonce, &nonce_bytes);
|
|
||||||
|
|
||||||
self.block.reset(nonce);
|
|
||||||
|
|
||||||
let poly_key = self.block.get_bytes();
|
let poly_key = self.block.get_bytes();
|
||||||
self.block.advance();
|
self.block.advance();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue