xtest: Makefile: link against OpenSSL if MBed TLS is enabled in TA

Commit 950ea1cda6d3 ("regression: add case 8103") introduces a test that
needs OpenSSL to verify a certificate generated by a TA with Mbed TLS. It
updates xtest's CMakeLists.txt to link against OpenSSL when found, but the
regular Makefile is not updated.

This commit adds support for the new test to the non-CMake build by
linking xtest against the OpenSSL static library when CFG_TA_MBEDTLS=y.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/host/xtest/Makefile b/host/xtest/Makefile
index b4d18f3..5ee68d6 100644
--- a/host/xtest/Makefile
+++ b/host/xtest/Makefile
@@ -24,6 +24,16 @@
 OBJDUMP		?= $(CROSS_COMPILE)objdump
 READELF		?= $(CROSS_COMPILE)readelf
 
+# OpenSSL is used by GP tests series 8500 and Mbed TLS test 8103
+ifneq (,$(filter y,$(CFG_GP_PACKAGE_PATH) $(CFG_TA_MBEDTLS)))
+CFLAGS += -Ifor_gp/include -DOPENSSL_FOUND=1
+ifeq ($(COMPILE_NS_USER),32)
+LDFLAGS += ../lib/armv7/libcrypto.a -ldl
+else
+LDFLAGS += ../lib/armv8/libcrypto.a -ldl
+endif
+endif
+
 srcs := regression_1000.c
 
 ifeq ($(CFG_GP_SOCKETS),y)
@@ -111,8 +121,6 @@
 CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters
 CFLAGS += -I../../ta/GP_TTA_testingClientAPI
 
-# need more include: openssl
-CFLAGS += -Ifor_gp/include
 
 # by default, the client application is compiled as the kernel of optee-os
 ifeq ($(CFG_ARM32_core),y)
@@ -121,12 +129,6 @@
 COMPILE_NS_USER ?= 64
 endif
 
-ifeq ($(COMPILE_NS_USER),32)
-LDFLAGS += ../lib/armv7/libcrypto.a
-else
-LDFLAGS += ../lib/armv8/libcrypto.a
-endif
-
 endif
 
 TA_DIR ?= /lib/optee_armtz