/* -*-c-*-
*
- * $Id: square.c,v 1.2 2001/05/07 15:44:02 mdw Exp $
+ * $Id: square.c,v 1.3 2004/04/08 01:36:15 mdw Exp $
*
* The Square block cipher
*
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* 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: square.c,v $
- * Revision 1.2 2001/05/07 15:44:02 mdw
- * Simplify implementation.
- *
- * Revision 1.1 2000/07/15 20:51:58 mdw
- * New block cipher.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <assert.h>
for (i = 0; i < nr * 4; i++) {
uint32 w = kk[i];
- k->w[i] = (U[0][U8(w >> 0)] ^ U[1][U8(w >> 8)] ^
+ k->w[i] = (U[0][U8(w >> 0)] ^ U[1][U8(w >> 8)] ^
U[2][U8(w >> 16)] ^ U[3][U8(w >> 24)]);
}
for (; i < nw; i++)
*/
#define SUB(s, sh, a, b, c, d) \
- (s[U8((a) >> sh)] << 0 | s[U8((b) >> sh)] << 8 | \
+ (s[U8((a) >> sh)] << 0 | s[U8((b) >> sh)] << 8 | \
s[U8((c) >> sh)] << 16 | s[U8((d) >> sh)] << 24)
#define MIX(t, sh, a, b, c, d) \
t[2][U8((c) >> sh)] ^ t[3][U8((d) >> sh)])
#define DO(what, t, aa, bb, cc, dd, a, b, c, d, w) do { \
- aa = what(t, 0, a, b, c, d) ^ *w++; \
- bb = what(t, 8, a, b, c, d) ^ *w++; \
+ aa = what(t, 0, a, b, c, d) ^ *w++; \
+ bb = what(t, 8, a, b, c, d) ^ *w++; \
cc = what(t, 16, a, b, c, d) ^ *w++; \
dd = what(t, 24, a, b, c, d) ^ *w++; \
} while (0)