Merge "Keystore 2.0 SPI: Small fix to apease CTS test."

This commit is contained in:
Janis Danisevskis
2021-02-01 18:33:32 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 1 deletions

View File

@@ -363,6 +363,11 @@ public class AndroidKeyStoreProvider extends Provider {
}
}
if (response.iSecurityLevel == null) {
// This seems to be a pure certificate entry, nothing to return here.
return null;
}
Integer keymasterAlgorithm = null;
// We just need one digest for the algorithm name
int keymasterDigest = -1;

View File

@@ -490,7 +490,7 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
int[] keymasterEncryptionPaddings =
KeyProperties.EncryptionPadding.allToKeymaster(
spec.getEncryptionPaddings());
if (((spec.getPurposes() & KeyProperties.PURPOSE_DECRYPT) != 0)
if (((spec.getPurposes() & KeyProperties.PURPOSE_ENCRYPT) != 0)
&& (spec.isRandomizedEncryptionRequired())) {
for (int keymasterPadding : keymasterEncryptionPaddings) {
if (!KeymasterUtils