Commit Graph

383 Commits

Author SHA1 Message Date
Shawn Willden
ef8bdc4f1d Update KeyMint VINTF fragment to version 2
Bug: 221390931
Test: vts -m vts_treble_vintf_vendor_test
Change-Id: I62746b9b60b4b236c0cbb8d2c2edd519c61a71ac
2022-02-28 09:35:59 -07:00
Shawn Willden
0cc617cab0 Provide alternate SE RoT provisioning path.
On some devices it is infeasible to provision the KeyMint RoT bits in
the Android Bootloader.  This provides an alternate path to provision
them from the TEE during early boot.

Bug: 219076736
Test: VtsAidlKeyMintTargetTest
Change-Id: If69f7e25e58edbf4d2190084e2c0a03a94bfa5d6
Merged-In: If69f7e25e58edbf4d2190084e2c0a03a94bfa5d6
2022-02-22 23:52:18 -07:00
Treehugger Robot
0f7d419136 Merge "Fixed vts tests cases which do not support factory attestation. Test: Run keymint Vts tests." 2022-02-16 15:50:30 +00:00
Alan Stokes
4aab4f7704 Allow CompOS to use DICE from C++
Bug: 218494522
Test: Builds
Change-Id: Ica240e1d268403ba546d83c86596d72bacec2bdf
2022-02-10 15:05:48 +00:00
Treehugger Robot
fc3fdf1a96 Merge "Make os_version optional for StrongBox" 2022-02-08 22:59:29 +00:00
subrahmanyaman
0564249f93 Fixed vts tests cases which do not support factory attestation.
Test: Run keymint Vts tests.

Change-Id: I8055fef8df5ec77e317f810f9b95a53311b23cf0
2022-02-05 07:12:33 +00:00
Max Bires
9c28a1ed3a Make os_version optional for StrongBox
This change allows the os_version in the DeviceInfo map to be optional
for StrongBox implementations. It also adds the appropriate changes to
the VTS test to relax this requirement.

Bug: 215444522
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I1695b7c4e7a9bd884fa88c14f9c22bacd38cdbd3
2022-02-03 19:17:38 -08:00
Max Bires
4820b542fa Merge "Enforcing canonicalization of DeviceInfo." 2022-02-04 02:44:54 +00:00
Max Bires
fbc0db2cd2 Fixing spec discrepancy in MacedPublicKey
The algorithm choice was listed as -8 for ES256, when it should be -7.

Fixes: 217691766
Test: Everyone harmoniously agrees by +2'ing.
Change-Id: I7f73efff42ee6d2b3bfb94b74c1208170805b870
2022-02-03 18:51:56 +00:00
Max Bires
8c255e69bf Enforcing canonicalization of DeviceInfo.
This change specifies that the DeviceInfo map returned by the IRPC HAL
implementation should be canonicalized. Additionally, it adds coverage
to the VTS tests to ensure this requirement is enforced.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I276f38497a307c407d305b62a3e9af78a403054e
2022-02-03 01:00:03 +00:00
Treehugger Robot
87a6fbc5cd Merge "Changing DeviceInfo fields to be mandatory." 2022-02-03 00:27:21 +00:00
Max Bires
8b09c50e49 Changing DeviceInfo fields to be mandatory.
This change removes the optionality ("?") from all of the device info
fields, now that DeviceIDs are mandatory. It also changes att_id_state
to the broader "fused" category. It may not convey exactly the same
meaning, but it seems better to avoid proliferating a lot of fields that
all speak to some technical detail of the factory provisioning status of
the device.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Iaf3de6a7a7a9b8af7d2e9673d7f1320858b95617
2022-02-02 14:18:36 -08:00
Treehugger Robot
fefa4986db Merge "Remove 'ops' field from BCC public keys." 2022-02-02 20:47:25 +00:00
Max Bires
2b5db8eae4 Remove 'ops' field from BCC public keys.
The application of ops is currently inconsistent within the spec, and
wrong where it is specified. It is mapped to an integer when it should
be mapped to an array that contains the integer value. Given that all
key usage is strictly defined within the spec itself, there is no value
currently in including the ops field. Because of this, the choice is
being made to simply remove the field.

