Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / salsa20.h
blobbe2662cf1c069bd553c6f9ee02142052af95978e
1 /* salsa20.h
3 * The Salsa20 stream cipher.
4 */
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2012 Simon Josefsson
9 * Copyright (C) 2001 Niels Möller
11 * The nettle library is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or (at your
14 * option) any later version.
16 * The nettle library is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19 * License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with the nettle library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 * MA 02111-1301, USA.
27 #ifndef NETTLE_SALSA20_H_INCLUDED
28 #define NETTLE_SALSA20_H_INCLUDED
30 #include "nettle-types.h"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /* Name mangling */
37 #define salsa20_set_key nettle_salsa20_set_key
38 #define salsa20_set_iv nettle_salsa20_set_iv
39 #define salsa20_crypt nettle_salsa20_crypt
40 #define _salsa20_core _nettle_salsa20_core
42 #define salsa20r12_crypt nettle_salsa20r12_crypt
44 /* Minimum and maximum keysizes, and a reasonable default. In
45 * octets.*/
46 #define SALSA20_MIN_KEY_SIZE 16
47 #define SALSA20_MAX_KEY_SIZE 32
48 #define SALSA20_KEY_SIZE 32
49 #define SALSA20_BLOCK_SIZE 64
51 #define SALSA20_IV_SIZE 8
53 #define _SALSA20_INPUT_LENGTH 16
55 struct salsa20_ctx
57 /* Indices 1-4 and 11-14 holds the key (two identical copies for the
58 shorter key size), indices 0, 5, 10, 15 are constant, indices 6, 7
59 are the IV, and indices 8, 9 are the block counter:
61 C K K K
62 K C I I
63 B B C K
64 K K K C
66 uint32_t input[_SALSA20_INPUT_LENGTH];
69 void
70 salsa20_set_key(struct salsa20_ctx *ctx,
71 unsigned length, const uint8_t *key);
73 void
74 salsa20_set_iv(struct salsa20_ctx *ctx, const uint8_t *iv);
76 void
77 salsa20_crypt(struct salsa20_ctx *ctx,
78 unsigned length, uint8_t *dst,
79 const uint8_t *src);
81 void
82 salsa20r12_crypt(struct salsa20_ctx *ctx,
83 unsigned length, uint8_t *dst,
84 const uint8_t *src);
86 void
87 _salsa20_core(uint32_t *dst, const uint32_t *src, unsigned rounds);
89 #ifdef __cplusplus
91 #endif
93 #endif /* NETTLE_SALSA20_H_INCLUDED */