8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / common / crypto / chacha / chacha.h
blobac9993a8a4ccee5ba9ad343563c519ec1e2d20a7
1 /*
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
5 * 1.0 of the CDDL.
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.
16 #ifndef _CHACHA_H
17 #define _CHACHA_H
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.
30 #include <inttypes.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 typedef struct chacha_ctx {
37 uint32_t chacha_input[16];
38 } chacha_ctx_t;
40 extern void chacha_keysetup(chacha_ctx_t *, const uint8_t *, uint32_t,
41 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 *,
44 uint32_t);
46 #ifdef __cplusplus
48 #endif
50 #endif /* _CHACHA_H */