OLD | NEW |
| (Empty) |
1 /* | |
2 * Chacha stream algorithm. | |
3 * | |
4 * Created on: Jun, 2013 | |
5 * Author: Elie Bursztein (elieb@google.com) | |
6 * | |
7 * Adapted from the estream code by D. Bernstein. | |
8 */ | |
9 /* ==================================================================== | |
10 * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. | |
11 * | |
12 * Redistribution and use in source and binary forms, with or without | |
13 * modification, are permitted provided that the following conditions | |
14 * are met: | |
15 * | |
16 * 1. Redistributions of source code must retain the above copyright | |
17 * notice, this list of conditions and the following disclaimer. | |
18 * | |
19 * 2. Redistributions in binary form must reproduce the above copyright | |
20 * notice, this list of conditions and the following disclaimer in | |
21 * the documentation and/or other materials provided with the | |
22 * distribution. | |
23 * | |
24 * 3. All advertising materials mentioning features or use of this | |
25 * software must display the following acknowledgment: | |
26 * "This product includes software developed by the OpenSSL Project | |
27 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | |
28 * | |
29 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | |
30 * endorse or promote products derived from this software without | |
31 * prior written permission. For written permission, please contact | |
32 * licensing@OpenSSL.org. | |
33 * | |
34 * 5. Products derived from this software may not be called "OpenSSL" | |
35 * nor may "OpenSSL" appear in their names without prior written | |
36 * permission of the OpenSSL Project. | |
37 * | |
38 * 6. Redistributions of any form whatsoever must retain the following | |
39 * acknowledgment: | |
40 * "This product includes software developed by the OpenSSL Project | |
41 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | |
42 * | |
43 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | |
44 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
46 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | |
47 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
49 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
50 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
52 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
53 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
54 * OF THE POSSIBILITY OF SUCH DAMAGE. | |
55 * ==================================================================== | |
56 */ | |
57 #ifndef HEADER_CHACHA_H | |
58 #define HEADER_CHACHA_H | |
59 | |
60 #include <openssl/opensslconf.h> | |
61 | |
62 #if defined(OPENSSL_NO_CHACHA) | |
63 #error ChaCha support is disabled. | |
64 #endif | |
65 | |
66 #include <stddef.h> | |
67 | |
68 #ifdef __cplusplus | |
69 extern "C" { | |
70 #endif | |
71 | |
72 /* CRYPTO_chacha_20 encrypts |in_len| bytes from |in| with the given key and | |
73 * nonce and writes the result to |out|, which may be equal to |in|. The | |
74 * initial block counter is specified by |counter|. */ | |
75 void CRYPTO_chacha_20(unsigned char *out, | |
76 const unsigned char *in, size_t in_len, | |
77 const unsigned char key[32], | |
78 const unsigned char nonce[8], | |
79 size_t counter); | |
80 | |
81 #ifdef __cplusplus | |
82 } | |
83 #endif | |
84 | |
85 #endif | |
OLD | NEW |