From 95d887251ee40397300c570568d079ac9f9c7db4 Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Fri, 11 Feb 2022 12:26:07 +0100 Subject: [PATCH] xtensa-build-all.sh: Don't override user private key path If the user doesn't set the path to own private key, the default path is placed in the variable containing the user's key. This causes a leak of the default key of one platform to the others platforms, which will treat it as a key supplied from the user. Signed-off-by: Adrian Warecki --- scripts/xtensa-build-all.sh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index b4426734c..a1a6a292e 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -7,8 +7,8 @@ set -e # Platforms with a toolchain available in the latest Docker image and # built by the -a option. -DEFAULT_PLATFORMS=( byt cht bdw hsw apl skl kbl cnl sue icl jsl \ - imx8 imx8x imx8m imx8ulp tgl tgl-h rn mt8186 mt8195 ) +DEFAULT_PLATFORMS=( byt cht bdw hsw tgl tgl-h apl skl kbl cnl sue icl jsl \ + imx8 imx8x imx8m imx8ulp rn mt8186 mt8195 ) # Work in progress can be added to this "staging area" without breaking # the -a option for everyone. @@ -185,6 +185,7 @@ for platform in "${PLATFORMS[@]}" do HAVE_ROM='no' DEFCONFIG_PATCH='' + PLATFORM_PRIVATE_KEY='' case $platform in byt) @@ -281,10 +282,7 @@ do XTENSA_TOOLS_VERSION="RG-2017.8-linux" HAVE_ROM='yes' # default key for TGL - if [ -z "$PRIVATE_KEY_OPTION" ] - then - PRIVATE_KEY_OPTION="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" - fi + PLATFORM_PRIVATE_KEY="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" ;; tgl-h) PLATFORM="tgph" @@ -293,10 +291,7 @@ do XTENSA_TOOLS_VERSION="RG-2017.8-linux" HAVE_ROM='yes' # default key for TGL - if [ -z "$PRIVATE_KEY_OPTION" ] - then - PRIVATE_KEY_OPTION="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" - fi + PLATFORM_PRIVATE_KEY="-D${SIGNING_TOOL}_PRIVATE_KEY=$SOF_TOP/keys/otc_private_key_3k.pem" ;; jsl) PLATFORM="jasperlake" @@ -350,6 +345,8 @@ do esac + test -z "${PRIVATE_KEY_OPTION}" || PLATFORM_PRIVATE_KEY="${PRIVATE_KEY_OPTION}" + if [ -n "$XTENSA_TOOLS_ROOT" ] then XTENSA_TOOLS_DIR="$XTENSA_TOOLS_ROOT/install/tools/$XTENSA_TOOLS_VERSION" @@ -403,7 +400,7 @@ do -DROOT_DIR="$ROOT" \ -DMEU_OPENSSL="${MEU_OPENSSL}" \ "${MEU_PATH_OPTION}" \ - "${PRIVATE_KEY_OPTION}" \ + "${PLATFORM_PRIVATE_KEY}" \ -DINIT_CONFIG=${PLATFORM}${DEFCONFIG_PATCH}_defconfig \ -DEXTRA_CFLAGS="${EXTRA_CFLAGS}" \ "$SOF_TOP"