Skip to content

Commit 393c169

Browse files
authored
fix: only increment nonce in valid decrypted msg (#200)
Only increment nonce in valid decrypted msg
1 parent 78921b9 commit 393c169

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/handshakes/abstract-handshake.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export abstract class AbstractHandshake {
2323

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

2828
return { plaintext, valid }
2929
}

0 commit comments

Comments
 (0)