History log of /system/keymaster/openssl_utils.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f38a002624126ca837865826f948edc9100d6e8a 26-Apr-2017 Janis Danisevskis <jdanis@google.com> Make keymaster more self contained

Keymaster uses UniquePtr, a reimplementation of std::unique_ptr offered
by the Android framework. As keymaster becomes part of the trebbelized
HAL, it must build with the vndk. As such it must not use framework
headers. An attempt to replace UniquePtr with std::unique_ptr, which
is available in the vndk, failed because keymaster, i.e., parts thereof,
must also build and run in the Trusty environment which does not have
a full C++ STL.

This patch makes keymaster more self contained. To that end the
following was done by this patch.

* Install a copy of UniquePtr.h in include/keymaster.
* Add a tiny subset of STL symbols to keymaster.
* Reorganize linking units and
* build parts of keymaster with stl: "none".

libkeymaster1 was split into libkeymaster_portable and libkeymaster.
The former comprises all compilation units that are included
in the keymaster TA (trusted app) and must run on Trusty.
This library is built with the option stl: "none" to raise
compilation errors as soon as someone tries to use STL features.
A tiny subset of STL symbols, which are also available in Trusty
is weakly defined in keymaster_stl.cpp.
The latter library comprises some other functionality that is
used by the softkeymasterdevice on Android and may use the STL.

Bug: 37467707
Test: keymaster vts tests and keystore cts test
Change-Id: I884336e1a2d2c6402a2c7deb27010fd88b907b6b
/system/keymaster/openssl_utils.cpp
cf3763f666d2236159a22b496b6ede55878aa100 03-May-2017 Janis Danisevskis <jdanis@google.com> Revert "Make keymaster more self contained"

This reverts commit dcd67c1dd0a457feec619974b3d7d077903012a8.

Reason for revert: build breakage

Change-Id: Id7a1b29d82f69ab21e7c461dbabc4e1466870359
/system/keymaster/openssl_utils.cpp
dcd67c1dd0a457feec619974b3d7d077903012a8 26-Apr-2017 Janis Danisevskis <jdanis@google.com> Make keymaster more self contained

Keymaster uses UniquePtr, a reimplementation of std::unique_ptr offered
by the Android framework. As keymaster becomes part of the trebbelized
HAL, it must build with the vndk. As such it must not use framework
headers. An attempt to replace UniquePtr with std::unique_ptr, which
is available in the vndk, failed because keymaster, i.e., parts thereof,
must also build and run in the Trusty environment which does not have
a full C++ STL.

This patch makes keymaster more self contained. To that end the
following was done by this patch.

* Install a copy of UniquePtr.h in include/keymaster.
* Add a tiny subset of STL symbols to keymaster.
* Reorganize linking units and
* build parts of keymaster with stl: "none".

libkeymaster1 was split into libkeymaster_portable and libkeymaster.
The former comprises all compilation units that are included
in the keymaster TA (trusted app) and must run on Trusty.
This library is built with the option stl: "none" to raise
compilation errors as soon as someone tries to use STL features.
A tiny subset of STL symbols, which are also available in Trusty
is weakly defined in keymaster_stl.cpp.
The latter library comprises some other functionality that is
used by the softkeymasterdevice on Android and may use the STL.

Test: keymaster vts tests and keystore cts test
Change-Id: Iba03b45cc3d20854c577160f90fe24bfa7857986
/system/keymaster/openssl_utils.cpp
fabacaf3e6019804cc8a98a2b8296be1d0125519 26-Mar-2015 Thai Duong <thaidn@google.com> ECIES: add ECIES-KEM. This version supports HKDF and ECDH with NIST curves.

Change-Id: I5af3215e96bb015049574aa18327cd7f7499dbd3
/system/keymaster/openssl_utils.cpp
1181779c5e6c8627b94067d86db6a2f7d5309674 23-Nov-2015 Shawn Willden <swillden@google.com> Revert "ECIES: add ECIES-KEM. This version supports HKDF and ECDH with NIST curves."

This reverts commit 41998988331ff38e922a59ef008896beb3145ba0.

Change-Id: Ifed6b4e5a69310770373a396271f02da5c9d8934
/system/keymaster/openssl_utils.cpp
41998988331ff38e922a59ef008896beb3145ba0 26-Mar-2015 Thai Duong <thaidn@google.com> ECIES: add ECIES-KEM. This version supports HKDF and ECDH with NIST curves.

Change-Id: Iea5877eba0a9b13610d3d1b33d04b5657edc3550
/system/keymaster/openssl_utils.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/openssl_utils.cpp
0f906ec40f6ade7955c6b967ea522aade54ea2e4 20-Jun-2015 Shawn Willden <swillden@google.com> Add buffer wrap checks and disable throwing of std::bad_alloc.

Android is built with exceptions disabled, but "operator new" and
"operator new[]" still throw std::bad_alloc on failure rather than
returning new. In general this is a good thing, because it will cause
an immediate crash of the process rather than assigning a null pointer
which is probably not checked. But most memory allocations in Keymaster
are checked, because it's written to run in an environment where new
does *not* throw. This CL updates the code to explicitly use the
non-throwing new.

A handful of throwing news remain, but only in places where a crash on
failure is appropriate.

In addition, this CL also inserts buffer wrap checks in key locations
and changes the development-machine Makefile to build in 32-bit mode, to
make memory problems more apparent.

Bug: 21888473
Change-Id: I8ebc5ec12053e4f5274f6f57ce312abc10611cef
/system/keymaster/openssl_utils.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/openssl_utils.cpp
9c65b2bd1978a918b52a459596dafc7dde992416 08-Apr-2015 Shawn Willden <swillden@google.com> Remove reference to DSA and rename KM_ALGORITHM_ECDSA.

Change-Id: Ibffddc5c3a5c728182f5ca7f6a76381413fc8645
/system/keymaster/openssl_utils.cpp
4d306ec792b4348253aa77dff965bff5def1dccb 04-Mar-2015 Shawn Willden <swillden@google.com> Factor PKCS8 to EVP conversion out of AsymmetricKey.

Bug: 19508876
Change-Id: I7d5a7363a43c47dc33b0de53040b593de096e1c3
/system/keymaster/openssl_utils.cpp