Skip to content

Conversation

@tarcieri
Copy link
Member

@tarcieri tarcieri commented Aug 19, 2019

This makes some API changes based on my experience using this crate to implement the ChaCha20Poly1305 AEAD:

RustCrypto/AEADs#3

  • Add Poly1305::input_padded() function which pads the input to Poly1305's block size: this is used in several places for both Salsa20Poly1305 and ChaCha20Poly1305 (26c8c12)
  • Make output a MacResult - Poly1305's main use cases are effectively as a MAC and the main thing you want to do with a tag is a constant time comparison, so leveraging MacResult for this makes sense (98cf577)

Add a function for inputting data into Poly1305 which is padded to its
block size, a.k.a. the `pad16()` function from RFC 8439.

This is useful for implementing authenticated encryption constructions
using Salsa20 family ciphers (i.e. Salsa20Poly1305, ChaCha20Poly1305)
which is the main use case for Poly1305 to begin with.
This outsources constant time comparisons to `MacResult`, so downstream
crates don't need to rely on additional crates to perform them beyond
what `MacResult` is already using.
@tarcieri tarcieri merged commit 2bbb4fd into master Aug 19, 2019
@tarcieri tarcieri deleted the poly1305/fixups-for-salsa20-aead branch August 19, 2019 18:01
@tarcieri tarcieri mentioned this pull request Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants