xref: /freebsd/sys/crypto/chacha20/chacha.h (revision 0957b409)
1 /* $OpenBSD: chacha.h,v 1.4 2016/08/27 04:04:56 guenther Exp $ */
2 
3 /*
4 chacha-merged.c version 20080118
5 D. J. Bernstein
6 Public domain.
7 
8  $FreeBSD$
9 */
10 
11 #ifndef CHACHA_H
12 #define CHACHA_H
13 
14 #include <sys/types.h>
15 #include <crypto/chacha20/_chacha.h>
16 
17 #define CHACHA_MINKEYLEN 	16
18 #define CHACHA_NONCELEN		8
19 #define CHACHA_CTRLEN		8
20 #define CHACHA_STATELEN		(CHACHA_NONCELEN+CHACHA_CTRLEN)
21 #define CHACHA_BLOCKLEN		64
22 
23 #ifdef CHACHA_EMBED
24 #define LOCAL static
25 #else
26 #define LOCAL
27 #endif
28 
29 LOCAL void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits);
30 LOCAL void chacha_ivsetup(struct chacha_ctx *x, const u_char *iv, const u_char *ctr);
31 LOCAL void chacha_encrypt_bytes(struct chacha_ctx *x, const u_char *m,
32     u_char *c, u_int bytes);
33 
34 #endif	/* CHACHA_H */
35 
36