2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2015, Joyent, Inc.
20 * ChaCha cipher implementation header
22 * Note, the chacha C files that we have, have a compile time option for
23 * generating a keystream only. eg. in other words -DKEYSTREAM_ONLY. If using
24 * chacha, for something like arc4random, where you aren't doing encryption,
25 * then you should pass -DKEYSTREAM_ONLY. If encryption is being done, then it
26 * should not be defined. The main difference is basically doing another pass
27 * over the data and xoring it with the generated cipher.
36 typedef struct chacha_ctx
{
37 uint32_t chacha_input
[16];
40 extern void chacha_keysetup(chacha_ctx_t
*, const uint8_t *, uint32_t,
42 extern void chacha_ivsetup(chacha_ctx_t
*, const uint8_t *);
43 extern void chacha_encrypt_bytes(chacha_ctx_t
*, const uint8_t *, uint8_t *,
50 #endif /* _CHACHA_H */