History log of /system/keymaster/android_keymaster.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
45ed583419757a5efbe94f9de93e69c19f3f5812 01-Sep-2016 Janis Danisevskis <jdanis@google.com> Fix auth list app ID affiliation

The app ID must never be associated with the tee auth list,
because the app ID cannot be assured by the tee.

Change-Id: Iec3d92928091de09808b8edfc1442c7ce79503da
/system/keymaster/android_keymaster.cpp
019db0d32168a2e9cf98ec8595aee52120cf8604 20-May-2016 Janis Danisevskis <jdanis@google.com> Add tag KM_TAG_ATTESTATION_APPLICATION_ID

Adds the tag KM_TAG_ATTESTATION_APPLICATION_ID to keymaster

Bug: 22914603
Change-Id: I8bc31a6c30c0327b53f7b82c32746c8ed2194f05
/system/keymaster/android_keymaster.cpp
cddf3a443abf64f3d77c48886693179c0b8a35bb 10-Mar-2016 Shawn Willden <swillden@google.com> Implement key version binding.

Change-Id: If0f3bc12380b8b65bf1e60d5d8d039eb972c8a15
/system/keymaster/android_keymaster.cpp
cb647fec03f71929fd316d2b8f0750f7b24824f3 27-Jan-2016 Shawn Willden <swillden@google.com> Support input to "finish()" in AndroidKeymaster operations.

This CL does not yet take advantage of the simplifications that allowing
input to finish() provides. That will require updating the Java layer
first, to remove some assumptions and code that assume update() must
eventually consume all input.

Change-Id: Ie85896027a1d55ddec06750d19addbb1f5e462c8
/system/keymaster/android_keymaster.cpp
d3ee550ac91a5c21343d9885a0e231281057e916 06-Jan-2016 Shawn Willden <swillden@google.com> Add attestation support to AndroidKeymaster.

Attestation is still not wired up in SoftKeymasterDevice, so we can't
test it yet. Unit tests will come with the CL that wires it up.

Bug: 22914603
Change-Id: I706c8f82e97f4d6c3b5d3726a266ba8d0175396b
/system/keymaster/android_keymaster.cpp
d599b15c0693950bdc72fb867872044fdc484ef5 28-Jul-2015 Shawn Willden <swillden@google.com> Do digesting, and sometimes padding, in SW when HW doesnt.

The keymaster1 specification only requires HW modules to implement
SHA256 out of the list of keymaster1 digest modes. That would force
many keys to be software only, and would break legacy scenarios. This
change uses SoftKeymasterDevice to front keymaster modules that don't
implement the full suite of digests, quietly inserting KM_DIGEST_NONE
and KM_PAD_NONE into key generation/import requests when necessary, then
performing the digesting, and sometimes padding, in software, then
delegating crypto operations to the hardware.

This is only done for RSA and EC keys. Software digesting isn't
possible for HMAC or AES-GCM keys.

Note that this is not the complete fix for the bug. Some changes in
keystore are also required, coming in another CL.

Bug: 22529223
Change-Id: I740572eb11341fb0659085309da01d5cbcd3854d
/system/keymaster/android_keymaster.cpp
ada4850659d484dd5ece26dde73072bef16c1517 25-Jun-2015 Shawn Willden <swillden@google.com> Add authorization enforcement to AndroidKeymaster.

Note: Moving List.h into system/keymaster is unfortunate, but required
to allow Trusty to use it. b/22088154 tracks cleaning this up.

Bug: 19511945
Change-Id: Ia1dfe5fda5ea78935611b0a7656b323770edcbae
/system/keymaster/android_keymaster.cpp
294a2db0e5f2eb46d84e4f5c9ce25245ac474147 17-Jun-2015 Shawn Willden <swillden@google.com> Don't enforce purpose, digest or padding on public key operations

Bug: 21877150
Change-Id: Iaf00c94aaca892a154aea7aa4e3828bfbd8d9630
/system/keymaster/android_keymaster.cpp
36d41e230417ac3b86a1425ebf60fff6d92377ec 17-Jun-2015 Shawn Willden <swillden@google.com> Refactor AndroidKeymaster so all methods use message objects.