Test: documentation change only
Change-Id: Ia3a9895c7840e3cda9c2775080b7dcb18544d417
2022-02-01 19:35:58 -08:00
Treehugger Robot
608099fd88 Merge "Include the CWT validation in VTS testing." 2022-02-02 02:14:02 +00:00
Max Bires
81880284af Include the CWT validation in VTS testing.
This change modifies the VTS tests to validate the structure of the CBOR
Web Token (CWT) which contains the public key as one of several fields
in the map. It only validates the subset of fields expected to be seen
in the VTS tests. The ones related to the actual BCC will not be
present in test mode due to the security guarantees of the interface.

Additionally, the test will also now check that the first key in the BCC
array matches the public key that should be self-signed in the
certificate located in the second index of the BCC array.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I9e7769861529b8095d77ce8fee3c78222579d38c
2022-02-02 02:13:26 +00:00
Seth Moore
ff225d91c0 Merge changes from topic "revert-1959803-revert-1956689-add rkp to identity-default-ENFHZTRTBV-OLKYWRVSFZ"
* changes:
  Revert^2 "Add remote key provisioning to the IC HAL"
  Revert^2 "Refactor IC support for RKP"
  Revert^2 "Log to logd in the default identity service"
  Revert^2 "Fix formatting of identity credential aidl"
2022-01-27 18:18:12 +00:00
Steven Moreland
c82603654a Merge "-= src_available" 2022-01-26 23:43:03 +00:00
Steven Moreland
fe0546fe14 -= src_available
Default now. To Remove.

Bug: 215754978
Test: N/A
Change-Id: I4042a83ae624187570e7e2b2a7a1c1282906f6d0
2022-01-25 23:38:32 +00:00
Seth Moore
1bf823ce75 Revert^2 "Add remote key provisioning to the IC HAL"
be32113307

Change-Id: I55ddbddd0bc317f1f077a63b0275c4d55fd9c76f
2022-01-25 23:04:37 +00:00
Seth Moore
6278c2d241 Merge changes from topic "revert-1956689-add rkp to identity-default-ENFHZTRTBV"
* changes:
  Revert "Fix formatting of identity credential aidl"
  Revert "Log to logd in the default identity service"
  Revert "Refactor IC support for RKP"
  Revert "Add remote key provisioning to the IC HAL"
2022-01-25 23:03:24 +00:00
Seth Moore
be32113307 Revert "Add remote key provisioning to the IC HAL"
Revert "Add dependency on keymint cpp lib"

Revert "Allow default identity service to call keymint"

Revert submission 1956689-add rkp to identity-default

Reason for revert: Broke git-master. Will resubmit later.
Reverted Changes:
I96dcf3027:Add remote key provisioning to the IC HAL
Id686ac33a:Add dependency on keymint cpp lib
Ib368a2a00:Log to logd in the default identity service
I7d2906de0:Refactor IC support for RKP
Iae0f14f1c:Fix formatting of identity credential aidl
I01d086a4b:Allow default identity service to call keymint

Change-Id: I76a898c04090c5befe5fb5a5d07ec2e397fdd8b3
2022-01-25 22:44:24 +00:00
Seth Moore
79fdf4d688 Merge changes from topic "add rkp to identity-default"
* changes:
  Add remote key provisioning to the IC HAL
  Refactor IC support for RKP
  Log to logd in the default identity service
  Fix formatting of identity credential aidl
2022-01-25 20:33:01 +00:00
Seth Moore
3511d287ba Merge "Add uniqueId to IRemotelyProvisionedComponent" 2022-01-25 13:11:34 +00:00
Seth Moore
b5b69f0e00 Add remote key provisioning to the IC HAL
The IIdentityCredentialStore can now advertise the correct
IRemotelyProvisionedComponent that is used for getting remotely
provisioned attestation keys.

IWritableIdentityCredential has a new method so it can accept remotely
provisioned keys.

Update the VTS tests to check the new RKP functionality.

Support RKP in the default identity cred service

Test: VtsHalIdentityTargetTest
Bug: 194696876
Change-Id: I96dcf3027e0f21790c35900ddf8cc0953bd3b1ca
2022-01-24 16:19:21 -08:00
Seth Moore
fc86bf4d5f Add uniqueId to IRemotelyProvisionedComponent
This id is used to differentiate between implementations of the
IRemotelyProvisionedComponent interface. This is required to track
certificates and keys for each implementation. Without an implementation
id, we would have no way to associate persisted, remote provisioning
data with the appropriate IRemotelyProvisionedComponent.

Include VTS tests for compliance.

Test: VtsHalRemotelyProvisionedComponentTargetTest
Bug: 194696876

