History log of /system/security/keystore/keystore_client_impl.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c7a9fa29c185a8c1889486d4acf00fd59c513870 13-Oct-2016 Janis Danisevskis <jdanis@google.com> Port to binderized keymaster HAL

This patch ports keystore to the HIDL based binderized keymaster HAL.
Keystore has no more dependencies on legacy keymaster headers, and
therefore data structures, constant declarations, or enums. All
keymaster related data structures and enums used by keystore are the
once defined by the HIDL based keymaster HAL definition. In the process
of porting, keystore underwent some changes:

* Keystore got a new implementation of AuthorizationSet that is fully
based on the new HIDL data structures. Key parameters are now either
organised as AuthorizationSets or hidl_vec<KeyParameter>. (Formerly,
this was a mixture of keymaster's AuthorizationSet,
std::vec<keymaster_key_param_t>, and keymaster_key_param_set_t.) The
former is used for memory management and provides algorithms for
assembling, joining, and subtracting sets of parameters. The latter
is used as wire format for the HAL IPC; it can wrap the memory owned
by an AuthorizationSet for this purpose. The AuthorizationSet is
accompanied by a new implementation of type safe functions for
creating and accessing tagged key parameters,
Authorizations (keystore/keymaster_tags.h).
* A new type (KSSReturnCode) was introduced that wraps keystore service
response codes. Keystore has two sets of error codes. ErrorCode
errors are less than 0 and use 0 as success value. ResponseCode
errors are greater than zero and use 1 as success value. This patch
changes ResponseCode to be an enum class so that is no longer
assignable to int without a cast. The new return type can only be
initialized by ResponseCode or ErrorCode and when accessed as int32_t,
which happens on serialization when the response is send to a client,
the success values are coalesced onto 1 as expected by the
clients. KSSreturnCode is also comparable to ResponseCode and
ErrorCode, and the predicate isOk() returns true if it was initialized
with either ErrorCode::OK (0) or ReponseCode::NO_ERROR (1).
* A bug was fixed, that caused the keystore verify function to return
success, regardless of the input, internal errors, or lack of
permissions.
* The marshalling code in IKeystoreService.cpp was rewritten. For data
structures that are known to keymaster, the client facing side of
keystore uses HIDL based data structures as (target) source
for (un)marshaling to avoid further conversion. hidl_vecs are used to
wrap parcel memory without copying and taking ownership where
possible.
* Explicit use of malloc is reduced (malloc was required by the C nature
of the old HAL). The new implementations avoid explicit use of
malloc/new and waive the use of pointers for return values. Instead,
functions return by value objects that take ownership of secondary
memory allocations where required.

Test: runtest --path=cts/tests/tests/keystore/src/android/keystore/cts

Bug: 32020919
Change-Id: I59d3a0f4a6bdf6bb3bbf791ad8827c463effa286
/system/security/keystore/keystore_client_impl.cpp
ce1f913223faf41b5ee2ffba54702b54e17d6606 03-Nov-2015 Gaurav Shah <gauravsh@google.com> keystore: Pass kDefaultUid to Keystore service methods

BUG: none
Change-Id: Id2a9d57116097c9aefdb20f6377be2eb48d9f470
/system/security/keystore/keystore_client_impl.cpp
c8eca23793dcaf933c4dace4127de710698b7a4c 16-Oct-2015 Darren Krahn <dkrahn@google.com> Reallocate keymaster parameters with malloc.

Keystore assumes keymaster parameters are allocated with malloc but
keymaster's AuthorizationSet allocates with new[]. To avoid memory
corruption, reallocate with malloc before passing to keystore.

BUG: 24905120

Change-Id: I958d5060b08bb0c97eceded354241e0948d5f3b2
/system/security/keystore/keystore_client_impl.cpp
251cb28132e456f81374c8f8a983a5a9ad9aaee8 28-Sep-2015 Darren Krahn <dkrahn@google.com> Add encryption convenience methods to KeystoreClient.

This Cl adds authenticated encryption and decryption methods which
require minimal inputs. These methods are suitable for encrypting local
state on brillo.

BUG: 23528174
TEST=manual using the keystore_cli_v2 tool

Change-Id: I41abcd77452e86b1eb7373f9db95b645100e2f0f
/system/security/keystore/keystore_client_impl.cpp
69a3dbc2bbbe0b304eb91376ff7f79c8bde995a1 23-Sep-2015 Darren Krahn <dkrahn@google.com> Create a KeystoreClient class.

KeystoreClient is designed to give native brillo services convenient
access to keystore services. This CL also includes a command line tool
that uses the KeystoreClient interface. This was used for testing but
can also be enhanced to be generally useful.

BUG: 23528174
TEST=manual tests using keystore_cli_v2

Change-Id: I6266d98cfc7c4936f803a8133020c032bc519a5b
/system/security/keystore/keystore_client_impl.cpp