Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-cipher: add AAD support to ChaCha20Poly1305 #281

Merged
merged 1 commit into from
Aug 15, 2024

Commits on Aug 15, 2024

  1. ssh-cipher: add AAD support to ChaCha20Poly1305

    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
    tarcieri committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    d83646f View commit details
    Browse the repository at this point in the history