Track Keymaster changes.

* MAC length is now specified as a parameters to the begin operation
  instead of as a parameter at key generation/import time.
* KM_TAG_MAC_LENGTH is now in bits instead of in bytes.

Change-Id: I752fe232d11d3ac39a575a48948215d84ded8fb9
This commit is contained in:
Alex Klyubin
2015-04-30 10:50:45 -07:00
parent 403ac2d64f
commit 7ea5090264
4 changed files with 15 additions and 30 deletions

View File

@@ -486,16 +486,6 @@ public class AndroidKeyStore extends KeyStoreSpi {
}
}
args.addInts(KeymasterDefs.KM_TAG_DIGEST, keymasterDigests);
if (keymasterDigests.length > 0) {
// TODO: Remove MAC length constraint once Keymaster API no longer requires it.
// This code will blow up if mode than one digest is specified.
int digestOutputSizeBytes =
KeymasterUtils.getDigestOutputSizeBytes(keymasterDigests[0]);
if (digestOutputSizeBytes != -1) {
// TODO: Switch to bits instead of bytes, once this is fixed in Keymaster
args.addInt(KeymasterDefs.KM_TAG_MAC_LENGTH, digestOutputSizeBytes);
}
}
if (keymasterAlgorithm == KeymasterDefs.KM_ALGORITHM_HMAC) {
if (keymasterDigests.length == 0) {
throw new KeyStoreException("At least one digest algorithm must be specified"