3 * Copyright (C) 2006,2007
4 * NTT (Nippon Telegraph and Telephone Corporation).
6 * Copyright (C) 2010 Niels Möller
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef NETTLE_CAMELLIA_H_INCLUDED
24 #define NETTLE_CAMELLIA_H_INCLUDED
26 #include "nettle-types.h"
33 #define camellia_set_encrypt_key nettle_camellia_set_encrypt_key
34 #define camellia_set_decrypt_key nettle_camellia_set_decrypt_key
35 #define camellia_invert_key nettle_camellia_invert_key
36 #define camellia_crypt nettle_camellia_crypt
37 #define camellia_crypt nettle_camellia_crypt
39 #define CAMELLIA_BLOCK_SIZE 16
40 /* Valid key sizes are 128, 192 or 256 bits (16, 24 or 32 bytes) */
41 #define CAMELLIA_MIN_KEY_SIZE 16
42 #define CAMELLIA_MAX_KEY_SIZE 32
43 #define CAMELLIA_KEY_SIZE 32
47 /* Number of subkeys. */
50 /* For 128-bit keys, there are 18 regular rounds, pre- and
51 post-whitening, and two FL and FLINV rounds, using a total of 26
52 subkeys, each of 64 bit. For 192- and 256-bit keys, there are 6
53 additional regular rounds and one additional FL and FLINV, using
54 a total of 34 subkeys. */
55 /* The clever combination of subkeys imply one of the pre- and
56 post-whitening keys is folded with the round keys, so that subkey
57 #1 and the last one (#25 or #33) is not used. The result is that
58 we have only 24 or 32 subkeys at the end of key setup. */
63 camellia_set_encrypt_key(struct camellia_ctx
*ctx
,
64 unsigned length
, const uint8_t *key
);
67 camellia_set_decrypt_key(struct camellia_ctx
*ctx
,
68 unsigned length
, const uint8_t *key
);
71 camellia_invert_key(struct camellia_ctx
*dst
,
72 const struct camellia_ctx
*src
);
75 camellia_crypt(const struct camellia_ctx
*ctx
,
76 unsigned length
, uint8_t *dst
,
82 #endif /* NETTLE_CAMELLIA_H_INCLUDED */