Commit graph

45 commits

Author SHA1 Message Date
Shawn Willden
1227f460ce Merge "Add keymaster2 HAL." am: 0c5612db38
am: 7b4766882d

* commit '7b4766882d1a11a4b87570e7f0b83c5116a64f07':
  Add keymaster2 HAL.
2016-01-25 17:40:10 +00:00
Shawn Willden
cf30fe17fd Add keymaster2 HAL.
Change-Id: Ibfcda30f33077f61e74701fa026983f9e72e140e
2016-01-21 12:19:31 -07:00
Shawn Willden
20e4f8ea3b Merge "ECIES: adding ECIES-KEM" am: 3aa7935ef2 am: 7adb2d457c
am: 2eef78d355

* commit '2eef78d355c62f3e1b5ec626a080a7e3f91257c9':
  ECIES: adding ECIES-KEM
2015-11-23 16:36:47 +00:00
Thai Duong
40d59c8155 ECIES: adding ECIES-KEM
Change-Id: Iea5877eba0a9b13610d3d1b33d04b5657edc3550
2015-11-23 06:41:33 -07:00
Chad Brubaker
a3c0ae16ac Fix benign unsigned overflow
On the last check of the conditional param_count-- causes an unsigned
wrap around. This isn't incorrect but does lead to a false positive with
fsanitize unsigned-integer-overflow

Change-Id: If3eb7a9e248d0404a434de2ead70e8c099e84ddf
2015-08-12 12:46:44 -07:00
Shawn Willden
70335f3d30 Correct keymaster1 documentation.
Bug: 22291207
Change-Id: I130d2ab2110321dc2228d41a154750da3a3f0b75
2015-07-23 12:54:15 -06:00
Shawn Willden
a3f0ab55a7 Add KM_TAG_MIN_MAC_LENGTH.
This allows the binding of minimum length for MACs or tags to HMAC keys
and AEAD symmetric keys.  Later attempts to use these keys with a
shorter MAC or tag specification (provided to begin() with
KM_TAG_MAC_LENGTH) will fail with KM_ERROR_INVALID_MAC_LENGTH.

Bug: 22337277
Change-Id: Ic5292ce01bdd6ecde25aad115e4b407aadc85f23
2015-07-15 10:07:59 -06:00
Shawn Willden
fe6bcfa71d Revert "Revert "Rename keymaster tag types to clarify that integers are unsigned.""
This reverts commit 1fb6c227de.

Change-Id: Iccc8a7ff40a694b1e4420a5de4b847e62289ff42
2015-06-24 20:59:14 +00:00
Shawn Willden
1fb6c227de Revert "Rename keymaster tag types to clarify that integers are unsigned."
This reverts commit 335920edae.

Change-Id: Ib65f744b93ad2b62d5848dcf743397124a08911b
2015-06-24 20:52:32 +00:00
Shawn Willden
335920edae Rename keymaster tag types to clarify that integers are unsigned.
Bug: 22008538
Change-Id: I699a0f03aaf0f9f49a78b310763364fc2fb34c90
2015-06-24 13:26:52 -07:00
Shawn Willden
396d6cbce9 Add new error codes for rate-limit and max-use failures.
Bug: 21607106
Change-Id: I2e5515efe51b84200ade8c4c4cc5db3800d4b658
2015-06-18 21:20:47 -06:00
Shawn Willden
7ac0c0f5ad Update comments on now-unsed user ID and app ID tags.
I'd just remove them but Trusty keymaster has been generating keys with
KM_TAG_ALL_USERS and KM_TAG_ALL_APPLICATIONS, so removing them without
breaking those keys is tricky.  Plus I think they may come back.

