History log of /system/keymaster/include/keymaster/soft_keymaster_device.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c15af1910d8f451341d0068b5533816ace5defec 10-Mar-2016 Shawn Willden <swillden@google.com> Implement key version binding.

Change-Id: If0f3bc12380b8b65bf1e60d5d8d039eb972c8a15
/system/keymaster/include/keymaster/soft_keymaster_device.h
86a0b87bcc77bd24cedbcdc82699414de7345030 28-Jan-2016 Shawn Willden <swillden@google.com> Revert "Revert "Add attestation support to SoftKeymaster.""

This reverts commit 0fc3ef6f2de4f2204f121e3080a17203bf847cae.

Change-Id: I658ad32b281ab74d3beeee66794b31f193e6d404
/system/keymaster/include/keymaster/soft_keymaster_device.h
0fc3ef6f2de4f2204f121e3080a17203bf847cae 28-Jan-2016 Shawn Willden <swillden@google.com> Revert "Add attestation support to SoftKeymaster."

This reverts commit fc3cafd487e69c84d83444e1d129d0ab131c4e3d.

Change-Id: I1fb38db044c4039be04d1f75fb89ca9a6404321f
/system/keymaster/include/keymaster/soft_keymaster_device.h
fc3cafd487e69c84d83444e1d129d0ab131c4e3d 11-Jan-2016 Shawn Willden <swillden@google.com> Add attestation support to SoftKeymaster.

Bug: 22914603
Change-Id: I7650f1b691665bce3024556c2ea38e122c9cb2cf
/system/keymaster/include/keymaster/soft_keymaster_device.h
c72ae833d2bafc31dff801ad779b146d5c31b527 06-Jan-2016 Shawn Willden <swillden@google.com> Add keymaster2 stub support to SoftKeymasterDevice.

This CL adds a keymaster2 API to SoftKeymasterDevice. It just
delegates to the keymaster1 implementation, and will return errors if
any keymaster2 features are used. This will allow conversion of
keystore to the keymaster2 API, after which the keymaster1 API will be
removed from SoftKeymasterDevice (though it will still be able to wrap
a keymaster1 hardware implementation).

Note that this CL does not update the unit tests to test the
keymaster2 interface. That will come in a future CL.

Change-Id: I2efd696d733c99e916f98ae68586310d3b2abf78
/system/keymaster/include/keymaster/soft_keymaster_device.h
b87d707b96e6af9dabd23481b5c7a51160630831 25-Nov-2015 Shawn Willden <swillden@google.com> Set SoftKeymasterDevice flags correctly.

Bug: 25166155
Change-Id: Ibaf0ef42744094b2dde26539e8f51d381061eb1e
/system/keymaster/include/keymaster/soft_keymaster_device.h
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/include/keymaster/soft_keymaster_device.h
5cf45028751471f79d9f8a390f64fe9412acd53a 20-Jul-2015 Shawn Willden <swillden@google.com> Make NONE mean NONE only (not ANY)

KM_DIGEST_NONE and KM_PAD_NONE have implicit meanings of "any digest"
and "any padding", respectively, as well as the expected meanings of "no
digest" and "no padding". This CL changes that so they mean only "no
digest" and "no padding".

Bug: 22556114
Change-Id: I7b0b4c079067d85ba1aa39ae7edf0c6b17a9a500
/system/keymaster/include/keymaster/soft_keymaster_device.h
d091b0a3c7efe608a474d4ca051951405e304a5d 06-Jul-2015 Shawn Willden <swillden@google.com> Implement delete_key and delete_all_keys in SoftKeymasterDevice.

Bug: 22294523
Change-Id: Ifab60b904e37c7ecca0b8138817af3d3b48199c0
/system/keymaster/include/keymaster/soft_keymaster_device.h
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/include/keymaster/soft_keymaster_device.h
0e2ee44913880a582488a9cb7e1ffe0711111891 01-Jun-2015 Shawn Willden <swillden@google.com> Update SoftKeymasterDevice to track keymaster1 API changes.

Change-Id: I8472a75ea60c73794ce31cacab9bcaad8482358f
/system/keymaster/include/keymaster/soft_keymaster_device.h
0cbfbc5b72a0d5bafffa3c2e93eeeea0edf91b83 01-Jun-2015 Shawn Willden <swillden@google.com> Don't bother parsing keymaster0 signing params.

