Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 1 | # |
dp-arm | 52b1fe5 | 2017-03-07 10:08:42 +0000 | [diff] [blame] | 2 | # Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 5 | # |
| 6 | |
| 7 | include drivers/auth/mbedtls/mbedtls_common.mk |
| 8 | |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 9 | # The platform may define the variable 'TF_MBEDTLS_KEY_ALG' to select the key |
Masahiro Yamada | 393c48f | 2017-01-06 16:51:34 +0900 | [diff] [blame] | 10 | # algorithm to use. Default algorithm is RSA. |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 11 | ifeq (${TF_MBEDTLS_KEY_ALG},) |
| 12 | TF_MBEDTLS_KEY_ALG := rsa |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 13 | endif |
| 14 | |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 15 | # If MBEDTLS_KEY_ALG build flag is defined use it to set TF_MBEDTLS_KEY_ALG for |
| 16 | # backward compatibility |
| 17 | ifdef MBEDTLS_KEY_ALG |
| 18 | ifeq (${ERROR_DEPRECATED},1) |
| 19 | $(error "MBEDTLS_KEY_ALG is deprecated. Please use the new build flag TF_MBEDTLS_KEY_ALG") |
| 20 | endif |
| 21 | $(warning "MBEDTLS_KEY_ALG is deprecated. Please use the new build flag TF_MBEDTLS_KEY_ALG") |
| 22 | TF_MBEDTLS_KEY_ALG := ${MBEDTLS_KEY_ALG} |
| 23 | endif |
| 24 | |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 25 | MBEDTLS_CRYPTO_SOURCES := drivers/auth/mbedtls/mbedtls_crypto.c \ |
| 26 | $(addprefix ${MBEDTLS_DIR}/library/, \ |
| 27 | bignum.c \ |
| 28 | md.c \ |
| 29 | md_wrap.c \ |
| 30 | pk.c \ |
| 31 | pk_wrap.c \ |
| 32 | pkparse.c \ |
| 33 | pkwrite.c \ |
| 34 | sha256.c \ |
| 35 | ) |
| 36 | |
| 37 | # Key algorithm specific files |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 38 | ifeq (${TF_MBEDTLS_KEY_ALG},ecdsa) |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 39 | MBEDTLS_CRYPTO_SOURCES += $(addprefix ${MBEDTLS_DIR}/library/, \ |
| 40 | ecdsa.c \ |
| 41 | ecp_curves.c \ |
| 42 | ecp.c \ |
| 43 | ) |
David Cunado | c7a1b19 | 2017-05-10 16:38:44 +0100 | [diff] [blame] | 44 | TF_MBEDTLS_KEY_ALG_ID := TF_MBEDTLS_ECDSA |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 45 | else ifeq (${TF_MBEDTLS_KEY_ALG},rsa) |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 46 | MBEDTLS_CRYPTO_SOURCES += $(addprefix ${MBEDTLS_DIR}/library/, \ |
| 47 | rsa.c \ |
| 48 | ) |
David Cunado | c7a1b19 | 2017-05-10 16:38:44 +0100 | [diff] [blame] | 49 | TF_MBEDTLS_KEY_ALG_ID := TF_MBEDTLS_RSA |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 50 | else |
David Cunado | b101018 | 2017-05-08 09:48:34 +0100 | [diff] [blame] | 51 | $(error "TF_MBEDTLS_KEY_ALG=${TF_MBEDTLS_KEY_ALG} not supported on mbed TLS") |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 52 | endif |
| 53 | |
dp-arm | 52b1fe5 | 2017-03-07 10:08:42 +0000 | [diff] [blame] | 54 | # Needs to be set to drive mbed TLS configuration correctly |
David Cunado | c7a1b19 | 2017-05-10 16:38:44 +0100 | [diff] [blame] | 55 | $(eval $(call add_define,TF_MBEDTLS_KEY_ALG_ID)) |
Juan Castillo | a57a4d5 | 2015-04-02 15:44:20 +0100 | [diff] [blame] | 56 | |
| 57 | BL1_SOURCES += ${MBEDTLS_CRYPTO_SOURCES} |
| 58 | BL2_SOURCES += ${MBEDTLS_CRYPTO_SOURCES} |