math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / symm / rijndael-base.h
CommitLineData
8b3d7f30 1/* -*-c-*-
2 *
8b3d7f30 3 * Internal header for Rijndael implementation
4 *
5 * (c) 2001 Straylight/Edgeware
6 */
7
45c0fd36 8/*----- Licensing notice --------------------------------------------------*
8b3d7f30 9 *
10 * This file is part of Catacomb.
11 *
12 * Catacomb is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
45c0fd36 16 *
8b3d7f30 17 * Catacomb is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
45c0fd36 21 *
8b3d7f30 22 * You should have received a copy of the GNU Library General Public
23 * License along with Catacomb; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25 * MA 02111-1307, USA.
26 */
27
8b3d7f30 28#ifndef CATACOMB_RIJNDAEL_BASE_H
29#define CATACOMB_RIJNDAEL_BASE_H
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
35/*----- Header files ------------------------------------------------------*/
36
37#include <mLib/bits.h>
38
39/*----- Constant tables ---------------------------------------------------*/
40
41extern const octet rijndael_s[256];
42extern const octet rijndael_si[256];
43extern const uint32 rijndael_t[4][256];
44extern const uint32 rijndael_ti[4][256];
45extern const uint32 rijndael_u[4][256];
46extern const octet rijndael_rcon[];
47
48#define S rijndael_s
49#define SI rijndael_si
50#define T rijndael_t
51#define TI rijndael_ti
52#define U rijndael_u
53#define RCON rijndael_rcon
54
55/*----- Handy macros ------------------------------------------------------*/
56
57#define SUB(s, a, b, c, d) \
38333dc2 58 (s[U8((a) >> 24)] << 24 | s[U8((b) >> 16)] << 16 | \
45c0fd36 59 s[U8((c) >> 8)] << 8 | s[U8((d) >> 0)] << 0)
8b3d7f30 60
61#define MIX(t, a, b, c, d) \
38333dc2
MW
62 (t[0][U8((a) >> 24)] ^ t[1][U8((b) >> 16)] ^ \
63 t[2][U8((c) >> 8)] ^ t[3][U8((d) >> 0)])
8b3d7f30 64
65/*----- That's all, folks -------------------------------------------------*/
66
67#ifdef __cplusplus
68 }
69#endif
70
71#endif