Preserve mac after doFinal
@@ -322,9 +322,17 @@ public int processBytes(byte[] input, int inOff, int len, byte[] output,
}
public void reset()
+ {
+ reset(true);
+ }
+
+ private void reset(boolean clearMac)
{
this.isEven = true;
+ if (clearMac)
+ {
this.mac = null;
+ }
this.aadData.reset();
this.aadFinished = false;
setKey(workingKey, workingIV);
@@ -487,15 +495,10 @@ public int doFinal(byte[] out, int outOff)
System.arraycopy(mac, 0, out, outOff, mac.length);
- try
- {
+ reset(false);
+
return mac.length;
}
- finally
- {
- reset();
- }
- }
public byte[] getMac()
{
