chacha20.h 638 B

12345678910111213141516171819202122232425262728
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Common values for the ChaCha20 algorithm
  4. */
  5. #ifndef _CRYPTO_CHACHA20_H
  6. #define _CRYPTO_CHACHA20_H
  7. #include <crypto/skcipher.h>
  8. #include <linux/types.h>
  9. #include <linux/crypto.h>
  10. #define CHACHA20_IV_SIZE 16
  11. #define CHACHA20_KEY_SIZE 32
  12. #define CHACHA20_BLOCK_SIZE 64
  13. struct chacha20_ctx {
  14. u32 key[8];
  15. };
  16. void chacha20_block(u32 *state, u8 *stream);
  17. void crypto_chacha20_init(u32 *state, struct chacha20_ctx *ctx, u8 *iv);
  18. int crypto_chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key,
  19. unsigned int keysize);
  20. int crypto_chacha20_crypt(struct skcipher_request *req);
  21. #endif