Merge "Keystore 2.0 SPI: Fix engineDoFinal with null input."

This commit is contained in:
Treehugger Robot
2021-04-23 17:53:34 +00:00
committed by Gerrit Code Review

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) {