Merge branch 'fixes'
[u/mdw/catacomb] / rijndael-base.h
index 1c17fdf..f88b2f7 100644 (file)
@@ -1,6 +1,6 @@
 /* -*-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
  *
  * 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 -------------------------------------------------*/