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/rsa.cmake b/boot/espressif/include/crypto_config/rsa.cmake
new file mode 100644
index 0000000..01d48f0
--- /dev/null
+++ b/boot/espressif/include/crypto_config/rsa.cmake
@@ -0,0 +1,27 @@
+# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+if (DEFINED CONFIG_ESP_USE_MBEDTLS)
+ set(MBEDTLS_DIR ${MCUBOOT_ROOT_DIR}/ext/mbedtls)
+ set(CRYPTO_INC
+ ${MBEDTLS_DIR}/include
+ )
+ set(crypto_srcs
+ ${ESPRESSIF_PORT_DIR}/keys.c
+ ${MBEDTLS_DIR}/library/platform.c
+ ${MBEDTLS_DIR}/library/platform_util.c
+ ${MBEDTLS_DIR}/library/sha256.c
+ ${MBEDTLS_DIR}/library/rsa.c
+ ${MBEDTLS_DIR}/library/bignum.c
+ ${MBEDTLS_DIR}/library/asn1parse.c
+ ${MBEDTLS_DIR}/library/memory_buffer_alloc.c
+ )
+ if (DEFINED MBEDTLS_CONFIG_FILE)
+ add_definitions(-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\")
+ else()
+ add_definitions(-DMBEDTLS_CONFIG_FILE=\"${ESPRESSIF_PORT_DIR}/include/crypto_config/mbedtls_custom_config.h\")
+ endif()
+elseif (DEFINED CONFIG_ESP_USE_TINYCRYPT)
+ message(FATAL_ERROR "RSA signature verification using Tinycrypt lib is not supported")
+endif()
\ No newline at end of file