/* -*-c-*-
*
- * $Id: rijndael-mktab.c,v 1.1 2000/06/17 11:56:07 mdw Exp $
+ * $Id: rijndael-mktab.c,v 1.3 2000/10/14 17:13:19 mdw Exp $
*
* Build precomputed tables for the Rijndael block cipher
*
/*----- Revision history --------------------------------------------------*
*
* $Log: rijndael-mktab.c,v $
+ * Revision 1.3 2000/10/14 17:13:19 mdw
+ * Fix some compile errors.
+ *
+ * Revision 1.2 2000/06/18 23:12:15 mdw
+ * Change typesetting of Galois Field names.
+ *
* Revision 1.1 2000/06/17 11:56:07 mdw
* New cipher.
*
/* --- @mul@ --- *
*
- * Arguments: @unsigned x, y@ = polynomials over %$\mathrm{GF}(2^8)$%
+ * Arguments: @unsigned x, y@ = polynomials over %$\gf{2^8}$%
* @unsigned m@ = modulus
*
* Returns: The product of two polynomials.
*
* Build the S-box.
*
- * This is built from multiplicative inversion in the group
- * %$\mathrm{GF}(2^8)[x]/p(x)$%, where %$p(x) = x^8 + x^4 + x^3 + x + 1$%,
- * followed by an affine transformation treating inputs as vectors over
- * %$\mathrm{GF}(2)$%. The result is a horrible function.
+ * This is built from inversion in the multiplicative group of
+ * %$\gf{2^8}[x]/(p(x))$%, where %$p(x) = x^8 + x^4 + x^3 + x + 1$%, followed
+ * by an affine transformation treating inputs as vectors over %$\gf{2}$%.
+ * The result is a horrible function.
*
* The inversion is done slightly sneakily, by building log and antilog
* tables. Let %$a$% be an element of the finite field. If the inverse of
/* --- Round constants --- */
-void rcon(void)
+static void rcon(void)
{
unsigned r = 1;
int i;
{ ", stdout);
for (j = 0; j < 4; j++) {
for (i = 0; i < 256; i++) {
- printf("0x%08x", t[j][i]);
+ printf("0x%08lx", (unsigned long)t[j][i]);
if (i == 255) {
if (j == 3)
fputs(" } \\\n}\n\n", stdout);
{ ", stdout);
for (j = 0; j < 4; j++) {
for (i = 0; i < 256; i++) {
- printf("0x%08x", ti[j][i]);
+ printf("0x%08lx", (unsigned long)ti[j][i]);
if (i == 255) {
if (j == 3)
fputs(" } \\\n}\n\n", stdout);
{ ", stdout);
for (j = 0; j < 4; j++) {
for (i = 0; i < 256; i++) {
- printf("0x%08x", u[j][i]);
+ printf("0x%08lx", (unsigned long)u[j][i]);
if (i == 255) {
if (j == 3)
fputs(" } \\\n}\n\n", stdout);