Loading keystore/java/android/security/keystore/KeyStoreCryptoOperationChunkedStreamer.java +19 −9 Original line number Diff line number Diff line Loading @@ -139,18 +139,28 @@ class KeyStoreCryptoOperationChunkedStreamer implements KeyStoreCryptoOperationS } else if (opResult.resultCode != KeyStore.NO_ERROR) { throw KeyStore.getKeyStoreException(opResult.resultCode); } if (opResult.inputConsumed <= 0) { if (opResult.inputConsumed == 0) { // Some KM implementations do not consume data in certain block modes unless a // full block of data was presented. if (inputLength > 0) { // More input is available, but it wasn't included into the previous chunk // because the chunk reached its maximum permitted size. // Shouldn't have happened. throw new KeyStoreException(KeymasterDefs.KM_ERROR_INVALID_INPUT_LENGTH, "Keystore consumed 0 of " + mChunkLength + " bytes provided."); } else if (opResult.inputConsumed > mChunkLength) { "Keystore consumed nothing from max-sized chunk: " + mChunkLength + " bytes"); } } else if (opResult.inputConsumed > mChunkLength || opResult.inputConsumed < 0) { throw new KeyStoreException(KeymasterDefs.KM_ERROR_UNKNOWN_ERROR, "Keystore consumed more input than provided. Provided: " + mChunkLength + ", consumed: " + opResult.inputConsumed); "Keystore consumed more input than provided (or inputConsumed was " + "negative." + " Provided: " + mChunkLength + ", consumed: " + opResult.inputConsumed); } mChunkLength -= opResult.inputConsumed; if (mChunkLength > 0) { // Partialy consumed, shift chunk contents // Partially consumed, shift chunk contents ArrayUtils.copy(mChunk, opResult.inputConsumed, mChunk, 0, mChunkLength); } Loading Loading
keystore/java/android/security/keystore/KeyStoreCryptoOperationChunkedStreamer.java +19 −9 Original line number Diff line number Diff line Loading @@ -139,18 +139,28 @@ class KeyStoreCryptoOperationChunkedStreamer implements KeyStoreCryptoOperationS } else if (opResult.resultCode != KeyStore.NO_ERROR) { throw KeyStore.getKeyStoreException(opResult.resultCode); } if (opResult.inputConsumed <= 0) { if (opResult.inputConsumed == 0) { // Some KM implementations do not consume data in certain block modes unless a // full block of data was presented. if (inputLength > 0) { // More input is available, but it wasn't included into the previous chunk // because the chunk reached its maximum permitted size. // Shouldn't have happened. throw new KeyStoreException(KeymasterDefs.KM_ERROR_INVALID_INPUT_LENGTH, "Keystore consumed 0 of " + mChunkLength + " bytes provided."); } else if (opResult.inputConsumed > mChunkLength) { "Keystore consumed nothing from max-sized chunk: " + mChunkLength + " bytes"); } } else if (opResult.inputConsumed > mChunkLength || opResult.inputConsumed < 0) { throw new KeyStoreException(KeymasterDefs.KM_ERROR_UNKNOWN_ERROR, "Keystore consumed more input than provided. Provided: " + mChunkLength + ", consumed: " + opResult.inputConsumed); "Keystore consumed more input than provided (or inputConsumed was " + "negative." + " Provided: " + mChunkLength + ", consumed: " + opResult.inputConsumed); } mChunkLength -= opResult.inputConsumed; if (mChunkLength > 0) { // Partialy consumed, shift chunk contents // Partially consumed, shift chunk contents ArrayUtils.copy(mChunk, opResult.inputConsumed, mChunk, 0, mChunkLength); } Loading