Bug: 21845167
Change-Id: I3b807e3e4bee64eba72b7fa6f1ee1929c4ca9dd0
2015-06-18 12:20:32 -06:00
Shawn Willden
da89dde978 Remove KM_TAG_AEAD_TAG.
Bug: 19919114
Change-Id: I06fdd0f9b8e247587d800031d3367078423baa50
2015-06-18 12:19:03 -06:00
Shawn Willden
7eaa15ffa6 Fix extern "C" guards.
Change-Id: Ibc8e023e3712903dbcbfac5fc64223e32775fe40
2015-06-03 09:03:20 -06:00
Shawn Willden
4144c64818 Remove KM_TAG_CHUNK_LENGTH and add KM_TAG_AEAD_TAG
Bug: 19919114
Change-Id: I384f3d2fee2f68279c6518d9ac0a79e29bed0e52
2015-06-02 09:01:30 -06:00
Shawn Willden
4c19a3af35 Fix block mode numbering (CTR got added as 4 rather than 3)
Change-Id: I8c886c67ba081255ef18eb0f99ca1e6003fabb33
2015-06-01 14:52:54 -06:00
Shawn Willden
fb769fc312 Add KM_TAG_BOOTLOADER_ONLY.
Change-Id: Ia507a1378487640683985dbce2e76679261900d3
(cherry picked from commit 3eed99a54b)
2015-05-12 12:09:56 +00:00
Shawn Willden
9b31a49c36 Remove rescoping.
Rescoping was never a very good solution to the problem of supporting
multiple sets of authorizations for a given key material.  For M we're
removing it and in the future a better solution will be provided.

Change-Id: I6f7585274487bd66e4d90e89014af41e9aa30411
(cherry picked from commit 7f10ab99fc)
2015-05-12 11:29:27 +00:00
Shawn Willden
4bdd7cbd47 Add KM_ERROR_CALLER_NONCE_PROHIBITED error code.
Bug: 20127433
Change-Id: I32eab62459003c526d3cf9ef108be7b2fd709960
2015-04-29 22:33:35 -06:00
Shawn Willden
d359b04483 Add KM_ORIGIN_UNKNOWN.
This designates keys whose origin cannot be determined because the
keymaster implementation is old and did not record it.

Change-Id: I3c366d527ed211c59f6dc04ddb48f3e9b3a07c7d
2015-04-13 12:13:35 -06:00
Shawn Willden
fe895d1bf7 Make several key crypto parameters repeatable.
Note that there's a pre-requisite to landing this CL: The Nexus 9
keystore.flounder.so must be modified to translate between new and old
tag numbers when the TEE side is version 0.

Bug: 19509156
Change-Id: Ic584d8a6bf5601f9754563b67b3cc6b3ca6b5ff9
2015-04-10 11:02:43 -06:00
Shawn Willden
8d6cf2594c Simplify keymaster_key_origin_t.
Change-Id: Iaba6156f238ea3bb1ad103b88ccea17344d296af
2015-04-10 07:28:25 -06:00
Shawn Willden
cd640d125f Reduce the list of keymaster key formats to the required set.
Change-Id: I3a0830ab2066d4c16c084d19040ec98e520896d4
2015-04-09 12:31:18 -06:00
Shawn Willden
8412fdc428 Reduce the list of keymaster padding modes to the required set.
Change-Id: If04ffc8e92678f57e2b730f77c0fab195e1096c4
2015-04-09 12:31:18 -06:00
Shawn Willden
fe6c4f0633 Reduce keymaster digest list to required set.
Change-Id: Id5c660feb7e71ea76473523e3a86e1ba01f19c82
2015-04-09 12:31:18 -06:00
Shawn Willden
c7deedad04 Reduce keymaster block modes to the required set.
Change-Id: I8f804978208e2c8701bd52dc79b5597a307b7e7a
2015-04-09 12:31:18 -06:00
Shawn Willden
e9797a740c Reduce keymaster algorithm list to the required set.
Change-Id: Ibffddc5c3a5c728182f5ca7f6a76381413fc8645
2015-04-09 12:31:09 -06:00
Shawn Willden
4719acae02 Add KM_TAG_USER_SECURE_ID.
This tag identifies the user authorized to use the key.  Unlike
KM_TAG_USER_ID, its value does not reference the Linux-side user ID, but
a secure-world user ID, generated and managed by secure-world
authentication apps.

Bug: 19511945
Change-Id: I629ab2c47ee6d42de20a963ef283e330364c8ee7
2015-03-18 19:25:07 -06:00
Shawn Willden
c51d01ed02 Use extern "C" rather than BEGIN/END_DECLS.
For compatibility with Trusty.  I'll probably revert this later after I
find a proper fix for Trusty.

Change-Id: I49b4ae55251398eec2a6633e09bbc468f16a4d14
2015-03-18 19:25:01 -06:00
Shawn Willden
c3ab05c3c4 Add KM_TAG_AUTH_TOKEN and corresponding auth token structure.
We may want to put the auth token structure elsewhere; it's consumed by
keymaster but produced by other components.

