Martin Willi | 31d7247 | 2015-07-16 19:14:00 +0200 | [diff] [blame] | 1 | /* |
| 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 |
| 14 | |
| 15 | struct chacha20_ctx { |
| 16 | u32 key[8]; |
| 17 | }; |
| 18 | |
Eric Biggers | ede5c83 | 2018-09-11 20:05:10 -0700 | [diff] [blame] | 19 | void chacha20_block(u32 *state, u8 *stream); |
Eric Biggers | bc41a67 | 2018-11-16 17:26:18 -0800 | [diff] [blame^] | 20 | void hchacha20_block(const u32 *in, u32 *out); |
| 21 | |
Martin Willi | 31d7247 | 2015-07-16 19:14:00 +0200 | [diff] [blame] | 22 | void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv); |
| 23 | int crypto_chacha20_setkey(struct crypto_tfm *tfm, const u8 *key, |
| 24 | unsigned int keysize); |
| 25 | int crypto_chacha20_crypt(struct blkcipher_desc *desc, struct scatterlist *dst, |
| 26 | struct scatterlist *src, unsigned int nbytes); |
| 27 | |
| 28 | #endif |