Skip to content

Commit

Permalink
Merge pull request stratum-mining#729 from jakubtrnka/jakubt/handshak…
Browse files Browse the repository at this point in the history
…e-fix

Fix noise-handshake operations order
  • Loading branch information
pavlenex authored Feb 2, 2024
2 parents cd3ab95 + 729cdec commit a8966e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions protocols/v2/noise-sv2/src/cipher_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ where
ad: &[u8],
data: &mut T,
) -> Result<(), aes_gcm::Error> {
self.set_n(self.get_n() + 1);
let n = self.nonce_to_bytes();
self.set_n(self.get_n() + 1);
if let Some(c) = self.get_cipher() {
match c.encrypt(&n, ad, data) {
Ok(_) => Ok(()),
Expand All @@ -63,8 +63,8 @@ where
ad: &[u8],
data: &mut T,
) -> Result<(), aes_gcm::Error> {
self.set_n(self.get_n() + 1);
let n = self.nonce_to_bytes();
self.set_n(self.get_n() + 1);
if let Some(c) = self.get_cipher() {
match c.decrypt(&n, ad, data) {
Ok(_) => Ok(()),
Expand Down

0 comments on commit a8966e4

Please sign in to comment.