Change-Id: Id8bca26d71ecf9e389e68a269f782a9dc5ee6f01
2022-01-24 16:19:21 -08:00
David Drysdale
4af9762ef7 Merge changes Ibfb6a54c,Ifa0f95fd
* changes:
  KeyMint VTS: police Ed25519 msg size limit
  KeyMint VTS: test curve 25519 functionality
2022-01-24 09:06:17 +00:00
David Drysdale
feab5d932f KeyMint VTS: police Ed25519 msg size limit
Ed25519 signing operations require the secure world to accumulate the
entirety of the message; consequently, impose a limit on message size
for this operation.

Bug: 194358913
Test: VtsAidlKeyMintTargetTest
Change-Id: Ibfb6a54c1d546b5b4e51f42795d2bb4660add772
2022-01-21 07:12:23 +00:00
Treehugger Robot
9bea46c467 Merge "DICE: Use fixed sized arrays for fixed sized fields." 2022-01-18 19:32:16 +00:00
Alan Stokes
cd938514ba Allow CompOS to use DICE
Bug: 214233409
Test: Builds
Change-Id: I1640b64fbb4b63097106dba56269fe1cac6d1679
2022-01-17 15:49:11 +00:00
David Drysdale
34288aa2ee Merge "Alter spec text for RSA-PSS to match reality" 2022-01-17 06:53:26 +00:00
Brian J Murray
734c841daf Block cipher fixups
Various block cipher testing fixups. Some of these changes reflect edge
cases I encountered when running local GSC builds.

Change:
* Extend ciphertext lengths.
* Add SCOPED_TRACE() within for loops.
* Use '\t' instead of 'a' for PKCS7 padding.

Test: CTS/VTS

Signed-off-by: Brian J Murray <brianjmurray@google.com>
Change-Id: I4555519787e0133367ad3f40609d43a7bc71c36e
2022-01-14 17:41:53 +00:00
David Drysdale
c6b8907a32 Alter spec text for RSA-PSS to match reality
The Key{Mint,Master} spec previously said that RSA-PSS mode should use
SHA-1 for the MGF1 digest, separately from whatever Tag::DIGEST gets
specified as the main digest.

However, both the reference implementation and the VTS/CTS tests
use BoringSSL's defaults, which is to re-use the main digest as the MGF1
digest if none is separately specified.

Given that this behaviour is embedded in many implementations over
several years (and given that there isn't a security implication),
change the spec to match this behaviour.  Also update the VTS test
code to make this clear/obvious.

Test: VtsAidlKeyMintTargetTest, VtsHalKeymasterV4_0TargetTest
Bug: 210424594
Merged-In: I4303f28d094ef4d4b9dc931d6728b1fa040de20d
Change-Id: I4303f28d094ef4d4b9dc931d6728b1fa040de20d
2022-01-13 09:13:08 +00:00
David Drysdale
42fe189633 KeyMint VTS: test curve 25519 functionality
- Add CURVE_25519 as a supported curve for EC operations.
- Add a helper that checks whether the HAL is of a version that is
  expected to support curve 25519, and skip relevant tests if not.
- Ed25519 support
  - Update KeyMintAidlTestBase::LocalVerifyMessage to cope with a public
    key of type EVP_PKEY_ED25519.
  - Add a test key pair generated with openssl command line.
  - Key generation test
  - Key import test for raw format
  - Key import test for PKCS#8 format
  - Key import failures tests
  - Signature test
  - Check that purposes cannot be combined (Ed25519 != X25519)
  - Check that Ed25519 key can be attested to
  - Implicitly check that an Ed25519 key can be used for attestation
    (as it is in ValidCurves())
  - Force Digest::NONE for Ed25519 throughout.
- X25519 support
  - Add a test key pair generated with openssl command line.
  - Key generation test
  - Key import test for raw format
  - Key import test for PKCS#8 format
  - Key import failures tests
  - Key agreement test, including...
  - Refactoring of existing key agreement test for re-use
  - Update key agreement checks to cope with a public key of type
    EVP_PLEY_X25519.
  - Key agreement test using imported key
  - Check that purposes cannot be combined (Ed25519 != X25519)

Bug: 194358913
Test: VtsAidlKeyMintTargetTest
Change-Id: Ifa0f95fdfba4387843c8e821c2ca977da0488fa6
2022-01-12 10:58:19 +00:00
Janis Danisevskis
37f1609ed5 DICE: Use fixed sized arrays for fixed sized fields.
Bug: 210149444
Test: N/A
Change-Id: I1d4e502cb6535117f51d2d0ce008f2669fc90e96
2022-01-11 11:06:35 -08:00
Brian J Murray
eabd9d6d2a Verify op_ is not a nullptr
If op_ is a nullptr, the test runner can SIGSEGV.

Test: manual, atest EncryptionOperationsTest#TripleDesCbcPkcs7PaddingCorrupted
Bug: None

Signed-off-by: Brian J Murray <brianjmurray@google.com>
Change-Id: Ibdd6139952ca8bc83ac1a82202839feee39562e1
2022-01-06 15:26:16 -08:00
David Drysdale
17393cbb40 Merge "KeyMint: new version number in attestation" 2021-12-16 09:37:15 +00:00
Treehugger Robot
b05a7c1376 Merge "Add android.hardware.security.dice HAL interface." 2021-12-16 00:16:45 +00:00
Janis Danisevskis
c3cc5a0b21 Add android.hardware.security.dice HAL interface.
The dice HAL provides access to the Dice artifacts of the running Android
instance.

Bug: 198197213
Test: VTS test comming in two ...
Change-Id: I6e84f9a9c7153e7a96c06d1d451e658b3f222586
2021-12-15 08:52:07 -08:00
David Drysdale
7dff4fc9b7 KeyMint: new version number in attestation
For the time being, allow the version number in the attestation record
to be 100 even if the AIDL version is 2, so that implementations don't
have to update both versions simultaneously.

Bug: 194358913
Test: TreeHugger, VtsAidlKeyMintTargetTest
Change-Id: I9aae69327a62014e286ce30ca2a4d91c4c280714
2021-12-15 14:31:19 +00:00
David Drysdale
a67b0441fe Merge "KeyMint VTS: ATTEST_KEY has no other purpose" 2021-12-15 06:25:35 +00:00
Seth Moore
0834ba697f Merge "Revert^2 "KeyMint HAL: add curve 25519, bump version"" 2021-12-14 18:49:58 +00:00
Steven Moreland
ffb03995e6 CHECK -> CHECK_EQ copy pasta
Hey did I start this? We can take a little bit better errors. :)

