Ensure key algorithm name of HMAC keys is preserved.

When Android KeyStore loads an HMAC key, it needs to compose the JCA
key algorithm name (e.g., HmacSHA256) based on the digests the key is
authorized for. A key can be authorized for multiple digests. Thus,
the approach is to use the first one for constructing the JCA key
algorithm name.

This CL ensures that when importing HMAC keys the first KM_TAG_DIGEST
tag is set to the digest of the JCA key algorithm name.

Bug: 18088752
Change-Id: I911ca7427b249ee823d06e988687af6146ebaff8
1 file changed