Commit graph

8 commits

Author SHA1 Message Date
David Zeuthen
cbc75ae266 identity: Fix "possible" overflow when converting current time to milliseconds.
On ubsan targets an overflow bug caused credstore to fail when
converting current time since the Epoch to milliseconds. Fix this by
using __builtin_mul_overflow() which detects overflow and bail if that
were to happen. The error path is not going to get hit until for
another 292 million years at which time credstore may or may not be
around but better safe than sorry.

Test: atest VtsHalIdentityTargetTest
Test: atest android.security.identity.cts
Bug: 262860870
Bug: 262910256
Bug: 264728880
Bug: 264729215
Change-Id: I5efb036f078cae9e4e03406bbdf4ce66572ad716
2023-02-01 11:38:43 -05:00
David Zeuthen
c239db4114 identity: Add support for setting minimum validity period for AuthKey.
This change adds support for specifying that an AuthKey should be
replaced if it's going to expire within a certain amount of time
configurable by the application. This also adds a way for the
application to learn about the expiration time of currently configured
AuthKeys.

Combined these two changes allow an application to get a perfect
picture of which AuthKeys are available, when they expire, and allows
the application to refresh AuthKeys well ahead of expiration dates.

Also remove checking storeStaticAuthenticationDataWithExpiration() is
only available on HAL version 3 and later (feature version 202101 and
later). This works on any HAL version.

Bug: 241912421
Test: atest VtsHalIdentityTargetTest
Test: atest android.security.identity.cts
Change-Id: Ic8274088035c31f73ad61645ee5e0281b3460837
2022-12-09 02:58:18 -05:00
David Zeuthen
045a2c87e0 identity: Add multi-document presentation support.
Also fix a bug so the same AuthKey is used for several getEntries()
calls on a credential. This matches the behavior in the Jetpack.

Bug: 197965513
Test: New CTS tests and new screen in CtsVerifier
Change-Id: I344f44b5655f0977ee650b518ce669e3c8a7b47a
2022-01-10 17:38:04 -05:00
Max Bires
5bb33f4638 Changing libcppbor dependency
This change replaces libcppbor with libcppbor_external as part of the
effort to remove the partial libcppbor copy that lives in
hardware/interfaces.

Bug: 182445123
Test: It builds
Change-Id: I9c96cdf807979ecf806c80edd3cec9c443294c22
2021-04-05 17:51:43 -07:00
David Zeuthen
62d43bf7cb identity: Use "credstore" for LOG_TAG everywhere.
Currently we're using file-specific tags which makes it hard for
people looking at logcat to infer it's actually from credstore and it
also complicates filtering. Just use "credstore" everywhere.

Also change logging level from ERROR to INFO in the message
"Registered binder service" which is logged on startup.

Bug: None
Test: Compiles + manual inspection via logcat
Test: atest android.security.identity.cts (on goldfish)
Change-Id: I336d1a4e4e10b87fd3f08a5046cf5e13f09c9cb6
2021-03-31 10:46:42 -04:00
David Zeuthen
472e6c8e18 Credstore changes for Android 12
- Add Credential.proveOwership()
- Add Credential.deleteWithChallenge()
- Add Credential.updateCredential()
- Add Credential.storeStaticAuthenticationDataWithExpirationDate()
  - Store this on disk. For entries stored without this parameter
    assume they never expire.
- Add allowUsingExpiredKeys to Credential.selectAuthKey() and
  Credential.getEntries()
  - Unless set to true, never select an expired key
- Introduce ERROR_NOT_SUPPORTED and return this if HAL does not
  support operation

Bug: 170146643
Test: atest android.security.identity.cts
Change-Id: Ic5dafc6498c9c59b82942def9d348d974f008589
2021-01-22 18:37:03 -05:00
David Zeuthen
a6f9fba382 Port credstore to IdentityCredential AIDL.
Bug: 111446262
Test: atest android.security.identity.cts
Test: VtsHalIdentityTargetTest
Test: android.hardware.identity-support-lib-test
Change-Id: I338b35f57f2bb7345c3f8f0c608c7a6213a0dc6b
2020-02-14 13:41:52 -05:00
David Zeuthen
ab3e565511 Add credstore system daemon.
The credstore system daemon is sitting below the Identity Credential
Framework APIs and on top of the Identity Credential HALs. Its main
job is to store credential data and provide a way for applications to
communicate with the secure hardware abstracted by the HAL.

This daemon runs as an unprivileged user, credstore.

The auth-tokens needed by credstore are supplied by keystore and this
CL includes the requisite changes to keystore for this to work.

Bug: 111446262
Test: CTS tests for Framework APIs
Change-Id: Ieb4d59852a143482436a1c418c25ed96e25c0047
2020-01-16 13:05:48 -05:00