KeyMint VTS: check for relevant devices am: 1585fdceb5
am: 4e3b4590c9
am: b96f3a4099
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2013077 Change-Id: I593e54aff83abc22b3749075b114595363af8e4d
This commit is contained in:
commit
824f48e621
1 changed files with 29 additions and 5 deletions
|
@ -63,6 +63,9 @@ class SecureElementProvisioningTest : public testing::Test {
|
|||
map<SecurityLevel, shared_ptr<IKeyMintDevice>> SecureElementProvisioningTest::keymints_;
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, ValidConfigurations) {
|
||||
if (keymints_.empty()) {
|
||||
GTEST_SKIP() << "Test not applicable to device with no KeyMint devices";
|
||||
}
|
||||
// TEE is required
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
// StrongBox is optional
|
||||
|
@ -70,6 +73,9 @@ TEST_F(SecureElementProvisioningTest, ValidConfigurations) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, TeeOnly) {
|
||||
if (keymints_.empty()) {
|
||||
GTEST_SKIP() << "Test not applicable to device with no KeyMint devices";
|
||||
}
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
|
||||
ASSERT_NE(tee, nullptr);
|
||||
|
@ -105,6 +111,9 @@ TEST_F(SecureElementProvisioningTest, TeeOnly) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, TeeDoesNotImplementStrongBoxMethods) {
|
||||
if (keymints_.empty()) {
|
||||
GTEST_SKIP() << "Test not applicable to device with no KeyMint devices";
|
||||
}
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
|
||||
ASSERT_NE(tee, nullptr);
|
||||
|
@ -122,7 +131,10 @@ TEST_F(SecureElementProvisioningTest, TeeDoesNotImplementStrongBoxMethods) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, StrongBoxDoesNotImplementTeeMethods) {
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return;
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) {
|
||||
// Need a StrongBox to provision.
|
||||
GTEST_SKIP() << "Test not applicable to device with no StrongBox KeyMint device";
|
||||
}
|
||||
|
||||
auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second;
|
||||
ASSERT_NE(sb, nullptr);
|
||||
|
@ -135,7 +147,10 @@ TEST_F(SecureElementProvisioningTest, StrongBoxDoesNotImplementTeeMethods) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, UnimplementedTest) {
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision.
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) {
|
||||
// Need a StrongBox to provision.
|
||||
GTEST_SKIP() << "Test not applicable to device with no StrongBox KeyMint device";
|
||||
}
|
||||
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
|
||||
|
@ -166,7 +181,10 @@ TEST_F(SecureElementProvisioningTest, UnimplementedTest) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, ChallengeQualityTest) {
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision.
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) {
|
||||
// Need a StrongBox to provision.
|
||||
GTEST_SKIP() << "Test not applicable to device with no StrongBox KeyMint device";
|
||||
}
|
||||
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1);
|
||||
auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second;
|
||||
|
@ -186,7 +204,10 @@ TEST_F(SecureElementProvisioningTest, ChallengeQualityTest) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, ProvisioningTest) {
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision.
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) {
|
||||
// Need a StrongBox to provision.
|
||||
GTEST_SKIP() << "Test not applicable to device with no StrongBox KeyMint device";
|
||||
}
|
||||
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
|
||||
|
@ -215,7 +236,10 @@ TEST_F(SecureElementProvisioningTest, ProvisioningTest) {
|
|||
}
|
||||
|
||||
TEST_F(SecureElementProvisioningTest, InvalidProvisioningTest) {
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision.
|
||||
if (keymints_.count(SecurityLevel::STRONGBOX) == 0) {
|
||||
// Need a StrongBox to provision.
|
||||
GTEST_SKIP() << "Test not applicable to device with no StrongBox KeyMint device";
|
||||
}
|
||||
|
||||
ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
|
||||
auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
|
||||
|
|
Loading…
Reference in a new issue