X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/8b3d7f307a1f99d461898af5422a960cd8080e72..7280f7f44cfae62f6d34761ac88aa19da7da5dd8:/rijndael-base.h diff --git a/rijndael-base.h b/rijndael-base.h index 1c17fdf..e3f168d 100644 --- a/rijndael-base.h +++ b/rijndael-base.h @@ -1,13 +1,13 @@ /* -*-c-*- * - * $Id: rijndael-base.h,v 1.1 2001/05/07 17:31:37 mdw Exp $ + * $Id: rijndael-base.h,v 1.2 2004/04/08 01:36:15 mdw Exp $ * * Internal header for Rijndael implementation * * (c) 2001 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,26 +15,18 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: rijndael-base.h,v $ - * Revision 1.1 2001/05/07 17:31:37 mdw - * Centralize Rijndael tables and key scheduling. - * - */ - #ifndef CATACOMB_RIJNDAEL_BASE_H #define CATACOMB_RIJNDAEL_BASE_H @@ -65,12 +57,12 @@ extern const octet rijndael_rcon[]; /*----- Handy macros ------------------------------------------------------*/ #define SUB(s, a, b, c, d) \ - (s[U8((a) >> 0)] << 0 | s[U8((b) >> 8)] << 8 | \ - s[U8((c) >> 16)] << 16 | s[U8((d) >> 24)] << 24) + (s[U8((a) >> 24)] << 24 | s[U8((b) >> 16)] << 16 | \ + s[U8((c) >> 8)] << 8 | s[U8((d) >> 0)] << 0) #define MIX(t, a, b, c, d) \ - (t[0][U8((a) >> 0)] ^ t[1][U8((b) >> 8)] ^ \ - t[2][U8((c) >> 16)] ^ t[3][U8((d) >> 24)]) + (t[0][U8((a) >> 24)] ^ t[1][U8((b) >> 16)] ^ \ + t[2][U8((c) >> 8)] ^ t[3][U8((d) >> 0)]) /*----- That's all, folks -------------------------------------------------*/