1# Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
2#
3# SPDX-License-Identifier: Apache-2.0
4
5set(MBEDTLS_ASN1_DIR "${MCUBOOT_ROOT_DIR}/ext/mbedtls-asn1")
6set(CRYPTO_INC
7    ${MBEDTLS_ASN1_DIR}/include
8    )
9set(crypto_srcs
10    # Additionally pull in just the ASN.1 parser from Mbed TLS.
11    ${MBEDTLS_ASN1_DIR}/src/asn1parse.c
12    ${MBEDTLS_ASN1_DIR}/src/platform_util.c
13    )
14
15if (DEFINED CONFIG_ESP_USE_MBEDTLS)
16    message(FATAL_ERROR "EC256 signature verification using Mbed TLS lib is not supported")
17elseif (DEFINED CONFIG_ESP_USE_TINYCRYPT)
18    set(TINYCRYPT_DIR ${MCUBOOT_ROOT_DIR}/ext/tinycrypt/lib)
19    list(APPEND CRYPTO_INC
20        ${TINYCRYPT_DIR}/include
21        )
22    list(APPEND crypto_srcs
23        ${ESPRESSIF_PORT_DIR}/keys.c
24        ${TINYCRYPT_DIR}/source/utils.c
25        ${TINYCRYPT_DIR}/source/sha256.c
26        ${TINYCRYPT_DIR}/source/ecc.c
27        ${TINYCRYPT_DIR}/source/ecc_dsa.c
28        )
29endif()