private void processBlock(byte[] buf, int bufOff, byte[] out, int outOff)
{
if ((out.length - outOff) < BLOCK_SIZE)
{
throw new OutputLengthException("Output buffer too short");
}
if (totalLength == 0)
{
initCipher();
}
byte[] ctrBlock = new byte[BLOCK_SIZE];
getNextCTRBlock(ctrBlock);
if (forEncryption)
{
GCMUtil.xor(ctrBlock, buf, bufOff);
gHASHBlock(S, ctrBlock);
System.arraycopy(ctrBlock, 0, out, outOff, BLOCK_SIZE);
}
else
{
gHASHBlock(S, buf, bufOff);
GCMUtil.xor(ctrBlock, 0, buf, bufOff, out, outOff);
}
totalLength += BLOCK_SIZE;
}