Bug: N/A
Test: N/A
Change-Id: I0e96f7f49dae9968904333da9b8269694058c11c
2021-12-14 01:45:47 +00:00
Seth Moore
d79a0ec9ed Revert^2 "KeyMint HAL: add curve 25519, bump version"
e76045d7b0

Change-Id: Ia167fd45b6e590e34523810ee10118c5c141f538
2021-12-13 20:03:33 +00:00
David Drysdale
391a772300 Merge "Revert "KeyMint HAL: add curve 25519, bump version"" 2021-12-13 16:14:16 +00:00
David Drysdale
e76045d7b0 Revert "KeyMint HAL: add curve 25519, bump version"
Revert "Bump keystore2 AIDL API version 1->2"

Revert "Advertise support of KeyMint V2"

Revert submission 1900930-version-bump

Reason for revert: Broken build on sc-qpr1-dev-plus-aosp, b/210450339
Reverted Changes:
I42a9b854f:keystore2: cope with new curve25519 enum
I167d568d6:Bump keystore2 AIDL API version 1->2
I3a16d072e:Advertise support of KeyMint V2
Ibf2325329:KeyMint HAL: add curve 25519, bump version

Change-Id: I78d4b07c41aa6bfeb367b56a58deeac6adb6ec46
2021-12-13 16:01:21 +00:00
Eran Messeri
924613950c Merge "Keymint: Test that corrupting the signature for HMAC verification fails" 2021-12-13 15:51:33 +00:00
David Drysdale
f21e1a5c4a Merge "KeyMint HAL: add curve 25519, bump version" 2021-12-13 14:25:22 +00:00
David Drysdale
c069a75302 KeyMint HAL: add curve 25519, bump version
Marked as required for TRUSTED_ENVIRONMENT impls but not STRONGBOX.

Bump keymint HAL version 1->2 in defaults and in current compatibility
matrix.

Bug: 194358913
Test: build
Change-Id: Ibf2325329f0656a2d1fc416c2f9a74d505d0bf20
2021-12-09 14:07:51 -08:00
Prashant Patil
dec9fdc81d Keymint: Test that corrupting the signature for HMAC verification fails
A VTS test case to verify HMAC signature verification fails if data or
signature is currupted.

Bug: 209452930
Test: run vts -m VtsAidlKeyMintTargetTest
Change-Id: I2177fd99cfab4ef4a347d50461db0d2e3ad8c612
2021-12-09 13:41:30 +00:00