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 9 #ifndef CHACHA_H 10 #define CHACHA_H 11 12 #include <sys/types.h> 13 14 #include "_chacha.h" 15 16 #define CHACHA_MINKEYLEN 16 17 #define CHACHA_NONCELEN 8 18 #define CHACHA_CTRLEN 8 19 #define CHACHA_STATELEN (CHACHA_NONCELEN + CHACHA_CTRLEN) 20 #define CHACHA_BLOCKLEN 64 21 22 #ifdef CHACHA_EMBED 23 #define LOCAL static 24 #else 25 #define LOCAL 26 #endif 27 28 LOCAL void chacha_keysetup(struct chacha_ctx *x, const uint8_t *k, 29 uint32_t kbits); 30 LOCAL void chacha_ivsetup(struct chacha_ctx *x, const uint8_t *iv, 31 const uint8_t *counter); 32 LOCAL void chacha_encrypt_bytes(struct chacha_ctx *x, const uint8_t *m, 33 uint8_t *c, uint32_t bytes); 34 35 #ifdef CHACHA_NONCE0_CTR128 36 LOCAL void chacha_ctrsave(const struct chacha_ctx *x, uint8_t *counter) 37 __unused; /* maybe unused */ 38 #endif 39 40 #endif /* CHACHA_H */ 41