Methods with simple argument or return types eschewed message objects,
but this complicates the TrustyKeymaster implementation by requiring it
to build its own system for marshalling and unmarshalling.

Bug: 14674558
Change-Id: I5a88523c9d1a76c8629ff6f93040ceb3c2a9426b
/system/keymaster/android_keymaster.cpp
ded8e7d0ad241fc0a930dbebbd9f2e2bf4e929a2 01-Jun-2015 Shawn Willden <swillden@google.com> Pass output params down to operations.

Change-Id: Ibd6956f6b8ef42f272d922050a7e5da3d78cffb7
/system/keymaster/android_keymaster.cpp
ac69d9559e96cf57d7705848a9f3d6e09eac9fe1 01-Jun-2015 Shawn Willden <swillden@google.com> Add output params to Update & Finish messages.

Change-Id: I5f6ee245259788cb8c873d814e167f5d5bcdc08b
/system/keymaster/android_keymaster.cpp
398c158a0206217025f327c2d26bb6c86659f5a0 28-May-2015 Shawn Willden <swillden@google.com> Move assymetric key factory declarations to includes.

This exposes EcKeyFactory and RsaKeyFactory so they can be used for
constructing the Trusty KeymasterContext. Note that there are no code
changes, just reorganization.

Change-Id: I8e8e068fb875f9d9c5c35320a545347dc33bc507
/system/keymaster/android_keymaster.cpp
0629810b145187575bc26c910dded0d24c64569d 26-May-2015 Shawn Willden <swillden@google.com> Another refactor, deleting AbstractFactoryRegistry.

I should have known better than to make these singletons to begin
with. Globals create problems. This undoes that mistake.

Change-Id: Idf61d5f72e3c34b5c4ddb27cc94b05f506561743
/system/keymaster/android_keymaster.cpp
2beb628bfefae72fa6bb84a6235da7e3de532823 21-May-2015 Shawn Willden <swillden@google.com> Delegate RSA keys to keymaster0 in SoftKeymasterDevice.

Bug: 20912868
Change-Id: I515a125f1247357d2cd9b4633c3b223590848093
/system/keymaster/android_keymaster.cpp
0cb6942d3efb6c056f96321c82a4b3d86af601d6 26-May-2015 Shawn Willden <swillden@google.com> Revert "Revert "Large refactor to move context out of AndroidKeymaster.""

This reverts commit 13fbe3e93247943c26e7ca2ed27b6d650282b8bf.

Bug: 20912868, 19799085
Change-Id: Iadd6ce5cbe94956c2a2fe277f1bf5b108e4bcf57
/system/keymaster/android_keymaster.cpp
13fbe3e93247943c26e7ca2ed27b6d650282b8bf 23-May-2015 Shawn Willden <swillden@google.com> Revert "Large refactor to move context out of AndroidKeymaster."

This reverts commit 8ba2a043f0d44ad3f58d4af518f9391c03eca9c3.

I need to update the Volantis non-secure code in sync. Reverting while I get that done.

Change-Id: I0fb9f928e7e624ad678050a04bb873b43b1c9a48
/system/keymaster/android_keymaster.cpp
8ba2a043f0d44ad3f58d4af518f9391c03eca9c3 18-May-2015 Shawn Willden <swillden@google.com> Large refactor to move context out of AndroidKeymaster.

AndroidKeymaster made a number of assumptions about its context that are
really only valid for TEE-based usage. In addition, KeyFactory made
some similarly TEE-focused assumptions about key blob creation and
parsing.

Both concerns have been moved to a new KeymasterContext class, which is
responsible for building and parsing key blobs in a manner appropriate
for the context in which AndroidKeymaster is running, as well as
providing other context-specific services, such as random number
generation.

In addition, the refactor reduces the need for the KeyBlob and
UnencryptedKeyBlob classes, which encode too many assumptions about blob
formatting and encryption, to the point that they can be removed and
replaced by a handful of utility functions which are much cleaner and
more flexible.

