mbedtls_crypto.mk 1.32 KB
Newer Older
1
#
dp-arm's avatar
dp-arm committed
2
# Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
3
#
dp-arm's avatar
dp-arm committed
4
# SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
#

include drivers/auth/mbedtls/mbedtls_common.mk

# The platform may define the variable 'MBEDTLS_KEY_ALG' to select the key
10
# algorithm to use. Default algorithm is RSA.
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
ifeq (${MBEDTLS_KEY_ALG},)
    MBEDTLS_KEY_ALG		:=	rsa
endif

MBEDTLS_CRYPTO_SOURCES		:=	drivers/auth/mbedtls/mbedtls_crypto.c	\
					$(addprefix ${MBEDTLS_DIR}/library/,	\
					bignum.c				\
					md.c					\
					md_wrap.c				\
					pk.c 					\
					pk_wrap.c 				\
					pkparse.c 				\
					pkwrite.c 				\
					sha256.c				\
					)

# Key algorithm specific files
ifeq (${MBEDTLS_KEY_ALG},ecdsa)
    MBEDTLS_CRYPTO_SOURCES	+=	$(addprefix ${MBEDTLS_DIR}/library/,	\
    					ecdsa.c					\
    					ecp_curves.c				\
    					ecp.c					\
    					)
34
    TF_MBEDTLS_KEY_ALG_ID	:=	TF_MBEDTLS_ECDSA
35
36
37
38
else ifeq (${MBEDTLS_KEY_ALG},rsa)
    MBEDTLS_CRYPTO_SOURCES	+=	$(addprefix ${MBEDTLS_DIR}/library/,	\
    					rsa.c					\
    					)
39
    TF_MBEDTLS_KEY_ALG_ID	:=	TF_MBEDTLS_RSA
40
else
Juan Castillo's avatar
Juan Castillo committed
41
    $(error "MBEDTLS_KEY_ALG=${MBEDTLS_KEY_ALG} not supported on mbed TLS")
42
43
endif

dp-arm's avatar
dp-arm committed
44
# Needs to be set to drive mbed TLS configuration correctly
45
$(eval $(call add_define,TF_MBEDTLS_KEY_ALG_ID))
46
47
48

BL1_SOURCES			+=	${MBEDTLS_CRYPTO_SOURCES}
BL2_SOURCES			+=	${MBEDTLS_CRYPTO_SOURCES}