private void gHASHPartial(byte[] Y, byte[] b, int off, int len) { GCMUtil.xor(Y, b, off, len); multiplier.multiplyH(Y); }
private void gHASHBlock(byte[] Y, byte[] b) { GCMUtil.xor(Y, b); multiplier.multiplyH(Y); }
private void gHASHBlock(byte[] Y, byte[] b) { GCMUtil.xor(Y, b); multiplier.multiplyH(Y); }
private void gHASHBlock(byte[] Y, byte[] b, int off) { GCMUtil.xor(Y, b, off); multiplier.multiplyH(Y); }
private void gHASHPartial(byte[] Y, byte[] b, int off, int len) { GCMUtil.xor(Y, b, off, len); multiplier.multiplyH(Y); }
private void gCTRBlock(byte[] block, byte[] out, int outOff) { byte[] tmp = getNextCounterBlock(); GCMUtil.xor(tmp, block); System.arraycopy(tmp, 0, out, outOff, BLOCK_SIZE); gHASHBlock(S, forEncryption ? tmp : block); totalLength += BLOCK_SIZE; }
private void gCTRPartial(byte[] buf, int off, int len, byte[] out, int outOff) { byte[] tmp = getNextCounterBlock(); GCMUtil.xor(tmp, buf, off, len); System.arraycopy(tmp, 0, out, outOff, len); gHASHPartial(S, forEncryption ? tmp : buf, 0, len); totalLength += len; }
private void processPartial(byte[] buf, int off, int len, byte[] out, int outOff) { byte[] ctrBlock = new byte[BLOCK_SIZE]; getNextCTRBlock(ctrBlock); if (forEncryption) { GCMUtil.xor(buf, off, ctrBlock, 0, len); gHASHPartial(S, buf, off, len); } else { gHASHPartial(S, buf, off, len); GCMUtil.xor(buf, off, ctrBlock, 0, len); } System.arraycopy(buf, off, out, outOff, len); totalLength += len; }
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; }
public void init(byte[] H) { if (T == null) { T = new long[256][2]; } else if (Arrays.areEqual(this.H, H)) { return; } this.H = Arrays.clone(H); // T[0] = 0 // T[1] = H.p^7 GCMUtil.asLongs(this.H, T[1]); GCMUtil.multiplyP7(T[1], T[1]); for (int n = 2; n < 256; n += 2) { // T[2.n] = T[n].p^-1 GCMUtil.divideP(T[n >> 1], T[n]); // T[2.n + 1] = T[2.n] + T[1] GCMUtil.xor(T[n], T[1], T[n + 1]); } }
GCMUtil.xor(M[i][j], M[i][k], M[i][j + k]);
GCMUtil.xor(t[n], t[1], t[n + 1]);
GCMUtil.xor(t[n], t[1], t[n + 1]);
GCMUtil.xor(M[i][j], M[i][k], M[i][j + k]);