xref: /freebsd/sys/crypto/chacha20/chacha.h (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
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 #ifdef CHACHA_NONCE0_CTR128
30 #define CHACHA_UNUSED __unused
31 #else
32 #define CHACHA_UNUSED
33 #endif
34 
35 LOCAL void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits);
36 LOCAL void chacha_ivsetup(struct chacha_ctx *x, const u_char *iv CHACHA_UNUSED,
37     const u_char *ctr);
38 LOCAL void chacha_encrypt_bytes(struct chacha_ctx *x, const u_char *m,
39     u_char *c, u_int bytes);
40 
41 #undef CHACHA_UNUSED
42 
43 #endif	/* CHACHA_H */
44 
45