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 <wufei3@xiaomi.corp-partner.google.com>
This commit is contained in:
wufei3 2023-08-09 14:00:58 +08:00 committed by Prashant Patil
parent 66f7958fbf
commit 99fafaec22

View file

@ -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)),\