The keymaster0 signing API includes a void* to a structure that depends
on key type (RSA or EC). Previously we've tried to determine what the
key type is and to extract proper parameters, by calling
get_key_characteristics and examining the result. But this is all
pointless. The possible contents of that signing structure is fixed, so
we may as well just set the values directly. This does mean that we set
KM_TAG_PADDING for EC keys, even though ECDSA doesn't use padding.
That's okay, though. Keymaster1 implementations should ignore
extraneous tags. And in any case, we'll soon stop even providing the
keymaster0 APIs, so the issue will disappear.

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

Bug: 20912868
Change-Id: I515a125f1247357d2cd9b4633c3b223590848093
/system/keymaster/include/keymaster/soft_keymaster_device.h
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/include/keymaster/soft_keymaster_device.h
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/include/keymaster/soft_keymaster_device.h
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/include/keymaster/soft_keymaster_device.h
f923963fda888eac9e7997b71d5525ea2f82a091 12-May-2015 Shawn Willden <swillden@google.com> Move key factory registration into SoftKeymasterDevice.

So we can do it differently in the keymaster0 adapter.

Bug: 20912868
Change-Id: If4c602cc0fab3e59cd2e395a97e21dd8cb3a176f
/system/keymaster/include/keymaster/soft_keymaster_device.h
b6837e7a62a1192e33beef586282812239ee8b28 16-May-2015 Shawn Willden <swillden@google.com> Remove references to Google in Android keymaster reference implementation.

Change-Id: I05de61353fc806b90232fab7c1d1cf76aefa35fc
/system/keymaster/include/keymaster/soft_keymaster_device.h
125e4866f98eb1b5ad65a563afd34aca215d983d 11-May-2015 Shawn Willden <swillden@google.com> Remove rescoping support.

Change-Id: Ia8e36e41e04f15befccbb7b4138f599849facd28
(cherry picked from commit 0c14b2c5f42abdab58118106d5a7117a88d4a324)
/system/keymaster/include/keymaster/soft_keymaster_device.h
d7a5c71d3b59cc27bccf364378bcfd4cd2553978 10-Apr-2015 Shawn Willden <swillden@google.com> Fix RSA and ECDSA key import in softkeymaster.

Bug: 20055613
Change-Id: Ie1998476659cb4c9e1311f0391cc3a6ecb9204ca
/system/keymaster/include/keymaster/soft_keymaster_device.h
95dda36620149d1b8de57d175df9ba34a64e895d 27-Feb-2015 Shawn Willden <swillden@google.com> Move keymaster test fixture to utils, so we can reuse it.

Change-Id: I7e080326a97712bc1b6810e7231ecf78b7d4e28f
/system/keymaster/include/keymaster/soft_keymaster_device.h
567a4a04f43d35b785d50508e6459b01f2ab4d14 31-Dec-2014 Shawn Willden <swillden@google.com> Switch to using global logger

Change-Id: I7af02342320a9a431cd9845baaf5dbcf61d460c2
/system/keymaster/include/keymaster/soft_keymaster_device.h
3025502b3f6094c675a732cbfeb9ff3d7801e3a2 24-Feb-2015 Shawn Willden <swillden@google.com> Separate keymaster0 and keymaster1 HALs.

For the moment soft_keymaster_device still supports the keymaster0
APIs. This will change soon.

Change-Id: I5c54282c12d1c4b8b22ed4929b6e6c724a94ede4
/system/keymaster/include/keymaster/soft_keymaster_device.h
6bfbff0020bb964a736e30d717b338e3e3973a36 07-Feb-2015 Shawn Willden <swillden@google.com> Add additional params to update and finish operations.

Change-Id: I78a81b1ceb47a2abb189da4b0446800a56ec88c3
/system/keymaster/include/keymaster/soft_keymaster_device.h
834d4130bab134a83b52bc66e25c3a57b202e0e2 12-Feb-2015 Chad Brubaker <cbrubaker@google.com> Move soft_keymaster headers to include/keymaster

Change-Id: Ie832ff6db1b1a0f4994641f3088c898fb35697b9
/system/keymaster/include/keymaster/soft_keymaster_device.h