Use rdroidtest for running tests as it now supports parameterized
tests (aosp/2885268) and has an attribute macro (aosp/2890086).
Also rustfmt.
Test: VtsSecretkeeperTargetTest
Change-Id: I9570a7f33a6ff7dbf7cb7238fa3770dedb990e8c
This test does not account for potentially missing Sk HAL. Ideally, the
test should pass on those devices too (since Sk is an optional HAL at
the moment).
This test uses should_panic expecting the client code to panic on
processing the message, but that code is never executed because the
backend is not present & the method doesn't panic & the test fails.
As a mitigation, #ignore the test.
Bug: 317416663
Test: VTS show "IGNORED"
Change-Id: I2f1bb45361943f22d8cadc929059c65cb3120f3f
SecretId is a parameter in deleteIds() method, which will be invoked by
host (Android). Restrict the size to 64 bytes to avoid unnecessarily
large bytes making it to HAL & TA.
Test: atest VtsSecretkeeperTargetTest
Bug: 317374882
Change-Id: Ieb34fee4efd11636bee133fe9132c1d739d08a1c
Various small wording changes to attempt to clarify some of the
details of the Secretkeeper API.
While I'm here: fix error code naming inconsistency.
Bug: 291224769
Test: N/A
Change-Id: I956b549bc5bf4d2b964dde9867430cb4778e445b
Add test coverage for replay protection in Secretkeeper. Test that:
1. Sk implementation encrypts/decrypts messages using correct
sequence_numbers.
2. Out of order messages are not accepted.
3. The sequence numbers are per-connection ie, new SeqNum is used for a
fresh connection.
Also, refactor code. SeqNumbers are maintained by
libsecretkeeper_client. Have sk_client use a handle to SkSession for
SecretManagement requests. Replay protection tests however require more
fine grained control of SeqNums. For these we have introduced
`secret_management_request_custom_aad()` method.
Bug: 316126411
Test: atest VtsSecretkeeperTargetTest
Change-Id: I385856c04e185d2b300d59a1b54cb8f09cbf836f
Introduce sequence number in Secretkeeper packets to prevent replay of
packets with a session.
Bug: 316126411
Test: VTS
Change-Id: I20a5d8489e988bdcbe9058495ab56ed18a07b946
Calling binder::get_interface(name) for a name that isn't declared may
take multiple seconds before failing. Restrict to looking for instance
names that are declared.
Also add a rustfmt.toml file, copied from system/secretkeeper/
Bug: 291228655
Test: VtsSecretkeeperTargetTest on Cuttlefish and Pixel8
Change-Id: I9972bc782fe99f5dc5c2dc3b74fa12a0e000ea6c
- Look for either /default or /nonsecure instances.
- Only run a `deleteAll()` test on a /nonsecure instance.
- Delete IDs on client drop to ensure a consistent state.
- Use a config that ensures tests are run single-threaded, to ensure a
consistent state.
- Shift to using types not raw arrays.
- Add a macro for common test setup.
- Add helper methods to reduce the amount of copy-pasta in the VTS
tests.
- Use these helpers to create some additional tests.
Test: VtsSecretkeeperTargetTest
Bug: 291224769
Change-Id: Icff0bba1bcdd66b18398ed4b64ebd2c6bc0de7e7
Also move error codes from separate `ErrorCode.aidl` file to be inline
ERROR_ constants instead.
Bug: 291224769
Test: VtsSecretkeeperTargetTest
Change-Id: I1b0f3f3b5a7c5e891da3022444bf6c7925850550
All request messages are encrypted, but response messages have an outer
unencrypted layer, with an inner response (and the result values inside
that).
Make the SecretManagement.cddl file clearer to reflect that, and make
the schema valid along the way.
Move the outer (unencrypted) error code values into `ErrorCode.aidl` and
use them as service-specific error codes, thus reducing the number of
error types from 3 to 2.
Bug: 291228560
Test: VtsSecretkeeperTargetTest
Test: validate CDDL with https://atacama.informatik.uni-bremen.de/
Change-Id: I46c5bfd7e40b03919d7d3779b265b3bb3ff1ce1e
Test Store/Get api of SecretManagement HAL. We use a hard coded
hypothetical chain & a dice policy (which the dice chain matches
against) for testing the store/get functionality.
This patch also adds required error codes in SecretManagement.cddl
Bug: 291224769
Test: atest VtsSecretkeeperTargetTest
Change-Id: I0aa2dfc7413791e9de62a6e753bda4ab2f813d2c
With Request/Response packets impl CborSerializable. Use the methods
from those.
Test: atest libsecretkeeper_comm_nostd
Bug: 291228655
Change-Id: Ib0daf9c0aa3417befedbc130725fb3445b327079
Add `ISecretkeeper::getAuthGraphKe()` method to the Secretkeeper HAL.
Align the AIDL targets between AuthGraph and Secretkeeper, and add
some defaults that automatically link to the current version of the
Secretkeeper AIDL targets.
Move the non-secure implementation of AuthGraph to run the TA in a
separate thread.
Alter the nonsecure implementation of Secretkeeper so that it no longer
directly implements Secretkeeper functionality, but instead re-uses
common code from the Secretkeeper reference implementation. This
involves re-using the common implementation of the HAL service (from
`authgraph_hal`), but also involves using the reference implementation
of the the TA code that would normally run in a separate secure
environment. The latter code expects to run in a single-threaded
environment, so run it in a single local thread.
Note that the negotiated session keys emitted by AuthGraph are not yet
used by Secretkeeper (coming in a subsequent CL).
Extend the Secretkeeper VTS tests to invoke the AuthGraph VTS inner
tests on the returned IAuthGraphKeyExchange instance, exercising the
instance as an AuthGraph sink.
Bug: 291228560
Test: VtsSecretkeeperTargetTest
Change-Id: Ia2c97976edc4530b2c902d95a74f3c340d342174
Add VTS for testing ISecretkeeper implementation. At present, VTS is
limited to testing GetVersion operation of SecretManagement.
Test: atest VtsSecretkeeperTargetTest
Bug: 291224769
Change-Id: I6084af2fa6cb578e27996e26a0505b267a10b4ef
Secretkeeper is a privileged component which seals the secrets of pVM
instances & releases them on successful authentication of the pVM.
The HAL should be backed by a secure TA of higher privilege than a pVM.
This patch introduces a subset of HAL spec - the SecretManagement api. The
protocol is cbor based (specified in SecretManagement.cddl).
Test: atest VtsSecretkeeperTargetTest
Bug: 293429085
Change-Id: I8e650f27d506d378a94bbc8834c68a005fb12253