Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
f0019fcc
Commit
f0019fcc
authored
May 16, 2017
by
danh-arm
Committed by
GitHub
May 16, 2017
Browse files
Merge pull request #935 from davidcunado-arm/dc/mbed_api
mbedtls: Namespace update for TF specific macros
parents
6cea9451
6a0b0d7f
Changes
4
Show whitespace changes
Inline
Side-by-side
drivers/auth/mbedtls/mbedtls_common.c
View file @
f0019fcc
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
/*
/*
* mbed TLS heap
* mbed TLS heap
*/
*/
#if (T
BBR
_KEY_ALG_ID == T
BBR
_ECDSA)
#if (T
F_MBEDTLS
_KEY_ALG_ID == T
F_MBEDTLS
_ECDSA)
#define MBEDTLS_HEAP_SIZE (14*1024)
#define MBEDTLS_HEAP_SIZE (14*1024)
#elif (T
BBR
_KEY_ALG_ID == T
BBR
_RSA)
#elif (T
F_MBEDTLS
_KEY_ALG_ID == T
F_MBEDTLS
_RSA)
#define MBEDTLS_HEAP_SIZE (8*1024)
#define MBEDTLS_HEAP_SIZE (8*1024)
#endif
#endif
static
unsigned
char
heap
[
MBEDTLS_HEAP_SIZE
];
static
unsigned
char
heap
[
MBEDTLS_HEAP_SIZE
];
...
...
drivers/auth/mbedtls/mbedtls_crypto.mk
View file @
f0019fcc
...
@@ -6,10 +6,20 @@
...
@@ -6,10 +6,20 @@
include
drivers/auth/mbedtls/mbedtls_common.mk
include
drivers/auth/mbedtls/mbedtls_common.mk
# The platform may define the variable 'MBEDTLS_KEY_ALG' to select the key
# The platform may define the variable '
TF_
MBEDTLS_KEY_ALG' to select the key
# algorithm to use. Default algorithm is RSA.
# algorithm to use. Default algorithm is RSA.
ifeq
(${MBEDTLS_KEY_ALG},)
ifeq
(${TF_MBEDTLS_KEY_ALG},)
MBEDTLS_KEY_ALG
:=
rsa
TF_MBEDTLS_KEY_ALG
:=
rsa
endif
# If MBEDTLS_KEY_ALG build flag is defined use it to set TF_MBEDTLS_KEY_ALG for
# backward compatibility
ifdef
MBEDTLS_KEY_ALG
ifeq
(${ERROR_DEPRECATED},1)
$(error
"MBEDTLS_KEY_ALG is deprecated. Please use the new build flag TF_MBEDTLS_KEY_ALG"
)
endif
$(warning
"MBEDTLS_KEY_ALG is deprecated. Please use the new build flag TF_MBEDTLS_KEY_ALG"
)
TF_MBEDTLS_KEY_ALG
:=
${MBEDTLS_KEY_ALG}
endif
endif
MBEDTLS_CRYPTO_SOURCES
:=
drivers/auth/mbedtls/mbedtls_crypto.c
\
MBEDTLS_CRYPTO_SOURCES
:=
drivers/auth/mbedtls/mbedtls_crypto.c
\
...
@@ -25,24 +35,24 @@ MBEDTLS_CRYPTO_SOURCES := drivers/auth/mbedtls/mbedtls_crypto.c \
...
@@ -25,24 +35,24 @@ MBEDTLS_CRYPTO_SOURCES := drivers/auth/mbedtls/mbedtls_crypto.c \
)
)
# Key algorithm specific files
# Key algorithm specific files
ifeq
(${MBEDTLS_KEY_ALG},ecdsa)
ifeq
(${
TF_
MBEDTLS_KEY_ALG},ecdsa)
MBEDTLS_CRYPTO_SOURCES
+=
$(
addprefix
${MBEDTLS_DIR}
/library/,
\
MBEDTLS_CRYPTO_SOURCES
+=
$(
addprefix
${MBEDTLS_DIR}
/library/,
\
ecdsa.c
\
ecdsa.c
\
ecp_curves.c
\
ecp_curves.c
\
ecp.c
\
ecp.c
\
)
)
T
BBR
_KEY_ALG_ID
:=
T
BBR
_ECDSA
T
F_MBEDTLS
_KEY_ALG_ID
:=
T
F_MBEDTLS
_ECDSA
else
ifeq
(${MBEDTLS_KEY_ALG},rsa)
else
ifeq
(${
TF_
MBEDTLS_KEY_ALG},rsa)
MBEDTLS_CRYPTO_SOURCES
+=
$(
addprefix
${MBEDTLS_DIR}
/library/,
\
MBEDTLS_CRYPTO_SOURCES
+=
$(
addprefix
${MBEDTLS_DIR}
/library/,
\
rsa.c
\
rsa.c
\
)
)
T
BBR
_KEY_ALG_ID
:=
T
BBR
_RSA
T
F_MBEDTLS
_KEY_ALG_ID
:=
T
F_MBEDTLS
_RSA
else
else
$(error
"MBEDTLS_KEY_ALG=${MBEDTLS_KEY_ALG} not supported on mbed TLS"
)
$(error
"
TF_
MBEDTLS_KEY_ALG=${
TF_
MBEDTLS_KEY_ALG} not supported on mbed TLS"
)
endif
endif
# Needs to be set to drive mbed TLS configuration correctly
# Needs to be set to drive mbed TLS configuration correctly
$(eval
$(call
add_define,T
BBR
_KEY_ALG_ID))
$(eval
$(call
add_define,T
F_MBEDTLS
_KEY_ALG_ID))
BL1_SOURCES
+=
${MBEDTLS_CRYPTO_SOURCES}
BL1_SOURCES
+=
${MBEDTLS_CRYPTO_SOURCES}
BL2_SOURCES
+=
${MBEDTLS_CRYPTO_SOURCES}
BL2_SOURCES
+=
${MBEDTLS_CRYPTO_SOURCES}
include/drivers/auth/mbedtls/mbedtls_config.h
View file @
f0019fcc
...
@@ -9,8 +9,8 @@
...
@@ -9,8 +9,8 @@
/*
/*
* Key algorithms currently supported on mbed TLS libraries
* Key algorithms currently supported on mbed TLS libraries
*/
*/
#define T
BBR
_RSA 1
#define T
F_MBEDTLS
_RSA
1
#define T
BBR
_ECDSA 2
#define T
F_MBEDTLS
_ECDSA 2
/*
/*
* Configuration file to build mbed TLS with the required features for
* Configuration file to build mbed TLS with the required features for
...
@@ -45,11 +45,11 @@
...
@@ -45,11 +45,11 @@
#define MBEDTLS_PLATFORM_C
#define MBEDTLS_PLATFORM_C
#if (T
BBR
_KEY_ALG_ID == T
BBR
_ECDSA)
#if (T
F_MBEDTLS
_KEY_ALG_ID == T
F_MBEDTLS
_ECDSA)
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
#elif (T
BBR
_KEY_ALG_ID == T
BBR
_RSA)
#elif (T
F_MBEDTLS
_KEY_ALG_ID == T
F_MBEDTLS
_RSA)
#define MBEDTLS_RSA_C
#define MBEDTLS_RSA_C
#endif
#endif
...
...
plat/arm/common/arm_common.mk
View file @
f0019fcc
...
@@ -171,7 +171,7 @@ ifneq (${TRUSTED_BOARD_BOOT},0)
...
@@ -171,7 +171,7 @@ ifneq (${TRUSTED_BOARD_BOOT},0)
$(eval
$(call
FWU_FIP_ADD_IMG,NS_BL2U,--fwu))
$(eval
$(call
FWU_FIP_ADD_IMG,NS_BL2U,--fwu))
MBEDTLS_KEY_ALG
:=
${KEY_ALG}
TF_
MBEDTLS_KEY_ALG
:=
${KEY_ALG}
# We expect to locate the *.mk files under the directories specified below
# We expect to locate the *.mk files under the directories specified below
CRYPTO_LIB_MK
:=
drivers/auth/mbedtls/mbedtls_crypto.mk
CRYPTO_LIB_MK
:=
drivers/auth/mbedtls/mbedtls_crypto.mk
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment