aboutsummaryrefslogtreecommitdiff
path: root/drivers/auth/mbedtls
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-12-14 00:18:21 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2019-01-04 10:43:17 +0000
commit09d40e0e08283a249e7dce0e106c07c5141f9b7e (patch)
tree46e7af7b5be2738948b359b2a07078e4cf1bbec1 /drivers/auth/mbedtls
parentf5478dedf9e096d9539362b38ceb096b940ba3e2 (diff)
downloadtrusted-firmware-a-09d40e0e08283a249e7dce0e106c07c5141f9b7e.tar.gz
Sanitise includes across codebase
Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems: 46f9b2c3a282 ("drivers: add tzc380 support"). This problem was introduced in commit 4ecca33988b9 ("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'drivers/auth/mbedtls')
-rw-r--r--drivers/auth/mbedtls/mbedtls_common.c12
-rw-r--r--drivers/auth/mbedtls/mbedtls_common.mk3
-rw-r--r--drivers/auth/mbedtls/mbedtls_crypto.c9
-rw-r--r--drivers/auth/mbedtls/mbedtls_x509_parser.c9
4 files changed, 18 insertions, 15 deletions
diff --git a/drivers/auth/mbedtls/mbedtls_common.c b/drivers/auth/mbedtls/mbedtls_common.c
index dbf45baebd..b6d02fd108 100644
--- a/drivers/auth/mbedtls/mbedtls_common.c
+++ b/drivers/auth/mbedtls/mbedtls_common.c
@@ -5,14 +5,16 @@
*/
#include <assert.h>
-#include <debug.h>
+#include <stddef.h>
+
/* mbed TLS headers */
#include <mbedtls/memory_buffer_alloc.h>
#include <mbedtls/platform.h>
-#include <mbedtls_common.h>
-#include <mbedtls_config.h>
-#include <platform.h>
-#include <stddef.h>
+
+#include <common/debug.h>
+#include <drivers/auth/mbedtls/mbedtls_common.h>
+#include <drivers/auth/mbedtls/mbedtls_config.h>
+#include <plat/common/platform.h>
static void cleanup(void)
{
diff --git a/drivers/auth/mbedtls/mbedtls_common.mk b/drivers/auth/mbedtls/mbedtls_common.mk
index cfbd86ab93..63e65bd47c 100644
--- a/drivers/auth/mbedtls/mbedtls_common.mk
+++ b/drivers/auth/mbedtls/mbedtls_common.mk
@@ -14,10 +14,9 @@ ifeq (${MBEDTLS_DIR},)
endif
MBEDTLS_INC = -I${MBEDTLS_DIR}/include
-INCLUDES += -Iinclude/drivers/auth/mbedtls
# Specify mbed TLS configuration file
-MBEDTLS_CONFIG_FILE := "<mbedtls_config.h>"
+MBEDTLS_CONFIG_FILE := "<drivers/auth/mbedtls/mbedtls_config.h>"
$(eval $(call add_define,MBEDTLS_CONFIG_FILE))
MBEDTLS_SOURCES += drivers/auth/mbedtls/mbedtls_common.c
diff --git a/drivers/auth/mbedtls/mbedtls_crypto.c b/drivers/auth/mbedtls/mbedtls_crypto.c
index bc9ed3a85e..33420fbbd1 100644
--- a/drivers/auth/mbedtls/mbedtls_crypto.c
+++ b/drivers/auth/mbedtls/mbedtls_crypto.c
@@ -4,10 +4,6 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <crypto_mod.h>
-#include <debug.h>
-#include <mbedtls_common.h>
-#include <mbedtls_config.h>
#include <stddef.h>
#include <string.h>
@@ -17,6 +13,11 @@
#include <mbedtls/oid.h>
#include <mbedtls/platform.h>
+#include <common/debug.h>
+#include <drivers/auth/crypto_mod.h>
+#include <drivers/auth/mbedtls/mbedtls_common.h>
+#include <drivers/auth/mbedtls/mbedtls_config.h>
+
#define LIB_NAME "mbed TLS"
/*
diff --git a/drivers/auth/mbedtls/mbedtls_x509_parser.c b/drivers/auth/mbedtls/mbedtls_x509_parser.c
index bda1208af9..129566bd69 100644
--- a/drivers/auth/mbedtls/mbedtls_x509_parser.c
+++ b/drivers/auth/mbedtls/mbedtls_x509_parser.c
@@ -12,20 +12,21 @@
* extensions field, such as an image hash or a public key.
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <img_parser_mod.h>
-#include <mbedtls_common.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
-#include <utils.h>
/* mbed TLS headers */
#include <mbedtls/asn1.h>
#include <mbedtls/oid.h>
#include <mbedtls/platform.h>
+#include <arch_helpers.h>
+#include <drivers/auth/img_parser_mod.h>
+#include <drivers/auth/mbedtls/mbedtls_common.h>
+#include <lib/utils.h>
+
/* Maximum OID string length ("a.b.c.d.e.f ...") */
#define MAX_OID_STR_LEN 64