Add polynomial for 1024-bit block cipher.

This will support Threefish and its 1024-bit block size. I believe this is correct, but it may be wrong. According to "Table of Low-Weight Binary Irreducible Polynomials" (http://www.hpl.hp.com/techreports/98/HPL-98-135.pdf), the polynomial is x^1024 + x^19 + x^6 + x + 1.
pull/186/merge
Jeffrey Walton 2017-05-13 19:15:46 -04:00
parent 7697857481
commit d654c893ef
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 10 additions and 1 deletions

View File

@ -31,15 +31,24 @@ static void MulU(byte *k, unsigned int length)
k[15] ^= 0x87; k[15] ^= 0x87;
break; break;
case 32: case 32:
// Should this be 0x425? // https://crypto.stackexchange.com/q/9815/10496
// Polynomial x^256 + x^10 + x^5 + x + 1
k[30] ^= 4; k[30] ^= 4;
k[31] ^= 0x23; k[31] ^= 0x23;
break; break;
case 64: case 64:
// https://crypto.stackexchange.com/q/9815/10496 // https://crypto.stackexchange.com/q/9815/10496
// Polynomial x^512 + x^8 + x^5 + x^2 + 1
k[62] ^= 1; k[62] ^= 1;
k[63] ^= 0x25; k[63] ^= 0x25;
break; break;
case 128:
// https://crypto.stackexchange.com/q/9815/10496
// Polynomial x^1024 + x^19 + x^6 + x + 1
k[126] ^= 8;
k[126] ^= 0x00;
k[127] ^= 0x43;
break;
default: default:
throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size"); throw InvalidArgument("CMAC: " + IntToString(length) + " is not a supported cipher block size");
} }