Fixed package group
[platform/upstream/nettle.git] / arctwo.h
1 /* arctwo.h
2  *
3  * The arctwo/rfc2268 block cipher.
4  */
5
6 /* nettle, low-level cryptographics library
7  *
8  * Copyright (C) 2004 Simon Josefsson
9  * Copyright (C) 2002, 2004 Niels Möller
10  *
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.
15  *
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.
20  *
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.
25  */
26
27 #ifndef NETTLE_ARCTWO_H_INCLUDED
28 #define NETTLE_ARCTWO_H_INCLUDED
29
30 #include "nettle-types.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /* Name mangling */
37 #define arctwo_set_key nettle_arctwo_set_key
38 #define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
39 #define arctwo_encrypt nettle_arctwo_encrypt
40 #define arctwo_decrypt nettle_arctwo_decrypt
41 #define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
42
43 #define ARCTWO_BLOCK_SIZE 8
44
45 /* Variable key size from 1 byte to 128 bytes. */
46 #define ARCTWO_MIN_KEY_SIZE 1
47 #define ARCTWO_MAX_KEY_SIZE 128
48
49 #define ARCTWO_KEY_SIZE 8
50
51 struct arctwo_ctx
52 {
53   uint16_t S[64];
54 };
55
56 /* Key expansion function that takes the "effective key bits", 1-1024,
57    as an explicit argument. 0 means maximum key bits. */
58 void
59 arctwo_set_key_ekb (struct arctwo_ctx *ctx,
60                     unsigned length, const uint8_t * key, unsigned ekb);
61
62 /* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
63 void
64 arctwo_set_key (struct arctwo_ctx *ctx, unsigned length, const uint8_t *key);
65
66 /* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
67 void
68 arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
69                         unsigned length, const uint8_t *key);
70
71 void
72 arctwo_encrypt (struct arctwo_ctx *ctx,
73                 unsigned length, uint8_t *dst, const uint8_t *src);
74 void
75 arctwo_decrypt (struct arctwo_ctx *ctx,
76                 unsigned length, uint8_t *dst, const uint8_t *src);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /* NETTLE_ARCTWO_H_INCLUDED */