3 * The twofish block cipher.
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2001 Niels Möller
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,
27 * Twofish is a 128-bit block cipher that accepts a variable-length
28 * key up to 256 bits, designed by Bruce Schneier and others. See
29 * http://www.counterpane.com/twofish.html for details.
32 #ifndef NETTLE_TWOFISH_H_INCLUDED
33 #define NETTLE_TWOFISH_H_INCLUDED
35 #include "nettle-types.h"
42 #define twofish_set_key nettle_twofish_set_key
43 #define twofish_encrypt nettle_twofish_encrypt
44 #define twofish_decrypt nettle_twofish_decrypt
46 #define TWOFISH_BLOCK_SIZE 16
48 /* Variable key size between 128 and 256 bits. But the only valid
49 * values are 16 (128 bits), 24 (192 bits) and 32 (256 bits). */
50 #define TWOFISH_MIN_KEY_SIZE 16
51 #define TWOFISH_MAX_KEY_SIZE 32
53 #define TWOFISH_KEY_SIZE 32
58 uint32_t s_box
[4][256];
62 twofish_set_key(struct twofish_ctx
*ctx
,
63 unsigned length
, const uint8_t *key
);
66 twofish_encrypt(const struct twofish_ctx
*ctx
,
67 unsigned length
, uint8_t *dst
,
70 twofish_decrypt(const struct twofish_ctx
*ctx
,
71 unsigned length
, uint8_t *dst
,
78 #endif /* NETTLE_TWOFISH_H_INCLUDED */