Skip to content

Add XChaCha20-Poly1305 AEAD. #411

@briansmith

Description

@briansmith

Implement XChaCha20-Poly1305 using the IETF construction only, as done here.

This is blocked on us finding (or writing) a clear security analysis of the XChaCha20-Poly1305 construct. In particular, how safe is it to use a randomly-generated nonce with XChaCha20-Poly1305? To what extent should a XChaCha20-Poly1305 nonce include non-random components? Should we suggest that users construct the nonce with some substructure that reduces the dependency on the PRNG being secure, analogous to IETF Fixed+Counter construct at https://tools.ietf.org/html/rfc5116#section-3.2?

I believe that the same feature was was added in libsodium in jedisct1/libsodium#461. In particular, see crypto_aead_xchacha20poly1305_ietf_encrypt_detached and crypto_aead_xchacha20poly1305_ietf_decrypt_detached. We should use the test vectors from that patch to verify that we interop with libsodium. Note that libsodium also implements the non-IETF DJBian construction of ChaCha20-Poly1305 and XChaCha20-Poly1305, but I explicitly do not want to support that construction, only the IETF construction. See jedisct1/libsodium#462 for some context regarding what libsodium decided to do. See also codahale/chacha20#4.

Besides implementing the construct and adding the test vectors, we might also consider updating the ring::aead API documentation to give clear advice about when to use the XChaCha20 construct.

The ring code currently relies on the fact that nonces for all currently-supported AEADs are 96 bits, so the existing code would need to be refactored to remove that assumption in a separate commit before the XChaCha20-Poly1305 code is added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions