-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh-cipher: add AAD support to
ChaCha20Poly1305
(#281)
From PROTOCOL.chacha20poly1305: Once the entire packet has been received, the MAC MUST be checked before decryption. A per-packet Poly1305 key is generated as described above and the MAC tag calculated using Poly1305 with this key over the ciphertext of the packet length and the payload together. This adds an `aad_len` parameter which decomposes the input buffer into a portion to be only authenticated (in packet encryption, this is used for a 4-byte encrypted length header), which comes prior to the portion to be encrypted. Ideally we could implement the `AeadInPlace` trait, however this approach has been used instead because the protocol uses unpadded Poly1305, where we don't support buffered input and it must be computed from a single contiguous slice using `Poly1305::compute_unpadded`. Closes #279
- Loading branch information
Showing
4 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters