diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index 1dec8d7a5f..5e27bd0e5b 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -1292,6 +1292,19 @@ std::pair> KeyMintAidlTestBase::UpgradeKey( return retval; } + +bool KeyMintAidlTestBase::IsRkpSupportRequired() const { + if (get_vsr_api_level() >= __ANDROID_API_T__) { + return true; + } + + if (get_vsr_api_level() >= __ANDROID_API_S__) { + return SecLevel() != SecurityLevel::STRONGBOX; + } + + return false; +} + vector KeyMintAidlTestBase::ValidKeySizes(Algorithm algorithm) { switch (algorithm) { case Algorithm::RSA: diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h index 3c753d1942..3245ca98f2 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h @@ -309,6 +309,7 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam { } bool IsSecure() const { return securityLevel_ != SecurityLevel::SOFTWARE; } SecurityLevel SecLevel() const { return securityLevel_; } + bool IsRkpSupportRequired() const; vector ValidKeySizes(Algorithm algorithm); vector InvalidKeySizes(Algorithm algorithm); diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp index 9e66f086b2..c6b8906af9 100644 --- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp @@ -1136,8 +1136,8 @@ TEST_P(NewKeyGenerationTest, RsaWithAttestation) { * that has been generated using an associate IRemotelyProvisionedComponent. */ TEST_P(NewKeyGenerationTest, RsaWithRkpAttestation) { - if (get_vsr_api_level() < __ANDROID_API_T__ || AidlVersion() < 2) { - GTEST_SKIP() << "Only required for VSR 12+ and KeyMint 2+"; + if (!IsRkpSupportRequired()) { + GTEST_SKIP() << "RKP support is not required on this platform"; } // There should be an IRemotelyProvisionedComponent instance associated with the KeyMint @@ -1214,8 +1214,8 @@ TEST_P(NewKeyGenerationTest, RsaWithRkpAttestation) { * that has been generated using an associate IRemotelyProvisionedComponent. */ TEST_P(NewKeyGenerationTest, EcdsaWithRkpAttestation) { - if (get_vsr_api_level() < __ANDROID_API_T__ || AidlVersion() < 2) { - GTEST_SKIP() << "Only required for VSR 12+ and KeyMint 2+"; + if (!IsRkpSupportRequired()) { + GTEST_SKIP() << "RKP support is not required on this platform"; } // There should be an IRemotelyProvisionedComponent instance associated with the KeyMint