aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordp-arm <dimitris.papastamos@arm.com>2017-03-07 10:08:42 +0000
committerdp-arm <dimitris.papastamos@arm.com>2017-03-22 15:30:05 +0000
commit66b4c1660ab9094ffb5412ae0ca98eb4a8111662 (patch)
treeee01070093ab154756e8f1b288d2dac7af4b41f8
parent3944adca5943a050ca7e7e9cc802a9ae04dec186 (diff)
downloadplatform_external_arm-trusted-firmware-66b4c1660ab9094ffb5412ae0ca98eb4a8111662.tar.gz
platform_external_arm-trusted-firmware-66b4c1660ab9094ffb5412ae0ca98eb4a8111662.tar.bz2
platform_external_arm-trusted-firmware-66b4c1660ab9094ffb5412ae0ca98eb4a8111662.zip
mbedtls: Namespace TF specific macros
These macros are not part of mbed TLS so they should not be prefixed with `MBEDTLS_` to avoid potential collision in the future. Use the `TBBR_` suffix to highlight that they only used in TF. `MBEDTLS_KEY_ALG` was not modified because that is documented and used by platforms to select the key algorithm. Change-Id: Ief224681715c481691c80810501830ce16e210b0 Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
-rw-r--r--drivers/auth/mbedtls/mbedtls_common.c6
-rw-r--r--drivers/auth/mbedtls/mbedtls_crypto.mk10
-rw-r--r--include/drivers/auth/mbedtls/mbedtls_config.h10
3 files changed, 13 insertions, 13 deletions
diff --git a/drivers/auth/mbedtls/mbedtls_common.c b/drivers/auth/mbedtls/mbedtls_common.c
index 053bf1a49..1d2df5a53 100644
--- a/drivers/auth/mbedtls/mbedtls_common.c
+++ b/drivers/auth/mbedtls/mbedtls_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -36,9 +36,9 @@
/*
* mbed TLS heap
*/
-#if (MBEDTLS_KEY_ALG_ID == MBEDTLS_ECDSA)
+#if (TBBR_KEY_ALG_ID == TBBR_ECDSA)
#define MBEDTLS_HEAP_SIZE (14*1024)
-#elif (MBEDTLS_KEY_ALG_ID == MBEDTLS_RSA)
+#elif (TBBR_KEY_ALG_ID == TBBR_RSA)
#define MBEDTLS_HEAP_SIZE (8*1024)
#endif
static unsigned char heap[MBEDTLS_HEAP_SIZE];
diff --git a/drivers/auth/mbedtls/mbedtls_crypto.mk b/drivers/auth/mbedtls/mbedtls_crypto.mk
index b7880971a..302a0a1cc 100644
--- a/drivers/auth/mbedtls/mbedtls_crypto.mk
+++ b/drivers/auth/mbedtls/mbedtls_crypto.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -55,18 +55,18 @@ ifeq (${MBEDTLS_KEY_ALG},ecdsa)
ecp_curves.c \
ecp.c \
)
- MBEDTLS_KEY_ALG_ID := MBEDTLS_ECDSA
+ TBBR_KEY_ALG_ID := TBBR_ECDSA
else ifeq (${MBEDTLS_KEY_ALG},rsa)
MBEDTLS_CRYPTO_SOURCES += $(addprefix ${MBEDTLS_DIR}/library/, \
rsa.c \
)
- MBEDTLS_KEY_ALG_ID := MBEDTLS_RSA
+ TBBR_KEY_ALG_ID := TBBR_RSA
else
$(error "MBEDTLS_KEY_ALG=${MBEDTLS_KEY_ALG} not supported on mbed TLS")
endif
-# mbed TLS libraries rely on this define to build correctly
-$(eval $(call add_define,MBEDTLS_KEY_ALG_ID))
+# Needs to be set to drive mbed TLS configuration correctly
+$(eval $(call add_define,TBBR_KEY_ALG_ID))
BL1_SOURCES += ${MBEDTLS_CRYPTO_SOURCES}
BL2_SOURCES += ${MBEDTLS_CRYPTO_SOURCES}
diff --git a/include/drivers/auth/mbedtls/mbedtls_config.h b/include/drivers/auth/mbedtls/mbedtls_config.h
index a8d724152..9fce42422 100644
--- a/include/drivers/auth/mbedtls/mbedtls_config.h
+++ b/include/drivers/auth/mbedtls/mbedtls_config.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -33,8 +33,8 @@
/*
* Key algorithms currently supported on mbed TLS libraries
*/
-#define MBEDTLS_RSA 1
-#define MBEDTLS_ECDSA 2
+#define TBBR_RSA 1
+#define TBBR_ECDSA 2
/*
* Configuration file to build mbed TLS with the required features for
@@ -69,11 +69,11 @@
#define MBEDTLS_PLATFORM_C
-#if (MBEDTLS_KEY_ALG_ID == MBEDTLS_ECDSA)
+#if (TBBR_KEY_ALG_ID == TBBR_ECDSA)
#define MBEDTLS_ECDSA_C
#define MBEDTLS_ECP_C
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
-#elif (MBEDTLS_KEY_ALG_ID == MBEDTLS_RSA)
+#elif (TBBR_KEY_ALG_ID == TBBR_RSA)
#define MBEDTLS_RSA_C
#endif