Crates.io | crypto_api_chachapoly |
lib.rs | crypto_api_chachapoly |
version | 0.5.0 |
source | src |
created_at | 2019-03-12 18:06:20.546165 |
updated_at | 2021-10-07 18:26:06.27063 |
description | An implementation of ChaCha20-IETF, Poly1305 and ChachaPoly-IETF for `crypto_api` |
homepage | |
repository | https://github.com/KizzyCode/crypto_api_chachapoly |
max_upload_size | |
id | 120315 |
size | 132,027 |
Welcome to crypto_api_chachapoly
🎉
This crate implements the IETF version of ChaCha20, XChaCha20, Poly1305, ChachaPoly-IETF AEAD construction and XChachaPoly.
⚠️ 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.
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.
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! 😊
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.
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.
Because this code implements the crypto_api
, it depends
on the crypto_api
-crate. Otherwise, it's dependency less.