Skip to content

Commit

Permalink
swap message/payload to reflect the doc and follow the convention.
Browse files Browse the repository at this point in the history
Closes #121
  • Loading branch information
tyrchen authored and mcginty committed Nov 3, 2022
1 parent b2b007a commit dd50e62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transportstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ impl TransportState {
/// authentication tag didn't verify.
///
/// Will result in `StateProblem::Exhausted` if the max nonce overflows.
pub fn read_message(&mut self, payload: &[u8], message: &mut [u8]) -> Result<usize, Error> {
pub fn read_message(&mut self, message: &[u8], payload: &mut [u8]) -> Result<usize, Error> {
if self.initiator && self.pattern.is_oneway() {
return Err(StateProblem::OneWay.into());
}
let cipher =
if self.initiator { &mut self.cipherstates.1 } else { &mut self.cipherstates.0 };

cipher.decrypt(payload, message)
cipher.decrypt(message, payload)
}

/// Generate a new key for the egress symmetric cipher according to Section 4.2
Expand Down

0 comments on commit dd50e62

Please sign in to comment.