Bug: 19511945
Change-Id: Id9a22ad32137f3e0380c2812f790bbecab511d11
2015-03-18 17:40:34 -06:00
Shawn Willden
ed94111cce Add error codes.
Change-Id: I78cac1887fd41dd426e7d125a5f9c54e73188983
2015-03-11 21:54:26 -06:00
Shawn Willden
67411d6f51 Add keymaster_key_param_compare function.
This provides a reasonable ordering for params.

Change-Id: I1e3b403070d9e7621cc55c03ff9876ea3bbc699f
2015-03-04 10:04:35 -07:00
Shawn Willden
fd4b4d5a9b Separate keymaster0 and keymaster1 HALs.
For now the keymaster1 HAL still includes all of the keymaster0 entry
points, and soft_keymaster_device will continue to implement them.  In
the near future the keymaster0 entry points will be removed, as soon as
we can ensure that keystore no longer needs them.

Change-Id: I5c54282c12d1c4b8b22ed4929b6e6c724a94ede4
2015-02-24 14:58:17 -07:00
Alex Klyubin
340d0b12c5 Clarify the meaning of KM_TAG_MAC_LENGTH.
Change-Id: I18478923059783e955613142a8d3352f98f5d7b0
2015-02-20 16:42:23 -08:00
Shawn Willden
0e5fca1ca4 Merge changes Id4bdfdcb,Ib94f3606
* changes:
  Added insecure (chunkless) AEAD option.
  Add additional param lists to update and finish.
2015-02-18 15:48:03 +00:00
Shawn Willden
892ae44c5f Merge "Rename KM_TAG_ADDITIONAL_DATA to KM_TAG_ASSOCIATED_DATA" 2015-02-18 05:50:07 +00:00
Chad Brubaker
f883b988e7 Add explicit values to keymaster_key_format_t
Change-Id: I4113286396b16ca687fbd8bc38b2f16063fc1024
2015-02-13 13:58:36 -08:00
Shawn Willden
79d7934684 Added insecure (chunkless) AEAD option.
Also moved chunk length specification to operation parameter rather than
keygen parameter.

Change-Id: Id4bdfdcb1c7b64b3f22b4027e037e37c2860ec39
2015-02-10 15:15:47 -07:00
Shawn Willden
67ba9e8144 Rename KM_TAG_ADDITIONAL_DATA to KM_TAG_ASSOCIATED_DATA
Change-Id: Ieddd706ee205100719f7e2f9e18b3d9b07c37669
2015-02-09 16:02:51 -07:00
Shawn Willden
e1b7636ca1 Add raw key format, for symmetric key import.
Change-Id: I38700cdafcf1f244584d6e88f8d9540c70a7de56
2015-02-03 11:12:20 -07:00
Shawn Willden
f7745ac27e Remove "required" label from DSA algorithm.
Change-Id: I088e6094ec56f434356d11ab2032b1a5b1223334
2015-02-03 11:10:48 -07:00
Shawn Willden
41e91e9fa3 Add tag to allow caller-specified nonce.
Change-Id: I7c3c5bd5f26a4d465554c998f673e0ee2ab8b86e
2015-02-02 11:52:14 -07:00
Shawn Willden
6b424bea80 Rename KM_ERROR_UNSUPPORTED_TAG_LENGTH to
KM_ERROR_UNSUPPORTED_MAC_LENGTH.

Change-Id: I514a136b5cbdb1ab1df67d44a22d68a09427a711
2015-01-26 13:04:28 -07:00
Shawn Willden
dc0007bdb4 Change per-boot tag and remove rescope auth timeout tag.
Change the boolean KM_TAG_SINGLE_USE_PER_BOOT to an integer-valued
KM_TAG_USES_PER_BOOT.  This makes it more flexible without changing
implementation complexity.

Remove KM_TAG_RESCOPE_AUTH_TIMEOUT because there's no clear use case and
it seems unnecessarily complex.

Change-Id: Iad1512f5cc80f517e5ea7622288179c162bed2ad
2015-01-23 13:47:59 -07:00
Shawn Willden
9d645a003b Define keymaster HAL v0.4.
Change-Id: I040412443bbbe25bce3d44759d710b78eac36caa
2015-01-22 10:54:31 -07:00