fix: report an over-long plaintext as MessageTooLong, not DecryptionFailed

This commit is contained in:
2026-11-25 07:48:55 +01:00
parent e0c6d53a99
commit 853f59ca60
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ fn seal_inner(
// ChaCha20-Poly1305 refuses only messages over 2^38 bytes; that is reported, not a panic.
let tag = aead
.encrypt_inout_detached(&nonce, &[VERSION], (&mut out[HEADER_LEN..]).into())
.map_err(|_| Error::DecryptionFailed)?;
.map_err(|_| Error::MessageTooLong)?;
out.extend_from_slice(tag.as_slice());
Ok(out)
}