F: boot/optee-os/
F: package/optee-client/
F: package/optee-examples/
+F: package/optee-test/
N: Eugene Tarassov <eugene@largest.net>
F: package/tcf-agent/
source "package/checkpolicy/Config.in"
source "package/optee-client/Config.in"
source "package/optee-examples/Config.in"
+ source "package/optee-test/Config.in"
source "package/paxtest/Config.in"
source "package/policycoreutils/Config.in"
source "package/refpolicy/Config.in"
--- /dev/null
+From 88714fc174b91950c9e1c53a9832fc6d4ffa6e2a Mon Sep 17 00:00:00 2001
+From: Etienne Carriere <etienne.carriere@linaro.org>
+Date: Sun, 17 Feb 2019 22:44:44 +0100
+Subject: [PATCH] regression 4100: update string conversion loop
+
+Change the loop used to convert string into numerical value.
+The original loop was fine but its implementation hits toolchain
+unsafe-loop-optimizations feature. The new implementation
+proposed here simplifies a bit the loop and prevents toolchain
+from complaining when directive -Werror=unsafe-loop-optimizations
+is enabled.
+
+Issue reported by the Buildroot cross toolchain [1] with the
+following error traces:
+
+build/armv7/build/optee-test-3.4.0/host/xtest/regression_4100.c:447:8: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
+ while (spos) {
+ ^
+build/optee-test-3.4.0/host/xtest/regression_4100.c:454:6: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
+ if (!spos)
+ ^
+
+[1] arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2019.02-git-00933-gb75e93c) 7.4.0
+
+Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
+---
+ host/xtest/regression_4100.c | 25 ++++++++++++++-----------
+ 1 file changed, 14 insertions(+), 11 deletions(-)
+
+diff --git a/host/xtest/regression_4100.c b/host/xtest/regression_4100.c
+index b477f38..88346d4 100644
+--- a/host/xtest/regression_4100.c
++++ b/host/xtest/regression_4100.c
+@@ -445,21 +445,24 @@ static TEEC_Result convert_from_string(ADBG_Case_t *c, TEEC_Session *s,
+ return TEEC_ERROR_OUT_OF_MEMORY;
+
+ while (spos) {
+- spos--;
+- nibble = digit_value(str[spos]);
+- if (nibble == -1)
++ nibble = digit_value(str[spos - 1]);
++ if (nibble == -1) {
++ spos--;
+ break;
++ }
+ os[ospos] = nibble;
+
+- if (!spos)
+- break;
++ if (spos > 1) {
++ nibble = digit_value(str[spos - 2]);
++ if (nibble == -1) {
++ spos -= 2;
++ break;
++ }
++ os[ospos] |= nibble << 4;
++ ospos--;
++ spos--;
++ }
+ spos--;
+- nibble = digit_value(str[spos]);
+- if (nibble == -1)
+- break;
+-
+- os[ospos] |= nibble << 4;
+- ospos--;
+ }
+
+ if (spos)
+--
+2.20.1
+
--- /dev/null
+config BR2_PACKAGE_OPTEE_TEST
+ bool "optee-test"
+ depends on BR2_TARGET_OPTEE_OS
+ depends on !BR2_STATIC_LIBS # optee-client
+ select BR2_PACKAGE_OPTEE_CLIENT
+ select BR2_TARGET_OPTEE_OS_SDK
+ help
+ This build option enables OP-TEE test package from the
+ OP-TEE project. It helps platforms to verify the OP-TEE
+ installation against a set of regression and performance
+ tests.
+
+ The package generates userspace test applications and
+ data files for the Linux userland. It also generates
+ OP-TEE trusted applications.
+
+ Trusted application binary files are installed in the target
+ directory /lib/optee_armtz as other trusted applications.
+ At runtime OP-TEE OS can load trusted applications from this
+ non-secure filesystem/directory into the secure world for
+ execution.
+
+ http://github.com/OP-TEE/optee_test
+
+comment "optee-test needs a toolchain w/ dynamic library"
+ depends on BR2_TARGET_OPTEE_OS
+ depends on BR2_STATIC_LIBS
--- /dev/null
+# From https://github.com/OP-TEE/optee_test/archive/3.4.0.tar.gz
+sha256 755904c5b845763a2460c32c21100a57c713009b6b88cc3fc21f0e5be8645e2b optee-test-3.4.0.tar.gz
+# Locally computed
+sha256 6e6810981f0ddab9e0d44399d0700a15d9f760a3c2843cc866659c2074139ae7 LICENSE.md
--- /dev/null
+################################################################################
+#
+# optee-test
+#
+################################################################################
+
+OPTEE_TEST_VERSION = 3.4.0
+OPTEE_TEST_SITE = $(call github,OP-TEE,optee_test,$(OPTEE_TEST_VERSION))
+OPTEE_TEST_LICENSE = GPL-2.0, BSD-2-Clause,
+OPTEE_TEST_LICENSE_FILES = LICENSE.md
+
+OPTEE_TEST_DEPENDENCIES = optee-client optee-os
+
+ifeq ($(BR2_aarch64),y)
+OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
+else ifeq ($(BR2_arm),y)
+OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
+endif
+OPTEE_TEST_CONF_OPTS = -DOPTEE_TEST_SDK=$(OPTEE_TEST_SDK)
+
+# Trusted Application are not built from CMake due to ta_dev_kit
+# dependencies. We must build and install them on target.
+define OPTEE_TEST_BUILD_TAS
+ $(foreach f,$(wildcard $(@D)/ta/*/Makefile), \
+ $(TARGET_CONFIGURE_OPTS) \
+ $(MAKE) CROSS_COMPILE=$(TARGET_CROSS) \
+ TA_DEV_KIT_DIR=$(OPTEE_TEST_SDK) \
+ -C $(dir $f) all
+ )
+endef
+define OPTEE_TEST_INSTALL_TAS
+ @mkdir -p $(TARGET_DIR)/lib/optee_armtz
+ @$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz $(@D)/ta/*/*.ta
+endef
+OPTEE_TEST_POST_BUILD_HOOKS += OPTEE_TEST_BUILD_TAS
+OPTEE_TEST_POST_INSTALL_TARGET_HOOKS += OPTEE_TEST_INSTALL_TAS
+
+$(eval $(cmake-package))