diff options
author | David Drysdale <drysdale@google.com> | 2021-12-02 18:53:33 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-12-02 18:53:33 +0000 |
commit | 4f6428aadac4da8b856693c1b1ecebeffd6c912e (patch) | |
tree | f5be7f5383360b953b9deaa39c0b6f9db3c3bc7a /security/keymint/aidl/vts/functional/KeyMintTest.cpp | |
parent | 5a903ea23a88039d468ff9af3eb1894324c24a89 (diff) | |
parent | 8a2977f698495403f568f1d4ee7056d80488937b (diff) |
Merge "KeyMint VTS: option to skip BOOT_PATCHLEVEL check" am: 8aeb7ef2b4 am: 8a2977f698
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1907696
Change-Id: I870162d04f83a2d424aadf4674a7e475664fccd1
Diffstat (limited to 'security/keymint/aidl/vts/functional/KeyMintTest.cpp')
-rw-r--r-- | security/keymint/aidl/vts/functional/KeyMintTest.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp index 53a5490cce..2a7911cc36 100644 --- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp @@ -69,6 +69,9 @@ namespace aidl::android::hardware::security::keymint::test { namespace { +// Whether to check that BOOT_PATCHLEVEL is populated. +bool check_boot_pl = true; + // The maximum number of times we'll attempt to verify that corruption // of an encrypted blob results in an error. Retries are necessary as there // is a small (roughly 1/256) chance that corrupting ciphertext still results @@ -527,12 +530,17 @@ class NewKeyGenerationTest : public KeyMintAidlTestBase { EXPECT_TRUE(os_pl); EXPECT_EQ(*os_pl, os_patch_level()); - // Should include vendor and boot patchlevels. + // Should include vendor patchlevel. auto vendor_pl = auths.GetTagValue(TAG_VENDOR_PATCHLEVEL); EXPECT_TRUE(vendor_pl); EXPECT_EQ(*vendor_pl, vendor_patch_level()); - auto boot_pl = auths.GetTagValue(TAG_BOOT_PATCHLEVEL); - EXPECT_TRUE(boot_pl); + + // Should include boot patchlevel (but there are some test scenarios where this is not + // possible). + if (check_boot_pl) { + auto boot_pl = auths.GetTagValue(TAG_BOOT_PATCHLEVEL); + EXPECT_TRUE(boot_pl); + } return auths; } @@ -6871,6 +6879,12 @@ int main(int argc, char** argv) { } else { std::cout << "NOT dumping attestations" << std::endl; } + if (std::string(argv[i]) == "--skip_boot_pl_check") { + // Allow checks of BOOT_PATCHLEVEL to be disabled, so that the tests can + // be run in emulated environments that don't have the normal bootloader + // interactions. + aidl::android::hardware::security::keymint::test::check_boot_pl = false; + } } } return RUN_ALL_TESTS(); |