chacha20.h 595 B

12345678910111213141516171819202122232425
  1. /*
  2. * Common values for the ChaCha20 algorithm
  3. */
  4. #ifndef _CRYPTO_CHACHA20_H
  5. #define _CRYPTO_CHACHA20_H
  6. #include <linux/types.h>
  7. #include <linux/crypto.h>
  8. #define CHACHA20_IV_SIZE 16
  9. #define CHACHA20_KEY_SIZE 32
  10. #define CHACHA20_BLOCK_SIZE 64
  11. struct chacha20_ctx {
  12. u32 key[8];
  13. };
  14. void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv);
  15. int crypto_chacha20_setkey(struct crypto_tfm *tfm, const u8 *key,
  16. unsigned int keysize);
  17. int crypto_chacha20_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
  18. struct scatterlist *src, unsigned int nbytes);
  19. #endif