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 "ED25519 image signing using Mbed TLS lib is not supported")
17elseif (DEFINED CONFIG_ESP_USE_TINYCRYPT)
18    set(TINYCRYPT_DIR ${MCUBOOT_ROOT_DIR}/ext/tinycrypt/lib)
19    set(TINYCRYPT512_DIR ${MCUBOOT_ROOT_DIR}/ext/tinycrypt-sha512/lib)
20    list(APPEND CRYPTO_INC
21        ${TINYCRYPT_DIR}/include
22        ${TINYCRYPT512_DIR}/include
23        )
24    list(APPEND crypto_srcs
25        ${ESPRESSIF_PORT_DIR}/keys.c
26        ${TINYCRYPT_DIR}/source/utils.c
27        ${TINYCRYPT_DIR}/source/sha256.c
28        ${TINYCRYPT512_DIR}/source/sha512.c
29        ${MCUBOOT_ROOT_DIR}/ext/fiat/src/curve25519.c
30        )
31endif()