Merge "Fix encryption/decryption of large blocks." into qt-dev am: 3074669af7

am: eb65abcfe3

Change-Id: Icd5bb20bbd481a1e305037a412adc905023dab35
This commit is contained in:
Shawn Willden
2019-05-28 12:43:32 -07:00
committed by android-build-merger

View File

@@ -162,15 +162,15 @@ class KeyStoreCryptoOperationChunkedStreamer implements KeyStoreCryptoOperationS
}
if ((opResult.output != null) && (opResult.output.length > 0)) {
if (inputLength > 0) {
if (inputLength + mBufferedLength > 0) {
// More output might be produced in this loop -- buffer the current output
if (bufferedOutput == null) {
bufferedOutput = new ByteArrayOutputStream();
try {
bufferedOutput.write(opResult.output);
} catch (IOException e) {
throw new ProviderException("Failed to buffer output", e);
}
}
try {
bufferedOutput.write(opResult.output);
} catch (IOException e) {
throw new ProviderException("Failed to buffer output", e);
}
} else {
// No more output will be produced in this loop