1# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
2#
3# SPDX-License-Identifier: Apache-2.0
4
5if (DEFINED CONFIG_ESP_USE_MBEDTLS)
6    set(MBEDTLS_DIR ${MCUBOOT_ROOT_DIR}/ext/mbedtls)
7    set(CRYPTO_INC
8        ${MBEDTLS_DIR}/include
9        )
10    set(crypto_srcs
11        ${ESPRESSIF_PORT_DIR}/keys.c
12        ${MBEDTLS_DIR}/library/platform.c
13        ${MBEDTLS_DIR}/library/platform_util.c
14        ${MBEDTLS_DIR}/library/sha256.c
15        ${MBEDTLS_DIR}/library/rsa.c
16        ${MBEDTLS_DIR}/library/bignum.c
17        ${MBEDTLS_DIR}/library/asn1parse.c
18        ${MBEDTLS_DIR}/library/md.c
19        ${MBEDTLS_DIR}/library/memory_buffer_alloc.c
20        )
21    if (DEFINED MBEDTLS_CONFIG_FILE)
22        add_definitions(-DMBEDTLS_CONFIG_FILE=\"${MBEDTLS_CONFIG_FILE}\")
23    else()
24        add_definitions(-DMBEDTLS_CONFIG_FILE=\"${ESPRESSIF_PORT_DIR}/include/crypto_config/mbedtls_custom_config.h\")
25    endif()
26elseif (DEFINED CONFIG_ESP_USE_TINYCRYPT)
27    message(FATAL_ERROR "RSA signature verification using Tinycrypt lib is not supported")
28endif()