espressif: Enable signature verification (RSA, EC256 and ED25519)

MbedTLS and Tinycrypt security lib options added to Espressif's
configuration and build.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
diff --git a/boot/espressif/include/crypto_config/ec256.cmake b/boot/espressif/include/crypto_config/ec256.cmake
new file mode 100644
index 0000000..36e3e01
--- /dev/null
+++ b/boot/espressif/include/crypto_config/ec256.cmake
@@ -0,0 +1,29 @@
+# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+set(MBEDTLS_ASN1_DIR "${MCUBOOT_ROOT_DIR}/ext/mbedtls-asn1")
+set(CRYPTO_INC
+    ${MBEDTLS_ASN1_DIR}/include
+    )
+set(crypto_srcs
+    # Additionally pull in just the ASN.1 parser from Mbed TLS.
+    ${MBEDTLS_ASN1_DIR}/src/asn1parse.c
+    ${MBEDTLS_ASN1_DIR}/src/platform_util.c
+    )
+
+if (DEFINED CONFIG_ESP_USE_MBEDTLS)
+    message(FATAL_ERROR "EC256 signature verification using Mbed TLS lib is not supported")
+elseif (DEFINED CONFIG_ESP_USE_TINYCRYPT)
+    set(TINYCRYPT_DIR ${MCUBOOT_ROOT_DIR}/ext/tinycrypt/lib)
+    list(APPEND CRYPTO_INC
+        ${TINYCRYPT_DIR}/include
+        )
+    list(APPEND crypto_srcs
+        ${ESPRESSIF_PORT_DIR}/keys.c
+        ${TINYCRYPT_DIR}/source/utils.c
+        ${TINYCRYPT_DIR}/source/sha256.c
+        ${TINYCRYPT_DIR}/source/ecc.c
+        ${TINYCRYPT_DIR}/source/ecc_dsa.c
+        )
+endif()
\ No newline at end of file