Skip tests using `USAGE_COUNT_LIMIT` on devices with Keymaster
implementation. `USAGE_COUNT_LIMIT` tag is supported from KeyMint1.0.
Skip test generating an attestation key with `INCLUDE_UNIQUE_ID` tag on
devices with Keymaster implementation as it fails to generate a key on
some of the older devices.
Bug: 387208956
Test: atest keystore2_client_tests
Change-Id: I5d691e26ba8ea434782258562dac62da4cc5ac86
diff --git a/keystore2/tests/keystore2_client_authorizations_tests.rs b/keystore2/tests/keystore2_client_authorizations_tests.rs
index 504e6ab..b31041d 100644
--- a/keystore2/tests/keystore2_client_authorizations_tests.rs
+++ b/keystore2/tests/keystore2_client_authorizations_tests.rs
@@ -518,6 +518,10 @@
#[test]
fn keystore2_gen_key_auth_usage_count_limit() {
let sl = SecLevel::tee();
+ if sl.is_keymaster() {
+ // `USAGE_COUNT_LIMIT` is supported from KeyMint1.0
+ return;
+ }
const MAX_USES_COUNT: i32 = 3;
let gen_params = authorizations::AuthSetBuilder::new()
@@ -542,6 +546,10 @@
#[test]
fn keystore2_gen_key_auth_usage_count_limit_one() {
let sl = SecLevel::tee();
+ if sl.is_keymaster() {
+ // `USAGE_COUNT_LIMIT` is supported from KeyMint1.0
+ return;
+ }
const MAX_USES_COUNT: i32 = 1;
let gen_params = authorizations::AuthSetBuilder::new()
@@ -565,6 +573,10 @@
#[test]
fn keystore2_gen_non_attested_key_auth_usage_count_limit() {
let sl = SecLevel::tee();
+ if sl.is_keymaster() {
+ // `USAGE_COUNT_LIMIT` is supported from KeyMint1.0
+ return;
+ }
const MAX_USES_COUNT: i32 = 2;
let gen_params = authorizations::AuthSetBuilder::new()
@@ -627,6 +639,12 @@
#[test]
fn keystore2_gen_key_auth_include_unique_id_success() {
let sl = SecLevel::tee();
+ if sl.is_keymaster() {
+ // b/387208956 - Some older devices with Keymaster implementations fail to generate an
+ // attestation key with `INCLUDE_UNIQUE_ID`, but this was not previously tested. Skip this
+ // test on devices with Keymaster implementation.
+ return;
+ }
let alias_first = "ks_test_auth_tags_test_1";
if let Some(unique_id_first) = gen_key_including_unique_id(&sl, alias_first) {