Commit graph

24 commits

Author SHA1 Message Date
Janis Danisevskis
2437fde7a6 Keystore 2.0: Remove Keystore 1.0 and remaining references
* Remove superseded keystore engine backends.
* Remove keystore_cli.
* Update keystoer_cli_v2 to use Keystore 2.0.
* Update confirmationui invocation test.
* Remove reference to enable keystore2 property from keystore2.rc.

Test: N/A
Bug: 171305684

Change-Id: I855dead9d95c2c8cfa451944087bc8290871c0e5
2021-03-22 14:34:45 -07:00
Janis Danisevskis
670122f587 Keystore 2.0: Add keystore2 support to the keystore-engine.
Test: ???
Bug: 173546268
Bug: 171305607
Bug: 175068876
Change-Id: Ib44a8787d31a994453ab56022546cfbc5b76516e
2021-02-24 12:32:32 -08:00
David Benjamin
dc4d142303 Replace custom BoringSSL scopers with bssl::UniquePtr.
BoringSSL already provides C++ scopers.

Test: mma
Change-Id: I34d4ec36fc0b51750560be0886768a83fe69fbf5
2019-08-08 13:13:54 -04:00
Rob Barnes
bb6cabdaa1 Multi-threaded keystore
This patches changes the keystore to use the asychronous api model for
begin, update, finish, and abort.

Also removes unused class KeystoreArguments (aidl and implementation).

Test: Keystore CTS tests
Bug: 111443219

Change-Id: Icc6def9ff6dbe32193272d7d015079a006ebc430
2018-11-14 14:01:45 -08:00
Logan Chien
cdc813f782 Deprecate <cutils/log.h> and <utils/Log.h>
This commit replaces <cutils/log.h> and <utils/Log.h> with <log/log.h>.

Background:
<cutils/log.h> has been moved to <log/log.h> for a while.  Both
<cutils/log.h> and <utils/Log.h> simply includes <log/log.h> for
backward compatibility.  This commit is a part of the effort to remove
<cutils/log.h> and <utils/Log.h> from the source tree eventually.

Bug: 78370064
Test: lunch aosp_walleye-userdebug && cd system/security && mma
Change-Id: I798f06d78e2cc5cd197727c0bcdd05c87d769a90
2018-09-19 13:38:34 +08:00
Yi Kong
d29167516f Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I41cd58617d6df6de7942a541fb6dc9519c70bef0
Merged-In: I41cd58617d6df6de7942a541fb6dc9519c70bef0
2018-07-30 08:41:16 +00:00
David Benjamin
48d2ea912e Remove RSA_FLAG_CACHE_PUBLIC.
This flag hasn't done anything in BoringSSL since March 2016.

Test: mma
Change-Id: I3972d7c006daa4370772363d7debf64b0c9713da
2017-12-15 18:37:02 -05:00
Robert Sloan
a786d0becd Merge "Switch *_METHOD to a more future-proof pattern."
am: f3147f209c

Change-Id: I68777f100f68cfdcf36d9a79b0c72433764cc429
2017-09-20 16:25:58 +00:00
Robert Sloan
29f72ecdfd Switch *_METHOD to a more future-proof pattern.
This matches the other uses in Android and would have avoided
https://android-review.googlesource.com/c/423260/.

(cherry-picked from 472d59a651 on git_master)

Test: mma
Change-Id: I81f6092ab50ff408a48f18bcbca2a50cf9717ca6
2017-09-20 01:47:57 +00:00
Rob Sloan
ae9fa426cb Merge "Update BoringSSL structs in keystore-engine." am: 975e1aae69 am: 78505bae4c
am: 7d6eedfc47

Change-Id: Ib22db541b587fdde996d51660eb6f21e19875c13
2017-06-27 17:45:37 +00:00
Rob Sloan
78505bae4c Merge "Update BoringSSL structs in keystore-engine."
am: 975e1aae69

Change-Id: I4cd2a30d7281476eb30083dc04187784f8dad445
2017-06-27 17:38:12 +00:00
Robert Sloan
0a7e807721 Update BoringSSL structs in keystore-engine.
Test: None yet.
Change-Id: I61fef8270a7fce9e891cbb64cfdf082adf630921
2017-06-26 12:42:55 -07:00
Janis Danisevskis
ccfff10f66 Remove use of UniquePtr from keystore
Remove UniquePtr from keystore in favour of std::unique_ptr

