mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
refactor(mbedtls): avoid including MBEDTLS_CONFIG_FILE
Currently we include MBEDTLS_CONFIG_FILE directly and if a custom config file is used it will included. However from mbedtls-3.x onwards it discourages usage of MBEDTLS_CONFIG_FILE include directly, so to resolve this and keep 2.28 compatibility include version.h which would include the custom config file if present and also would expose us with mbedtls-major-version number which could be used for selecting features and functions for mbedtls 2.28 or 3.3 Change-Id: I029992311be2a38b588ebbb350875b03ea29acdb Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
This commit is contained in:
parent
5a65fcd5f9
commit
a8eadc51a3
14 changed files with 49 additions and 41 deletions
|
@ -1,13 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2022-2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <common/tbbr/cot_def.h>
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <tools_share/cca_oid.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2022, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <common/tbbr/cot_def.h>
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
|
||||
#include <tools_share/dualroot_oid.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
/*
|
||||
* Allocate static buffers to store the authentication parameters extracted from
|
||||
* the certificates.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -10,10 +10,11 @@
|
|||
/* mbed TLS headers */
|
||||
#include <mbedtls/memory_buffer_alloc.h>
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/auth/mbedtls/mbedtls_common.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
|
||||
#include <plat/common/platform.h>
|
||||
|
||||
static void cleanup(void)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -14,12 +14,13 @@
|
|||
#include <mbedtls/memory_buffer_alloc.h>
|
||||
#include <mbedtls/oid.h>
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/version.h>
|
||||
#include <mbedtls/x509.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>
|
||||
|
||||
#include <plat/common/platform.h>
|
||||
|
||||
#define LIB_NAME "mbed TLS"
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include <drivers/auth/tbbr_cot_common.h>
|
||||
|
||||
#if USE_TBBR_DEFS
|
||||
#include <tools_share/tbbr_oid.h>
|
||||
#else
|
||||
#include <platform_oid.h>
|
||||
#endif
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
static auth_param_type_desc_t scp_bl2u_hash = AUTH_PARAM_TYPE_DESC(
|
||||
AUTH_PARAM_HASH, SCP_FWU_CFG_HASH_OID);
|
||||
static auth_param_type_desc_t bl2u_hash = AUTH_PARAM_TYPE_DESC(
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2021-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <drivers/auth/tbbr_cot_common.h>
|
||||
|
||||
#if USE_TBBR_DEFS
|
||||
|
@ -15,8 +16,8 @@
|
|||
#else
|
||||
#include <platform_oid.h>
|
||||
#endif
|
||||
#include <platform_def.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
static unsigned char trusted_world_pk_buf[PK_DER_LEN];
|
||||
static unsigned char non_trusted_world_pk_buf[PK_DER_LEN];
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include <drivers/auth/tbbr_cot_common.h>
|
||||
|
||||
#if USE_TBBR_DEFS
|
||||
#include <tools_share/tbbr_oid.h>
|
||||
#else
|
||||
#include <platform_oid.h>
|
||||
#endif
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
static unsigned char soc_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_hash_buf[HASH_DER_LEN];
|
||||
static unsigned char tos_fw_extra1_hash_buf[HASH_DER_LEN];
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include <drivers/auth/tbbr_cot_common.h>
|
||||
|
||||
#if USE_TBBR_DEFS
|
||||
#include <tools_share/tbbr_oid.h>
|
||||
#else
|
||||
#include <platform_oid.h>
|
||||
#endif
|
||||
|
||||
#include <platform_def.h>
|
||||
/*
|
||||
* The platform must allocate buffers to store the authentication parameters
|
||||
* extracted from the certificates. In this case, because of the way the CoT is
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,9 +7,7 @@
|
|||
#ifndef COT_DEF_H
|
||||
#define COT_DEF_H
|
||||
|
||||
#ifdef MBEDTLS_CONFIG_FILE
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
/* TBBR CoT definitions */
|
||||
#if defined(SPD_spmd)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,7 +7,6 @@
|
|||
#ifndef AUTH_MOD_H
|
||||
#define AUTH_MOD_H
|
||||
|
||||
#include <common/tbbr/cot_def.h>
|
||||
#include <common/tbbr/tbbr_img_def.h>
|
||||
#include <drivers/auth/auth_common.h>
|
||||
#include <drivers/auth/img_parser_mod.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2020,2023, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,6 +7,7 @@
|
|||
#ifndef TBBR_COT_COMMON_H
|
||||
#define TBBR_COT_COMMON_H
|
||||
|
||||
#include <common/tbbr/cot_def.h>
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
|
||||
extern unsigned char tb_fw_hash_buf[HASH_DER_LEN];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2022, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2020-2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,8 +7,10 @@
|
|||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <mbedtls/version.h>
|
||||
|
||||
#include <common/fdt_wrappers.h>
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#include <common/tbbr/cot_def.h>
|
||||
#include <drivers/auth/auth_mod.h>
|
||||
#include <lib/fconf/fconf.h>
|
||||
#include <lib/object_pool.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -8,20 +8,20 @@
|
|||
#include <string.h>
|
||||
#include <libfdt.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
#if CRYPTO_SUPPORT
|
||||
#include <mbedtls/version.h>
|
||||
#endif /* CRYPTO_SUPPORT */
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <common/desc_image_load.h>
|
||||
#include <common/tbbr/tbbr_img_def.h>
|
||||
#if CRYPTO_SUPPORT
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif /* CRYPTO_SUPPORT */
|
||||
#include <lib/fconf/fconf.h>
|
||||
#include <lib/fconf/fconf_dyn_cfg_getter.h>
|
||||
#include <lib/fconf/fconf_tbbr_getter.h>
|
||||
|
||||
#include <plat/arm/common/arm_dyn_cfg_helpers.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
#include <platform_def.h>
|
||||
|
||||
#if CRYPTO_SUPPORT
|
||||
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
#ifdef CONFIG_MVEBU_SECURE_BOOT
|
||||
#include <libconfig.h> /* for parsing config file */
|
||||
|
||||
#if !defined(MBEDTLS_CONFIG_FILE)
|
||||
#include "mbedtls/config.h"
|
||||
#else
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
/* mbedTLS stuff */
|
||||
#if defined(MBEDTLS_BIGNUM_C) && defined(MBEDTLS_ENTROPY_C) && \
|
||||
defined(MBEDTLS_SHA256_C) && \
|
||||
|
@ -34,6 +28,7 @@
|
|||
#include <mbedtls/md.h>
|
||||
#include <mbedtls/pk.h>
|
||||
#include <mbedtls/sha256.h>
|
||||
#include <mbedtls/version.h>
|
||||
#include <mbedtls/x509.h>
|
||||
#else
|
||||
#error "Bad mbedTLS configuration!"
|
||||
|
|
Loading…
Add table
Reference in a new issue