diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-23 16:25:18 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-12-23 21:09:23 +0100 |
commit | 23fcffe5a6731591c0611f56f920d6d29184337d (patch) | |
tree | c68b92313b27b334ee3650f4a573fbb8d91a7c53 /src/crypto/chacha20poly1305.h | |
parent | 2dea6b0f8353ddaaf0925614c58bcf9a45d68ae5 (diff) |
cookies: use xchacha20poly1305 instead of chacha20poly1305
This allows us to precompute the blake2s calls and save cycles, since
hchacha is fast.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/chacha20poly1305.h')
-rw-r--r-- | src/crypto/chacha20poly1305.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/crypto/chacha20poly1305.h b/src/crypto/chacha20poly1305.h index 2ae9ff5..068995a 100644 --- a/src/crypto/chacha20poly1305.h +++ b/src/crypto/chacha20poly1305.h @@ -8,6 +8,7 @@ struct scatterlist; enum chacha20poly1305_lengths { + XCHACHA20POLY1305_NONCELEN = 24, CHACHA20POLY1305_KEYLEN = 32, CHACHA20POLY1305_AUTHTAGLEN = 16 }; @@ -31,6 +32,16 @@ bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *sr const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN]); +bool xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, + const u8 *ad, const size_t ad_len, + const u8 nonce[XCHACHA20POLY1305_NONCELEN], + const u8 key[CHACHA20POLY1305_KEYLEN]); + +bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, + const u8 *ad, const size_t ad_len, + const u8 nonce[XCHACHA20POLY1305_NONCELEN], + const u8 key[CHACHA20POLY1305_KEYLEN]); + #ifdef CONFIG_X86_64 #include <linux/version.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) |