Change-Id: I8e02adab4326028e26dbf59ac836679abe2a40de
2017-05-01 12:34:46 -07:00
Roshan Pius
30b220e734 keystore-engine: Couple of bug fixes for HIDL keystore
Fixes for issues found in wifi integration tests:
1. ensure_keystore_engine() needs to be invoked before we access
|g_keystore_backend|.
2. The HIDL backends need to return 0 when the operation succeeds.

Bug: 34603782
Test: Manual tests.
Change-Id: If61d3bef27dab6f4fb73113f0ed6d3e784a29f32
2017-04-03 13:50:00 -07:00
Paul Stewart
657356c169 Add HIDL backend to keystore service
This CL adds variants of the public key retrieval and signing
routine which use the WiFi Keystore HIDL for the backend.
The Android.mk has been modified to build a second variant of
the library to expose this HIDL backend.  While here, add
guards to all headers.

Bug: 34603782
Test: Able to connect to wifi passpoint networks.
Change-Id: I444ef383e4d3fdabc10c3e44c1bae9747613c8cf
2017-03-29 11:29:43 -07:00
Paul Stewart
ac0ffbf62c Separate the binder backend from android_engine
Create a pure virtual class "KeystoreBackend" which supplies the
crypto methods used by android_engine.  Create a KestoreBackendBinder
class which implements the binder backend as a no-op change that
will allow future backends to be added.

Bug: 34603782
Test: Compiles
Change-Id: I16620aba569bd53290145b2b30242c4888106d0a
2017-03-29 11:29:40 -07:00
Janis Danisevskis
c7a9fa29c1 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
2017-01-23 08:30:49 -07:00
Chih-Hung Hsieh
26275ad6ba Fix misc-macro-parentheses warnings.
Add parentheses around macro arguments used beside binary operators.

Bug: 28705665
Change-Id: I4ea2db63c18e40dabc10d42bfa5c936a71d6c628
2016-05-11 14:26:35 -07:00
David Benjamin
30c77521ca Remove RSA_FLAG_EXT_PKEY from android_engine.cpp.
RSA_FLAG_EXT_PKEY, despite the name, is only about calling the RSA_METHOD's
mod_exp hook while reusing the rest of the RSA_private_transform logic. This
code doesn't provide mod_exp and instead overrides private_transform, so the
flag is a no-op.
2016-03-28 18:06:31 -04:00
Adam Langley
862cf6af40 system/security: remove BORINGSSL_201509 support.
The BORINGSSL_201509 define was used to make updating BoringSSL in
external/boringssl less painful. It allowed code to compile with either
the old BoringSSL (which didn't define BORINGSSL_201509) or with the new
(which does).

Now that the new version has landed, this change removes that support.

Change-Id: I19e661419f830459d015bf14e7905af2ec41b735
2015-09-30 15:06:45 -07:00
Adam Langley
9eb9295d78 Prepare for BoringSSL update.
This change tweaks things as needed so that the code will compile
against both the BoringSSL that's currently in Android and a version
from upstream. The BORINGSSL_201509 define is temporary to allow the
switch to happen without breaking the build and a followup change will
remove it.

Change-Id: I3d09b5644661353723803bcbda937d34455849a5
2015-09-02 15:37:27 -07:00
Kenny Root
dcca0516dd keystore-engine: comment out unused args
This fixes the build when -Werror -Wunused-parameter is enabled in the
compiler options.

Change-Id: I4581492c23885de8d31d2e66483ee281c0045c58
2015-04-18 11:23:35 -07:00
Adam Langley
b2747fedfb system/security: sync with latest BoringSSL.
This change allows system/security to build with the latest BoringSSL.

1) RSA methods have gained a function pointer, |supports_digest|, which
   allows methods to indicate that they only support certain hash
   functions via the high-level interface.

2) EC_GROUP_set_point_conversion_form has been removed (it was
   previously a no-op).

Change-Id: I590094d8904f418cfd6baf064ac9799525fbc09e
2014-12-11 17:21:47 -08:00
Adam Langley
1fb05838c4 Add ENGINE for BoringSSL.
This change adds a new ENGINE implementation for BoringSSL. It's a no-op
until external/openssl is switched to BoringSSL.

BoringSSL's ENGINEs are very different from OpenSSL's (and very much
smaller). Thus this change adds replacement code that is conditionally
compiled when BoringSSL is used.

Rather than building a .so that is put in a special directory and loaded
by OpenSSL dymanically, the code becomes a normal library that exports a
single function: EVP_PKEY_from_keystore. All the |ENGINE_load| etc
functions that callers previously needed become moot with BoringSSL.

Bug: 17409664
Change-Id: I8b5ba255f86ec5d0f28994358dc0f0b516f0af40
2014-09-29 13:20:27 -07:00