Merge "Keystore 2.0 SPI: Fix engineDoFinal with null input." am: 06df6d84eb am: 3310a9a81f am: eaca45fcf3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1680128

Change-Id: I2ad6bfc44915687bc24c0ec60ebf99244f4758b1
This commit is contained in:
Treehugger Robot
2021-04-23 18:26:33 +00:00
committed by Automerger Merge Worker

View File

@@ -579,7 +579,11 @@ abstract class AndroidKeyStoreCipherSpiBase extends CipherSpi implements KeyStor
protected final byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
throws IllegalBlockSizeException, BadPaddingException {
if (mCipher != null) {
return mCipher.doFinal(input, inputOffset, inputLen);
if (input == null && inputLen == 0) {
return mCipher.doFinal();
} else {
return mCipher.doFinal(input, inputOffset, inputLen);
}
}
if (mCachedException != null) {