Fix build error and set version 2.7.1
[platform/upstream/nettle.git] / cast128.h
1 /* cast128.h
2  *
3  * The CAST-128 block cipher.
4  */
5
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
10  */
11
12 /* nettle, low-level cryptographics library
13  *
14  * Copyright (C) 2001 Niels Möller
15  *  
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.
20  * 
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.
25  * 
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.
30  */
31  
32 #ifndef NETTLE_CAST128_H_INCLUDED
33 #define NETTLE_CAST128_H_INCLUDED
34
35 #include "nettle-types.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
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
45
46 #define CAST128_BLOCK_SIZE 8
47
48 /* Variable key size between 40 and 128. */
49 #define CAST128_MIN_KEY_SIZE 5
50 #define CAST128_MAX_KEY_SIZE 16
51
52 #define CAST128_KEY_SIZE 16
53
54 struct cast128_ctx
55 {
56   uint32_t keys[32];  /* Key, after expansion */
57   unsigned rounds;    /* Number of rounds to use, 12 or 16 */
58 };
59
60 void
61 cast128_set_key(struct cast128_ctx *ctx,
62                 unsigned length, const uint8_t *key);
63
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);
72
73 #ifdef __cplusplus
74 }
75 #endif
76
77 #endif /* NETTLE_CAST128_H_INCLUDED */