Renamed from `rsa-decrypt', since the name was no longer appropriate.
[u/mdw/catacomb] / twofish.h
CommitLineData
8dd8c294 1/* -*-c-*-
2 *
3 * $Id: twofish.h,v 1.1 2000/06/17 12:10:17 mdw Exp $
4 *
5 * The Twofish block cipher
6 *
7 * (c) 2000 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: twofish.h,v $
33 * Revision 1.1 2000/06/17 12:10:17 mdw
34 * New cipher.
35 *
36 */
37
38/*----- Notes on the Twofish block cipher ---------------------------------*
39 *
40 * Twofish was designed by Bruce Schneier, John Kelsey, Doug Whiting, David
41 * Wagner, Chris Hall and Niels Ferguson. The algorithm is unpatented and
42 * free for anyone to use. It is one of the five AES finalist algorithms.
43 * At the time of writing, the AES competition is still underway.
44 *
45 * Twofish is a complex cipher offering various space and time tradeoffs.
46 * This implementation has a heavy key schedule and fast bulk encryption.
47 */
48
49#ifndef CATACOMB_TWOFISH_H
50#define CATACOMB_TWOFISH_H
51
52#ifdef __cplusplus
53 extern "C" {
54#endif
55
56/*----- Header files ------------------------------------------------------*/
57
58#include <stddef.h>
59
60#include <mLib/bits.h>
61
62/*----- Magical numbers ---------------------------------------------------*/
63
64#define TWOFISH_BLKSZ 16
65#define TWOFISH_KEYSZ 32
66#define TWOFISH_CLASS (N, L, 128)
67
68extern const octet twofish_keysz[];
69
70/*----- Data structures ---------------------------------------------------*/
71
72typedef struct twofish_ctx {
73 uint32 k[40];
74 uint32 g[4][256];
75} twofish_ctx;
76
77/*----- Functions provided ------------------------------------------------*/
78
79/* --- @twofish_init@ --- *
80 *
81 * Arguments: @twofish_ctx *k@ = pointer to key block to fill in
82 * @const void *buf@ = pointer to buffer of key material
83 * @size_t sz@ = size of key material
84 *
85 * Returns: ---
86 *
87 * Use: Initializes a Twofish key buffer. Twofish accepts keys of up
88 * to 256 bits in length.
89 */
90
91extern void twofish_init(twofish_ctx */*k*/,
92 const void */*buf*/, size_t /*sz*/);
93
94/* --- @twofish_eblk@, @twofish_dblk@ --- *
95 *
96 * Arguments: @const twofish_ctx *k@ = pointer to key block
97 * @const uint32 s[4]@ = pointer to source block
98 * @uint32 d[4]@ = pointer to destination block
99 *
100 * Returns: ---
101 *
102 * Use: Low-level block encryption and decryption.
103 */
104
105extern void twofish_eblk(const twofish_ctx */*k*/,
106 const uint32 */*s*/, uint32 */*d*/);
107
108extern void twofish_dblk(const twofish_ctx */*k*/,
109 const uint32 */*s*/, uint32 */*d*/);
110
111/*----- That's all, folks -------------------------------------------------*/
112
113#ifdef __cplusplus
114 }
115#endif
116
117#endif