blob: 254298b1f3c1d2b25562ed7d64f73287fbd42d05 [file] [log] [blame]
Martin Willi31d72472015-07-16 19:14:00 +02001/*
2 * Common values for the ChaCha20 algorithm
3 */
4
5#ifndef _CRYPTO_CHACHA20_H
6#define _CRYPTO_CHACHA20_H
7
8#include <linux/types.h>
9#include <linux/crypto.h>
10
11#define CHACHA20_IV_SIZE 16
12#define CHACHA20_KEY_SIZE 32
13#define CHACHA20_BLOCK_SIZE 64
Eric Biggers12b2fb032017-11-22 11:51:39 -080014#define CHACHA20_BLOCK_WORDS (CHACHA20_BLOCK_SIZE / sizeof(u32))
Martin Willi31d72472015-07-16 19:14:00 +020015
16struct chacha20_ctx {
17 u32 key[8];
18};
19
Eric Biggers12b2fb032017-11-22 11:51:39 -080020void chacha20_block(u32 *state, u32 *stream);
Martin Willi31d72472015-07-16 19:14:00 +020021void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv);
22int crypto_chacha20_setkey(struct crypto_tfm *tfm, const u8 *key,
23 unsigned int keysize);
24int crypto_chacha20_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
25 struct scatterlist *src, unsigned int nbytes);
26
27#endif