1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-06-04 14:10:01 +00:00

arm-bsp/security: drop psa-arch-tests recipe

This change is to build and install psa-arch-tests using
trusted-services code and drop psa-arch-tests recipe.

Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Vishnu Banavath
2022-02-17 15:57:25 +00:00
committed by Jon Mason
parent 6b262f63d3
commit 31c3f35ccd
8 changed files with 39 additions and 433 deletions
@@ -1,45 +0,0 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/psa-arch-tests/corstone1000:"
DEPENDS += "cmake-native"
export CMAKE_BUILD_PARALLEL_LEVEL
CMAKE_BUILD_PARALLEL_LEVEL = "${@oe.utils.parallel_make(d, True)}"
COMPATIBLE_MACHINE = "corstone1000"
SRC_URI:append = "\
file://0001-psa-arch-test-sysroot_compiler_flags_fix.patch \
file://0002-arm-bsp-psa-arch-test-Fixing-psa-arch-tests-cmake.patch \
file://0003-corstone1000-port-crypto-config.patch;patchdir=../psa-arch-tests \
"
FILES:${PN} += "${libdir}/libts.so* ${libdir}/deployments ${bindir}/psa-*"
FILES:${PN}-dev = "${includedir}/deployments/psa-api-test/"
INSANE_SKIP:${PN} += "rpaths"
do_configure() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
cmake \
-DSYSROOT_YOCTO=${RECIPE_SYSROOT} \
-S ${S}/$PSA_API_TEST -B "${B}/$PSA_API_TEST"
done
}
do_compile() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
cmake --build "${B}/$PSA_API_TEST"
done
}
do_install() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
install -d -m 0755 ${D}${libdir}/${PSA_API_TEST}
install -d -m 0755 ${D}${includedir}/${PSA_API_TEST}
install -m 0755 ${B}/${PSA_API_TEST}/libts_install/arm-linux/lib/*.so* ${D}${libdir}
install -d -m 0755 ${B}/${PSA_API_TEST}/libts_install/arm-linux/include ${D}${includedir}/${PSA_API_TEST}
psafile_fullpath=`ls ${B}/${PSA_API_TEST}/psa-*`
psafile_filename="`basename -s .bin ${psafile_fullpath}`"
install -D -p -m 0755 ${psafile_fullpath} ${D}/${bindir}/${psafile_filename}
done
}
@@ -1,68 +0,0 @@
Upstream-Status: Inappropriate [Not for upstreaming in the original repo]
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
From 340ef6788d2803543b15235bf16a79cbc02235bd Mon Sep 17 00:00:00 2001
From: Emekcan Aras <Emekcan.Aras@arm.com>
Date: Mon, 6 Dec 2021 10:21:59 +0000
[PATCH] arm-bsp/psa-arch-test: Integrate psa-arch-test
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
---
deployments/libts/libts-import.cmake | 4 +++-
external/MbedTLS/MbedTLS.cmake | 1 +
external/psa_arch_tests/psa_arch_tests.cmake | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/deployments/libts/libts-import.cmake b/deployments/libts/libts-import.cmake
index 792ba86..e3793e8 100644
--- a/deployments/libts/libts-import.cmake
+++ b/deployments/libts/libts-import.cmake
@@ -19,7 +19,6 @@ if(NOT DEFINED PROCESSOR_COUNT)
ProcessorCount(PROCESSOR_COUNT)
set(PROCESSOR_COUNT ${PROCESSOR_COUNT} CACHE STRING "Number of cores to use for parallel builds.")
endif()
-
set(LIBTS_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/libts_install" CACHE PATH "libts installation directory")
set(LIBTS_PACKAGE_PATH "${LIBTS_INSTALL_PATH}/lib/cmake" CACHE PATH "libts CMake package directory")
set(LIBTS_SOURCE_DIR "${TS_ROOT}/deployments/libts/${TS_ENV}" CACHE PATH "libts source directory")
@@ -27,9 +26,12 @@ set(LIBTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/libts-build" CACHE PATH
file(MAKE_DIRECTORY ${LIBTS_BINARY_DIR})
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${SYSROOT_YOCTO}")
+
#Configure the library
execute_process(COMMAND
${CMAKE_COMMAND}
+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
-DCMAKE_INSTALL_PREFIX=${LIBTS_INSTALL_PATH}
-GUnix\ Makefiles
${LIBTS_SOURCE_DIR}
diff --git a/external/MbedTLS/MbedTLS.cmake b/external/MbedTLS/MbedTLS.cmake
index 3cbaed1..8c53f88 100644
--- a/external/MbedTLS/MbedTLS.cmake
+++ b/external/MbedTLS/MbedTLS.cmake
@@ -59,6 +59,7 @@ set(PSA_CRYPTO_API_INCLUDE "${MBEDTLS_INSTALL_PATH}/include" CACHE STRING "PSA C
#Configure the library
execute_process(COMMAND
${CMAKE_COMMAND}
+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
-DENABLE_PROGRAMS=OFF
-DENABLE_TESTING=OFF
-DUNSAFE_BUILD=ON
diff --git a/external/psa_arch_tests/psa_arch_tests.cmake b/external/psa_arch_tests/psa_arch_tests.cmake
index e6ab73f..af00cfc 100644
--- a/external/psa_arch_tests/psa_arch_tests.cmake
+++ b/external/psa_arch_tests/psa_arch_tests.cmake
@@ -52,6 +52,7 @@ string(REPLACE ";" " " PSA_ARCH_TEST_EXTERNAL_DEFS "${PSA_ARCH_TEST_EXTERNAL_DEF
# Configure the psa-arch-test library
execute_process(COMMAND
${CMAKE_COMMAND}
+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
-DTOOLCHAIN=INHERIT
-DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
-DPSA_INCLUDE_PATHS=${PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS}
--
2.25.1
@@ -1,49 +0,0 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
From 4a1f2fd2c3c3f8e00364d3b1a8c76a61e41a483f Mon Sep 17 00:00:00 2001
From: Emekcan Aras <Emekcan.Aras@arm.com>
Date: Sat, 11 Dec 2021 09:32:44 +0000
Subject: [PATCH] arm-bsp/psa-arch-test: Fixing psa-arch-tests cmake
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
---
external/psa_arch_tests/psa_arch_tests.cmake | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/external/psa_arch_tests/psa_arch_tests.cmake b/external/psa_arch_tests/psa_arch_tests.cmake
index af00cfc..e4b4f6b 100644
--- a/external/psa_arch_tests/psa_arch_tests.cmake
+++ b/external/psa_arch_tests/psa_arch_tests.cmake
@@ -25,15 +25,13 @@ find_program(GIT_COMMAND "git")
if (NOT GIT_COMMAND)
message(FATAL_ERROR "Please install git")
endif()
-
+if ("${PSA_ARCH_TESTS_PATH}" STREQUAL "DOWNLOAD")
# Fetching psa-arch-tests
FetchContent_Declare(
psa-arch-tests
GIT_REPOSITORY ${PSA_ARCH_TESTS_URL}
GIT_TAG ${PSA_ARCH_TESTS_REFSPEC}
GIT_SHALLOW TRUE
- PATCH_COMMAND git stash
- COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/modify_attest_config.patch
)
# FetchContent_GetProperties exports psa-arch-tests_SOURCE_DIR and psa-arch-tests_BINARY_DIR variables
@@ -42,7 +40,10 @@ if(NOT psa-arch-tests_POPULATED)
message(STATUS "Fetching psa-arch-tests")
FetchContent_Populate(psa-arch-tests)
endif()
-
+else()
+ set(psa-arch-tests_SOURCE_DIR "${TS_ROOT}/../psa-arch-tests")
+ set(psa-arch-tests_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+endif()
# Ensure list of include paths is separated correctly
string(REPLACE ";" "\\;" PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS "${PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS}")
--
2.25.1
@@ -1,237 +0,0 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
From f86f5b42d853d2a65f6753362361bbb95aac1800 Mon Sep 17 00:00:00 2001
From: Satish Kumar <satish.kumar01@arm.com>
Date: Sat, 11 Dec 2021 11:06:57 +0000
Subject: [PATCH] corstone1000: port crypto config
Upstream-Status: Pending [Not submitted to upstream yet]
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Satish Kumar <satish.kumar01@arm.com>
%% original patch: 0003-corstone1000-port-crypto-config.patch
---
.../nspe/pal_crypto_config.h | 83 +++++++++++++++----
1 file changed, 66 insertions(+), 17 deletions(-)
diff --git a/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h
index 844cd2e..c936bdd 100755
--- a/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h
+++ b/api-tests/platform/targets/tgt_dev_apis_linux/nspe/pal_crypto_config.h
@@ -1,5 +1,5 @@
/** @file
- * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,10 +34,14 @@
*
* Comment macros to disable the types
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_RSA
#define ARCH_TEST_RSA_1024
#define ARCH_TEST_RSA_2048
#define ARCH_TEST_RSA_3072
+#endif
+#endif
/**
* \def ARCH_TEST_ECC
@@ -50,11 +54,17 @@
* Requires: ARCH_TEST_ECC
* Comment macros to disable the curve
*/
+#ifndef TF_M_PROFILE_SMALL
#define ARCH_TEST_ECC
#define ARCH_TEST_ECC_CURVE_SECP192R1
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_ECC_CURVE_SECP224R1
+#endif
#define ARCH_TEST_ECC_CURVE_SECP256R1
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_ECC_CURVE_SECP384R1
+#endif
+#endif
/**
* \def ARCH_TEST_AES
@@ -78,10 +88,10 @@
*
* Comment macros to disable the types
*/
-#define ARCH_TEST_DES
-#define ARCH_TEST_DES_1KEY
-#define ARCH_TEST_DES_2KEY
-#define ARCH_TEST_DES_3KEY
+//#define ARCH_TEST_DES
+//#define ARCH_TEST_DES_1KEY
+//#define ARCH_TEST_DES_2KEY
+//#define ARCH_TEST_DES_3KEY
/**
* \def ARCH_TEST_RAW
@@ -104,7 +114,7 @@
*
* Enable the ARC4 key type.
*/
-#define ARCH_TEST_ARC4
+//#define ARCH_TEST_ARC4
/**
* \def ARCH_TEST_CIPHER_MODE_CTR
@@ -113,7 +123,11 @@
*
* Requires: ARCH_TEST_CIPHER
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_CIPHER_MODE_CTR
+#endif
+#endif
/**
* \def ARCH_TEST_CIPHER_MODE_CFB
@@ -138,7 +152,11 @@
*
* Requires: ARCH_TEST_CIPHER, ARCH_TEST_AES, ARCH_TEST_CIPHER_MODE_CTR
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_CTR_AES
+#endif
+#endif
/**
* \def ARCH_TEST_CBC_AES
@@ -157,7 +175,11 @@
*
* Comment macros to disable the types
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_CBC_NO_PADDING
+#endif
+#endif
/**
* \def ARCH_TEST_CFB_AES
@@ -177,11 +199,15 @@
*
* Comment macros to disable the types
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_PKCS1V15
#define ARCH_TEST_RSA_PKCS1V15_SIGN
#define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
#define ARCH_TEST_RSA_PKCS1V15_CRYPT
#define ARCH_TEST_RSA_OAEP
+#endif
+#endif
/**
* \def ARCH_TEST_CBC_PKCS7
@@ -190,7 +216,11 @@
*
* Comment macros to disable the types
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_CBC_PKCS7
+#endif
+#endif
/**
* \def ARCH_TEST_ASYMMETRIC_ENCRYPTION
@@ -227,21 +257,27 @@
*
* Comment macros to disable the types
*/
-// #define ARCH_TEST_MD2
-// #define ARCH_TEST_MD4
-#define ARCH_TEST_MD5
-#define ARCH_TEST_RIPEMD160
-#define ARCH_TEST_SHA1
+//#define ARCH_TEST_MD2
+//#define ARCH_TEST_MD4
+//#define ARCH_TEST_MD5
+//#define ARCH_TEST_RIPEMD160
+//#define ARCH_TEST_SHA1
+#ifndef TF_M_PROFILE_SMALL
#define ARCH_TEST_SHA224
+#endif
#define ARCH_TEST_SHA256
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_SHA384
#define ARCH_TEST_SHA512
-// #define ARCH_TEST_SHA512_224
-// #define ARCH_TEST_SHA512_256
-// #define ARCH_TEST_SHA3_224
-// #define ARCH_TEST_SHA3_256
-// #define ARCH_TEST_SHA3_384
-// #define ARCH_TEST_SHA3_512
+#endif
+#endif
+//#define ARCH_TEST_SHA512_224
+//#define ARCH_TEST_SHA512_256
+//#define ARCH_TEST_SHA3_224
+//#define ARCH_TEST_SHA3_256
+//#define ARCH_TEST_SHA3_384
+//#define ARCH_TEST_SHA3_512
/**
* \def ARCH_TEST_HKDF
@@ -261,7 +297,12 @@
*
* Comment macros to disable the types
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_CMAC
+#endif
+#endif
+//#define ARCH_TEST_GMAC
#define ARCH_TEST_HMAC
/**
@@ -281,7 +322,11 @@
* Requires: ARCH_TEST_AES
*
*/
+#ifndef TF_M_PROFILE_SMALL
+#ifndef TF_M_PROFILE_MEDIUM
#define ARCH_TEST_GCM
+#endif
+#endif
/**
* \def ARCH_TEST_TRUNCATED_MAC
@@ -300,7 +345,9 @@
*
* Requires: ARCH_TEST_ECC
*/
+#ifndef TF_M_PROFILE_SMALL
#define ARCH_TEST_ECDH
+#endif
/**
* \def ARCH_TEST_ECDSA
@@ -308,7 +355,9 @@
* Enable the elliptic curve DSA library.
* Requires: ARCH_TEST_ECC
*/
+#ifndef TF_M_PROFILE_SMALL
#define ARCH_TEST_ECDSA
+#endif
/**
* \def ARCH_TEST_DETERMINISTIC_ECDSA
--
2.25.1
@@ -1,6 +0,0 @@
# Machine specific configurations
MACHINE_PSA_REQUIRE ?= ""
MACHINE_PSA_REQUIRE:corstone1000 = "psa-arch-tests-corstone1000.inc"
require ${MACHINE_PSA_REQUIRE}
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM += "file://../mbedtls/LICENSE;md5=3b83ef96387f14655fc854ddc3c6b
"
SRC_URI:append = " \
${SRC_URI_MBEDTLS} ${SRC_URI_NANOPB} ${SRC_URI_OPENAMP} ${SRC_URI_LIBMETAL} \
${SRC_URI_MBEDTLS} ${SRC_URI_NANOPB} ${SRC_URI_OPENAMP} ${SRC_URI_LIBMETAL} \
file://0001-tools-cmake-common-applying-lowercase-project-convention.patch \
file://0002-fix-EARLY_TA_PATHS-env-variable.patch \
file://0003-se-proxy-dts-add-se-proxy-as-child-node.patch \
@@ -56,6 +56,7 @@ SRCREV_openamp = "347397decaa43372fc4d00f965640ebde042966d"
SRC_URI_LIBMETAL = "git://github.com/OpenAMP/libmetal.git;name=libmetal;protocol=https;branch=main;destsuffix=git/libmetal"
SRCREV_libmetal = "f252f0e007fbfb8b3a52b1d5901250ddac96baad"
TS_ENVIRONMENT_LINUX = "arm-linux"
TS_PLATFORM = "arm/corstone1000"
TS_ENVIRONMENT = "opteesp"
SP_PACKAGING_METHOD = "embedded"
@@ -65,3 +66,39 @@ TS_DEPLOYMENTS += "'deployments/se-proxy/${TS_ENVIRONMENT}'"
# smm-gateway secure partition
TS_DEPLOYMENTS += "'deployments/smm-gateway/${TS_ENVIRONMENT}'"
PSA_API_TESTS = "deployments/psa-api-test/protected_storage/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/internal_trusted_storage/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/initial_attestation/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/crypto/${TS_ENVIRONMENT_LINUX}"
do_configure:append() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
cmake \
-DSYSROOT_YOCTO=${RECIPE_SYSROOT} \
-S ${S}/$PSA_API_TEST -B "${B}/$PSA_API_TEST"
done
}
do_compile:append() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
cmake --build "${B}/$PSA_API_TEST"
done
}
do_install:append() {
for PSA_API_TEST in ${PSA_API_TESTS}; do
install -d -m 0755 ${D}${libdir}/${PSA_API_TEST}
install -d -m 0755 ${D}${includedir}/${PSA_API_TEST}
psafile_fullpath=`ls ${B}/${PSA_API_TEST}/psa-*`
psafile_filename="`basename -s .bin ${psafile_fullpath}`"
install -D -p -m 0755 ${psafile_fullpath} ${D}/${bindir}/${psafile_filename}
done
cp -rf ${B}/${PSA_API_TEST}/libts_install/arm-linux/lib/*.so* ${D}/${libdir}
}
FILES:${PN}-dev = "${includedir}/deployments/psa-api-test/"
INSANE_SKIP:${PN}-psa-api-tests += "rpaths dev-so"
PACKAGES += "${PN}-psa-api-tests"
FILES:${PN}-psa-api-tests = "${libdir} ${bindir}"
@@ -1,26 +0,0 @@
SUMMARY = "PSA arch test application"
require secure-partitions.inc
LIC_FILES_CHKSUM += "file://../psa-arch-tests/LICENSE.md;md5=2a944942e1496af1886903d274dedb13"
SRC_URI_PSA = "git://github.com/ARM-software/psa-arch-tests.git;protocol=https;branch=main;name=psa;destsuffix=git/psa-arch-tests"
SRC_URI:append = " ${SRC_URI_PSA}"
SRCREV_FORMAT="ts_psa"
SRCREV_psa = "6e1549dde62d12c92fc2df90ebbbe2d2d77cc76a"
PV = "1.2+git${SRCPV}"
PSA_APPLICATION_NAME = "psa-api-test"
TS_ENVIRONMENT_LINUX = "arm-linux"
PSA_API_TESTS += "deployments/psa-api-test/protected_storage/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/internal_trusted_storage/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/initial_attestation/${TS_ENVIRONMENT_LINUX}"
PSA_API_TESTS += "deployments/psa-api-test/crypto/${TS_ENVIRONMENT_LINUX}"
EXTRA_OECMAKE += "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=arm \
"
do_deploy[noexec] = "1"
@@ -67,4 +67,4 @@ do_deploy() {
}
addtask deploy after do_install
FILES:${PN} = "/firmware/*"
FILES:${PN} = "/firmware/sp/opteesp*"