Skip to content

Commit

Permalink
fix: only increment nonce in valid decrypted msg (#200)
Browse files Browse the repository at this point in the history
Only increment nonce in valid decrypted msg
  • Loading branch information
wemeetagain committed Aug 19, 2022
1 parent 78921b9 commit 393c169
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/handshakes/abstract-handshake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export abstract class AbstractHandshake {

public decryptWithAd (cs: CipherState, ad: Uint8Array, ciphertext: Uint8Array): {plaintext: bytes, valid: boolean} {
const { plaintext, valid } = this.decrypt(cs.k, cs.n, ad, ciphertext)
cs.n.increment()
if (valid) cs.n.increment()

return { plaintext, valid }
}
Expand Down

0 comments on commit 393c169

Please sign in to comment.