blob: 445fc45f4b5b26abe2c631b64053c948e11f43e4 [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
Ard Biesheuvel9ae433b2016-12-09 14:33:51 +00008#include <crypto/skcipher.h>
Martin Willi31d72472015-07-16 19:14:00 +02009#include <linux/types.h>
10#include <linux/crypto.h>
11
12#define CHACHA20_IV_SIZE 16
13#define CHACHA20_KEY_SIZE 32
14#define CHACHA20_BLOCK_SIZE 64
15
16struct chacha20_ctx {
17 u32 key[8];
18};
19
Theodore Ts'oe192be92016-06-12 18:13:36 -040020void chacha20_block(u32 *state, void *stream);
Martin Willi31d72472015-07-16 19:14:00 +020021void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv);
Ard Biesheuvel9ae433b2016-12-09 14:33:51 +000022int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
Martin Willi31d72472015-07-16 19:14:00 +020023 unsigned int keysize);
Ard Biesheuvel9ae433b2016-12-09 14:33:51 +000024int crypto_chacha20_crypt(struct skcipher_request *req);
Martin Willi31d72472015-07-16 19:14:00 +020025
26#endif