mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-26 15:01:31 +00:00
core/crypto/noise: Reject encrypt/decrypt when n == 2^64 - 1
Spec defines the maximal value of `n` as reserved.
This commit is contained in:
@@ -217,7 +217,7 @@ cipherstate_encrypt_with_ad :: proc(self: ^Cipher_State, ad, plaintext, dst: []b
|
||||
}
|
||||
_encrypt(&self.ctx, self.n, ad, plaintext, dst)
|
||||
self.n += 1
|
||||
if self.n == 0 {
|
||||
if self.n == max(u64) {
|
||||
self.n_exhausted = true
|
||||
}
|
||||
} else {
|
||||
@@ -249,7 +249,7 @@ cipherstate_decrypt_with_ad :: proc(self: ^Cipher_State, ad, ciphertext, dst: []
|
||||
return nil, status
|
||||
}
|
||||
self.n += 1
|
||||
if self.n == 0 {
|
||||
if self.n == max(u64) {
|
||||
self.n_exhausted = true
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user