How to review this CL:

I looked hard at breaking this up into smaller CLs, but it's mostly not
feasible. However, it's probably easier to approach it by starting with
the fundamental changes, and then looking at the cascade effects.

1. Look at keymaster_context.h. The core of the change was pulling this
set of features out of AndroidKeymaster. Note that the revised approach
to key blob creation does not involve the KeyBlob and UnencryptedKeyBlob
classes, but instead goes directly from raw key material plus ancillary
data (e.g. auth sets) to a serialized buffer ready to return to
keystore. The same is true in reverse direction for parsing key blobs.

2. Look at key.h. The revised KeyFactory GenerateKey, ImportKey and
LoadKey methods are essential. GenerateKey and ImportKey no longer
produce a Key object, because all that's needed is a returnable blob.
LoadKey produces a Key object, but it starts with raw key material,
rather than an UnencryptedKeyBlob. Also note the change to the Key
class; because Key objects are only created by LoadKey, when there's a
need to use a key, there's only one constructor.

3. Look at asymmetric_key.h, rsa_key.h and rsa_key.cpp. rsa_key.cpp
provides a good example of how the new structure works. GenerateKey and
ImportKey do all of the work necessary to produce an OpenSSL RSA key and
extract the internal representation (using EvpToKeyMaterial; defined in
asymmetric_key.h because it's the same for EC keys). Then, with the raw
key data in hand, they call KeymasterContext::CreateKeyBlob to wrap the
key data in a key blob that can be returned to the caller -- whatever
that wrapping means in the current context. There's a subtlety not
apparent here which is crucial to the rationale for the refactoring:
RsaKeyFactory uses KeymasterContext::get_instance to retrieve the
context, but key factories which depend on operating in a particular
context can use a different way to get their context object, which may
have a larger interface. RsaKeymaster0KeyFactory will do this.

4. Look at soft_keymaster_context. In
particular, SoftKeymasterContext::CreateKeyBlob and ParseKeyBlob.
CreateKeyBlob allocates authorization tags from key_description to
hw_enforced and sw_enforced, then encrypts the key material and
serializes it to a blob. This approach is compatible with the keys
softkeymaster has been producing, but I'm going to change it (post M),
because there's no reason to bother encrypting SW keys with a SW key.
ParseKeyBlob reverses the process to recover the unencrypted key
material and the auth lists. One debatable point was the decision to
implement BuildHiddenAuthorizations and SetAuthorizations here, since
all contexts will need something similar, and they really should all do
it the same. I may refactor later to pull that functionality up to
KeymasterContext; it will depend on what I learn implementing
TrustyKeymasterContext and HybridKeymasterContext (used for the
keymaster0 adapter).

5. Look at ocb_utils and auth_encrypted_key_blob. These contain the key
encryption and key blob serialization code which was formerly split
between AndroidKeymaster::SerializeKeyBlob, UnencryptedKeyBlob and
KeyBlob, now divided into separate encryption and serialization
utilities. Note the refactored key_blob_test.cpp, updated to use the
new utilities rather than UnencryptedKeyBlob.

6. Look at soft_keymaster_device.cpp. Since KeyBlob no longer exists to
provide a nice way to peer into a blob to extract the algorithm, for use
in determining how to parse the keymaster0 signing key params (which
come in as a void*, yuck), we now have to use get_key_characteristics to
recover the params. This was the right way all along; the device layer
should not depend on being able to parse key blobs.

7. The rest.

Bug: 20912868, 19799085
Change-Id: Ieb74b8da39974f674eb8baa959bde75011fdd2e8
/system/keymaster/android_keymaster.cpp
b6837e7a62a1192e33beef586282812239ee8b28 16-May-2015 Shawn Willden <swillden@google.com> Remove references to Google in Android keymaster reference implementation.

Change-Id: I05de61353fc806b90232fab7c1d1cf76aefa35fc
/system/keymaster/android_keymaster.cpp