#chacha20-poly1305 #chacha20 #aead #poly1305 #cha-cha20-poly1305 #crypto

crypto_api_chachapoly

An implementation of ChaCha20-IETF, Poly1305 and ChachaPoly-IETF for crypto_api

11 releases

0.5.0 Oct 7, 2021
0.4.3 Jul 16, 2020
0.4.2 Dec 9, 2019
0.3.0 Nov 27, 2019
0.1.7 Mar 12, 2019

#907 in Cryptography

Download history 2266/week @ 2024-07-22 1109/week @ 2024-07-29 1483/week @ 2024-08-05 1567/week @ 2024-08-12 1338/week @ 2024-08-19 2054/week @ 2024-08-26 1692/week @ 2024-09-02 2000/week @ 2024-09-09 1616/week @ 2024-09-16 1652/week @ 2024-09-23 1511/week @ 2024-09-30 901/week @ 2024-10-07 1074/week @ 2024-10-14 1176/week @ 2024-10-21 1535/week @ 2024-10-28 1386/week @ 2024-11-04

5,261 downloads per month
Used in 6 crates (4 directly)

BSD-2-Clause OR MIT

51KB
872 lines

docs.rs License BSD-2-Clause License MIT crates.io Download numbers AppVeyor CI dependency status

crypto_api_chachapoly

Welcome to crypto_api_chachapoly 🎉

About

This crate implements the IETF version of ChaCha20, XChaCha20, Poly1305, ChachaPoly-IETF AEAD construction and XChachaPoly.

Security

⚠️ Some words of warning ahead: This library has not been audited yet – use at your own risk! ⚠️

However we try to do things right from the start – this library does not use unsafe Rust, is KISS, tested against various test vectors and uses constant time implementations only.

Test Vectors

All implementations pass all reference test vectors and are assumed to produce correct results even in corner cases. We also use API test vectors (to test input validation) and failure test vectors to test our MAC verification.

Fuzzing Against sodiumoxide

The git repository contains a fuzz-subcrate that generates random inputs and tests if this crate and sodiumoxide produce the same result.

It can be run by cloning the git repo, going into "fuzz/" and running cargo run --release. The crate uses all available CPU threads and stops only if there is an unexpected different result. You can also specify the maximum length if the randomly generated and sized test input; just set TEST_VECTOR_LIMIT as environment variable. If you find an unexpected different result, please copy the entire output and create a new issue on GitHub! 😊

Constant Time Implementations

All implementations are designed to be invulnerable against timing side-channel attacks by performing all secret-dependent computations in constant time:

For more information about constant time implementations, take a look here and here.

Memory Hygiene

crypto_api_chachapoly does not perform any attempts to erase sensitive contents from memory. However all sensitive contents are stored in heap-allocated memory, so if you're using an erasing memory-allocator like MAProper they will be erased nontheless.

Using an erasing memory allocator is a good idea anyway, because Rust makes it pretty hard to keep track on how the memory is managed under the hood – the memory allocator on the other hand sees everything that happens on the heap and can take care of it accordingly.

Dependencies

Because this code implements the crypto_api, it depends on the crypto_api-crate. Otherwise, it's dependency less.

Dependencies