Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / serpent.h
blob340104296bd3359d8994e5f26fecc771f5e29234
1 /* serpent.h
3 * The serpent block cipher.
4 */
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2001 Niels Möller
9 *
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02111-1301, USA.
26 /* Serpent is a 128-bit block cipher that accepts a key size of 256
27 * bits, designed by Ross Anderson, Eli Biham, and Lars Knudsen. See
28 * http://www.cl.cam.ac.uk/~rja14/serpent.html for details.
31 #ifndef NETTLE_SERPENT_H_INCLUDED
32 #define NETTLE_SERPENT_H_INCLUDED
34 #include "nettle-types.h"
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
40 /* Name mangling */
41 #define serpent_set_key nettle_serpent_set_key
42 #define serpent_encrypt nettle_serpent_encrypt
43 #define serpent_decrypt nettle_serpent_decrypt
45 #define SERPENT_BLOCK_SIZE 16
47 /* Other key lengths are possible, but the design of Serpent makes
48 * smaller key lengths quite pointless; they cheated with the AES
49 * requirements, using a 256-bit key length exclusively and just
50 * padding it out if the desired key length was less, so there really
51 * is no advantage to using key lengths less than 256 bits. */
52 #define SERPENT_KEY_SIZE 32
54 /* Allow keys of size 128 <= bits <= 256 */
56 #define SERPENT_MIN_KEY_SIZE 16
57 #define SERPENT_MAX_KEY_SIZE 32
59 struct serpent_ctx
61 uint32_t keys[33][4]; /* key schedule */
64 void
65 serpent_set_key(struct serpent_ctx *ctx,
66 unsigned length, const uint8_t *key);
68 void
69 serpent_encrypt(const struct serpent_ctx *ctx,
70 unsigned length, uint8_t *dst,
71 const uint8_t *src);
72 void
73 serpent_decrypt(const struct serpent_ctx *ctx,
74 unsigned length, uint8_t *dst,
75 const uint8_t *src);
77 #ifdef __cplusplus
79 #endif
81 #endif /* NETTLE_SERPENT_H_INCLUDED */