Merge "Fix encryption/decryption of large blocks." into qt-dev

am: 3074669af7

Change-Id: Icede5f5af8c2c0d3216125b381ff7e7fd20a13cf
This commit is contained in:
Shawn Willden
2019-05-28 12:36:39 -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 ((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 // More output might be produced in this loop -- buffer the current output
if (bufferedOutput == null) { if (bufferedOutput == null) {
bufferedOutput = new ByteArrayOutputStream(); bufferedOutput = new ByteArrayOutputStream();
try { }
bufferedOutput.write(opResult.output); try {
} catch (IOException e) { bufferedOutput.write(opResult.output);
throw new ProviderException("Failed to buffer output", e); } catch (IOException e) {
} throw new ProviderException("Failed to buffer output", e);
} }
} else { } else {
// No more output will be produced in this loop // No more output will be produced in this loop