From 895f4b33e8099ea5d101c93c19f7af665d21544f Mon Sep 17 00:00:00 2001 From: Alice Wang Date: Tue, 14 Nov 2023 07:38:18 +0000 Subject: [PATCH] Revert^4 "[avf] Adjust IRPC VTS tests to handle AVF in unsupported env" Revert submission 2829351-revert-2812456-revert-2812435-revert-2778549-expose-avf-rkp-hal-GTFGLMUUKQ-PAWNEHUQBT-WYENGHRTXK Reason for revert: Relands the original topic: https://r.android.com/q/topic:%22expose-avf-rkp-hal%22 PS2 is the same as the original cl: aosp/2796032 Reverted changes: /q/submissionid:2829351-revert-2812456-revert-2812435-revert-2778549-expose-avf-rkp-hal-GTFGLMUUKQ-PAWNEHUQBT-WYENGHRTXK Test: atest MicrodroidHostTests librkp_support_test Change-Id: I7200599131c01908db7fa3bb4a6f989418a89288 --- security/keymint/support/remote_prov_utils.cpp | 9 +++++++++ .../VtsRemotelyProvisionedComponentTests.cpp | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp index 34f7ce4627..6edbfc157a 100644 --- a/security/keymint/support/remote_prov_utils.cpp +++ b/security/keymint/support/remote_prov_utils.cpp @@ -520,6 +520,15 @@ ErrMsgOr> parseAndValidateDeviceInfo( std::to_string(info.versionNumber) + ")."; } } + // Bypasses the device info validation since the device info in AVF is currently + // empty. Check b/299256925 for more information. + // + // TODO(b/300911665): This check is temporary and will be replaced once the markers + // on the DICE chain become available. We need to determine if the CSR is from the + // RKP VM using the markers on the DICE chain. + if (info.uniqueId == "AVF Remote Provisioning 1") { + return std::move(parsed); + } std::string error; std::string tmp; diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 62463ebc7b..a1de93ee2a 100644 --- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -55,6 +55,8 @@ constexpr int32_t VERSION_WITH_SUPPORTED_NUM_KEYS_IN_CSR = 3; constexpr uint8_t MIN_CHALLENGE_SIZE = 0; constexpr uint8_t MAX_CHALLENGE_SIZE = 64; +const string RKP_VM_INSTANCE_NAME = + "android.hardware.security.keymint.IRemotelyProvisionedComponent/avf"; #define INSTANTIATE_REM_PROV_AIDL_TEST(name) \ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(name); \ @@ -181,7 +183,12 @@ class VtsRemotelyProvisionedComponentTests : public testing::TestWithParamgetHardwareInfo(&rpcHardwareInfo).isOk()); + auto status = provisionable_->getHardwareInfo(&rpcHardwareInfo); + if (GetParam() == RKP_VM_INSTANCE_NAME && + status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) { + GTEST_SKIP() << "The RKP VM is not supported on this system."; + } + ASSERT_TRUE(status.isOk()); } static vector build_params() { @@ -207,7 +214,11 @@ TEST(NonParameterizedTests, eachRpcHasAUniqueId) { ASSERT_NE(rpc, nullptr); RpcHardwareInfo hwInfo; - ASSERT_TRUE(rpc->getHardwareInfo(&hwInfo).isOk()); + auto status = rpc->getHardwareInfo(&hwInfo); + if (hal == RKP_VM_INSTANCE_NAME && status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) { + GTEST_SKIP() << "The RKP VM is not supported on this system."; + } + ASSERT_TRUE(status.isOk()); if (hwInfo.versionNumber >= VERSION_WITH_UNIQUE_ID_SUPPORT) { ASSERT_TRUE(hwInfo.uniqueId);