//CPU will result in fewer cache misses. -- ejhuff 2003-10-12
static synchronized Object makeKey(byte[] k, int blockSize)
throws InvalidKeyException {
if (RDEBUG) trace(IN, "makeKey("+k+", "+blockSize+ ')');
if (k == null)
throw new InvalidKeyException("Empty key");
if (!((k.length == 16) || (k.length == 24) || (k.length == 32)))
throw new InvalidKeyException("Incorrect key length");
int ROUNDS = getRounds(k.length, blockSize);
int BC = blockSize / 4;
final int BCshift;
if (BC == 4)
BCshift = 2;
else if (BC == 8)
BCshift = 3;
else
/* Note: original code supported block size 192 bits */
throw new InvalidKeyException("Unsupported block size: "+blockSize);
int[][] Ke = new int[ROUNDS + 1][BC]; // encryption round keys
int[][] Kd = new int[ROUNDS + 1][BC]; // decryption round keys
int ROUND_KEY_COUNT = (ROUNDS + 1) << BCshift;
int KC = k.length / 4;
int[] tk = new int[KC];