feat: add DPE coverage and clone QCBOR library

Enable DICE_PROTECTION_ENVIRONMENT on TC platform for coverage.
The QCBOR library is required for Dice Protection Environment (DPE)
support - the DPE commands are CBOR encoded.

Change-Id: Ic218e12b57cf687f765648b62c3ce9d7ac0d1b58
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/script/build_package.sh b/script/build_package.sh
index c79d29b..4e61723 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (c) 2019-2023 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2024 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -534,6 +534,10 @@
 	   not_upon "${TF_M_EXTRAS_PATH}"; then
 		emit_env "TF_M_EXTRAS_PATH" "$WORKSPACE/tf-m-extras"
 	fi
+	if [ "$(get_tf_opt DICE_PROTECTION_ENVIRONMENT)" = 1 ] &&
+	   not_upon "${QCBOR_DIR}"; then
+		emit_env "QCBOR_DIR" "$WORKSPACE/qcbor"
+	fi
 	if [ -f "$env_file" ]; then
 		set -a
 		source "$env_file"
diff --git a/script/tf-coverity/common-def.sh b/script/tf-coverity/common-def.sh
index 94f44c6..70e30ba 100644
--- a/script/tf-coverity/common-def.sh
+++ b/script/tf-coverity/common-def.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (c) 2019-2023 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2024 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -88,6 +88,9 @@
 TF_M_EXTRAS_DIR=tf-m-extras
 TF_M_EXTRAS_URL_REPO=https://git.trustedfirmware.org/TF-M/tf-m-extras.git
 
+QCBOR_LIB_DIR=qcbor
+QCBOR_URL_REPO=https://github.com/laurencelundblade/QCBOR.git
+
 ARMCLANG_PATH="$(set_armclang_toolchain)"
 
 TBB_OPTIONS="TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 MBEDTLS_DIR=$(pwd)/mbedtls"
diff --git a/script/tf-coverity/tf-cov-make b/script/tf-coverity/tf-cov-make
index 5f51275..55455a2 100755
--- a/script/tf-coverity/tf-cov-make
+++ b/script/tf-coverity/tf-cov-make
@@ -49,6 +49,12 @@
     git checkout main
 fi
 
+if [ ! -d "$QCBOR_LIB_DIR" ]; then
+    git clone "$QCBOR_URL_REPO" "$QCBOR_LIB_DIR"
+    cd "$QCBOR_LIB_DIR"
+    git checkout v1.2
+fi
+
 cd "$TF_SOURCES"
 
 # Clean TF source dir to make sure we don't analyse temporary files.
@@ -332,6 +338,8 @@
 #
 clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=1 ${ARM_TBB_OPTIONS}
 clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=2 ${ARM_TBB_OPTIONS} MEASURED_BOOT=1
+clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=2 ${ARM_TBB_OPTIONS} MEASURED_BOOT=1 \
+    DICE_PROTECTION_ENVIRONMENT=1 QCBOR_DIR=$(pwd)/qcbor
 clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=2 ${ARM_TBB_OPTIONS} PLATFORM_TEST=rss-rotpk
 clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=2 ${ARM_TBB_OPTIONS} PLATFORM_TEST=rss-nv-counters
 clean_build $(common_flags) PLAT=tc TARGET_PLATFORM=2 ${ARM_TBB_OPTIONS} PLATFORM_TEST=tfm-testsuite \