From 99fafaec2245faebb787a0d1f7451557ab4a8fb4 Mon Sep 17 00:00:00 2001 From: wufei3 Date: Wed, 9 Aug 2023 14:00:58 +0800 Subject: [PATCH] Remove the empty property of attestation. In GSI images attestation specific properties (ro.product.*_for_attestation) are empty, which causes attestation failure on devices with different values in ro.product.* and ro.product.vendor.* from actual values provisioned in Keymint. Hence these values added only if they are set in build files. Bug:294190893 Test: atest CtsKeystoreTestCases:android.keystore.cts.DeviceOwnerKeyManagementTest#testAllVariationsOfDeviceIdAttestation Change-Id: Icaf1bcd089767b2c47d0b57064aa72a4c9483bb5 Signed-off-by: wufei3 --- core/sysprop.mk | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/sysprop.mk b/core/sysprop.mk index 451e88af84..4536e5f886 100644 --- a/core/sysprop.mk +++ b/core/sysprop.mk @@ -47,9 +47,21 @@ define generate-common-build-props echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\ echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\ # Attestation specific properties for AOSP/GSI build running on device. - echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\ - echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\ - echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\ + if [ -n "$(strip $(PRODUCT_MODEL_FOR_ATTESTATION))" ]; then \ + echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\ + fi; \ + if [ -n "$(strip $(PRODUCT_BRAND_FOR_ATTESTATION))" ]; then \ + echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\ + fi; \ + if [ -n "$(strip $(PRODUCT_NAME_FOR_ATTESTATION))" ]; then \ + echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\ + fi; \ + if [ -n "$(strip $(PRODUCT_DEVICE_FOR_ATTESTATION))" ]; then \ + echo "ro.product.device_for_attestation=$(PRODUCT_DEVICE_FOR_ATTESTATION)" >> $(2);\ + fi; \ + if [ -n "$(strip $(PRODUCT_MANUFACTURER_FOR_ATTESTATION))" ]; then \ + echo "ro.product.manufacturer_for_attestation=$(PRODUCT_MANUFACTURER_FOR_ATTESTATION)" >> $(2);\ + fi; \ )\ $(if $(filter true,$(ZYGOTE_FORCE_64)),\ $(if $(filter vendor,$(1)),\