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

Add Chacha20 cipher, and poly1305 mac #72

Closed
wants to merge 3 commits into from
Closed

Conversation

hannesm
Copy link
Member

@hannesm hannesm commented Jun 26, 2020

Differences include:

  • OCaml API (no separate expand and encrypt/decrypt),
  • support for IETF mode (nonce 12 bytes, counter 32bit)
  • reduced allocation overhead

@hannesm hannesm changed the title Add Chacha20 cipher, based on @abeaumont ocaml-chacha implementation Add Chacha20 cipher, and poly1305 mac Jun 26, 2020
@hannesm
Copy link
Member Author

hannesm commented Jun 26, 2020

A second commit adds the poly1305 mac. Another extension (AEAD construction of poy1305/chacha20) is on its way. I'm curious about feedback in respect to the 1305 interface.

NB: manually ensured that 598fd89 compiles (and test run) fine on a 32bit switch.

@hannesm
Copy link
Member Author

hannesm commented Jun 26, 2020

that's it, again ensured manually that 036c143 compiles and works on a 32bit switch.

Differences include:
 - OCaml API (no separate expand and encrypt/decrypt),
 - support for IETF mode (nonce 12 bytes, counter 32bit)
 - reduced allocation overhead
This mostly fits into a hash algorithm, but only computes a mac. The
difference is that val empty has a key argument to initialize the context.

This is based on https://github.com/floodyberry/poly1305-donna.git
Copy link
Member

@dinosaure dinosaure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redo my approval with changes.

@hannesm hannesm closed this Jun 29, 2020
@hannesm hannesm deleted the chacha branch June 29, 2020 11:12
hannesm added a commit to hannesm/opam-repository that referenced this pull request Jul 2, 2020
…mirage-crypto-rng-mirage (0.8.1)

CHANGES:

* Add Chacha20 implementation (based on abeaumont/ocaml-chacha), supporting
  both DJB's original specification (nonce 64 bit, counter 64 bit) and IETF
  (RFC 8439: nonce 96 bit, counter 32 bit)
  (mirage/mirage-crypto#72 @hannesm)
* Add Poly1305 implementation based on floodyberry/poly1305-donna (mirage/mirage-crypto#72 @hannesm)
* Unified AEAD module type, implemented by CCM, GCM, and Chacha20/Poly1305
  The functions "authenticate_encrypt" and "authenticate_decrypt" are defined,
  which append (encrypt) and check equality (decrypt, using Eqaf for
  constant-time comparison) the authentication tag directly.
  Breaking changes:
  - GCM "~iv" is now "~nonce"
  - GCM encrypt returns the encrypted data and authentication tag appended
  - GCM decrypt returns the plaintext as option (None on authentication failure)
  (mirage/mirage-crypto#73 @hannesm)
avsm pushed a commit to avsm/mirage-crypto that referenced this pull request Jul 14, 2020
Add Chacha20 cipher, and poly1305 mac
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.

None yet

2 participants