openssl: update to 1.0.2d
[tomato.git] / release / src / router / nettle / cast128.h
blobd10ec6027c86e502325252d7ba1d06bed5d6df6b
1 /* cast128.h
3 * The CAST-128 block cipher.
4 */
6 /* CAST-128 in C
7 * Written by Steve Reid <sreid@sea-to-sky.net>
8 * 100% Public Domain - no warranty
9 * Released 1997.10.11
12 /* nettle, low-level cryptographics library
14 * Copyright (C) 2001 Niels Möller
16 * The nettle library is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU Lesser General Public License as published by
18 * the Free Software Foundation; either version 2.1 of the License, or (at your
19 * option) any later version.
21 * The nettle library is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
24 * License for more details.
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with the nettle library; see the file COPYING.LIB. If not, write to
28 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29 * MA 02111-1301, USA.
32 #ifndef NETTLE_CAST128_H_INCLUDED
33 #define NETTLE_CAST128_H_INCLUDED
35 #include "nettle-types.h"
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 /* Name mangling */
42 #define cast128_set_key nettle_cast128_set_key
43 #define cast128_encrypt nettle_cast128_encrypt
44 #define cast128_decrypt nettle_cast128_decrypt
46 #define CAST128_BLOCK_SIZE 8
48 /* Variable key size between 40 and 128. */
49 #define CAST128_MIN_KEY_SIZE 5
50 #define CAST128_MAX_KEY_SIZE 16
52 #define CAST128_KEY_SIZE 16
54 struct cast128_ctx
56 uint32_t keys[32]; /* Key, after expansion */
57 unsigned rounds; /* Number of rounds to use, 12 or 16 */
60 void
61 cast128_set_key(struct cast128_ctx *ctx,
62 unsigned length, const uint8_t *key);
64 void
65 cast128_encrypt(const struct cast128_ctx *ctx,
66 unsigned length, uint8_t *dst,
67 const uint8_t *src);
68 void
69 cast128_decrypt(const struct cast128_ctx *ctx,
70 unsigned length, uint8_t *dst,
71 const uint8_t *src);
73 #ifdef __cplusplus
75 #endif
77 #endif /* NETTLE_CAST128_H_INCLUDED */