Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adeebe5e authored by Janis Danisevskis's avatar Janis Danisevskis
Browse files

Keystore 2.0 SPI: Fix bug in chunked streamer.

The chunked streamer sent the chunk buffer prematurely leading to
oversized and garbage data sent to keystore.

Test: atest android.keystore.cts.SignatureTest#testSmallMsgKat
Change-Id: I84e40766b735f05b3fb7e0e692d26a25a0496649
parent a1daeb70
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -139,7 +139,9 @@ class KeyStoreCryptoOperationChunkedStreamer implements KeyStoreCryptoOperationS
            int inputConsumed = ArrayUtils.copy(input, inputOffset, mChunk, mChunkLength,
                    inputLength);
            inputLength -= inputConsumed;
            inputOffset += inputOffset;
            inputOffset += inputConsumed;
            mChunkLength += inputConsumed;
            if (mChunkLength < mChunkSizeMax) return output;
            byte[] o = mKeyStoreStream.update(mChunk);
            if (o != null) {
                output = ArrayUtils.concat(output, o);