Commit e715e676 authored by danh-arm's avatar danh-arm Committed by GitHub
Browse files

Merge pull request #938 from masahir0y/tools_share

Collect headers shared between TF and host-tools into include/tools_share
parents c1de3fdd 232c6b34
...@@ -19,10 +19,6 @@ tools/cert_create/src/**/*.o ...@@ -19,10 +19,6 @@ tools/cert_create/src/**/*.o
tools/cert_create/cert_create tools/cert_create/cert_create
tools/cert_create/cert_create.exe tools/cert_create/cert_create.exe
# Ignore header files copied.
tools/fiptool/firmware_image_package.h
tools/fiptool/uuid.h
# GNU GLOBAL files # GNU GLOBAL files
GPATH GPATH
GRTAGS GRTAGS
......
...@@ -179,7 +179,8 @@ INCLUDES += -Iinclude/bl1 \ ...@@ -179,7 +179,8 @@ INCLUDES += -Iinclude/bl1 \
-Iinclude/plat/common \ -Iinclude/plat/common \
-Iinclude/services \ -Iinclude/services \
${PLAT_INCLUDES} \ ${PLAT_INCLUDES} \
${SPD_INCLUDES} ${SPD_INCLUDES} \
-Iinclude/tools_share
################################################################################ ################################################################################
...@@ -442,6 +443,7 @@ $(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA)) ...@@ -442,6 +443,7 @@ $(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA))
$(eval $(call assert_boolean,SPIN_ON_BL1_EXIT)) $(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
$(eval $(call assert_boolean,TRUSTED_BOARD_BOOT)) $(eval $(call assert_boolean,TRUSTED_BOARD_BOOT))
$(eval $(call assert_boolean,USE_COHERENT_MEM)) $(eval $(call assert_boolean,USE_COHERENT_MEM))
$(eval $(call assert_boolean,USE_TBBR_DEFS))
$(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY)) $(eval $(call assert_boolean,WARMBOOT_ENABLE_DCACHE_EARLY))
$(eval $(call assert_numeric,ARM_ARCH_MAJOR)) $(eval $(call assert_numeric,ARM_ARCH_MAJOR))
...@@ -480,6 +482,7 @@ $(eval $(call add_define,SPD_${SPD})) ...@@ -480,6 +482,7 @@ $(eval $(call add_define,SPD_${SPD}))
$(eval $(call add_define,SPIN_ON_BL1_EXIT)) $(eval $(call add_define,SPIN_ON_BL1_EXIT))
$(eval $(call add_define,TRUSTED_BOARD_BOOT)) $(eval $(call add_define,TRUSTED_BOARD_BOOT))
$(eval $(call add_define,USE_COHERENT_MEM)) $(eval $(call add_define,USE_COHERENT_MEM))
$(eval $(call add_define,USE_TBBR_DEFS))
$(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY)) $(eval $(call add_define,WARMBOOT_ENABLE_DCACHE_EARLY))
# Define the EL3_PAYLOAD_BASE flag only if it is provided. # Define the EL3_PAYLOAD_BASE flag only if it is provided.
...@@ -603,7 +606,7 @@ certtool: ${CRTTOOL} ...@@ -603,7 +606,7 @@ certtool: ${CRTTOOL}
.PHONY: ${CRTTOOL} .PHONY: ${CRTTOOL}
${CRTTOOL}: ${CRTTOOL}:
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} ${Q}${MAKE} PLAT=${PLAT} USE_TBBR_DEFS=${USE_TBBR_DEFS} --no-print-directory -C ${CRTTOOLPATH}
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
@echo "Built $@ successfully" @echo "Built $@ successfully"
@${ECHO_BLANK_LINE} @${ECHO_BLANK_LINE}
......
...@@ -914,7 +914,11 @@ section), but it can also be built separately with the following command: ...@@ -914,7 +914,11 @@ section), but it can also be built separately with the following command:
make PLAT=<platform> [DEBUG=1] [V=1] certtool make PLAT=<platform> [DEBUG=1] [V=1] certtool
Specifying the platform is mandatory since the tool is platform specific. For platforms that do not require their own IDs in certificate files,
the generic 'cert_create' tool can be built with the following command:
make USE_TBBR_DEFS=1 [DEBUG=1] [V=1] certtool
`DEBUG=1` builds the tool in debug mode. `V=1` makes the build process more `DEBUG=1` builds the tool in debug mode. `V=1` makes the build process more
verbose. The following command should be used to obtain help about the tool: verbose. The following command should be used to obtain help about the tool:
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <auth_mod.h> #include <auth_mod.h>
#include <platform_def.h> #include <platform_def.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h> #include <platform_oid.h>
#endif
#include <stddef.h> #include <stddef.h>
/* /*
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#ifndef __BOARD_ARM_OID_H__ #ifndef __TBBR_OID_H__
#define __BOARD_ARM_OID_H__ #define __TBBR_OID_H__
/* /*
* The following is a list of OID values defined and reserved by ARM, which * The following is a list of OID values defined and reserved by ARM, which
* are used to define the extension fields of the certificate structure, as * are used to define the extension fields of the certificate structure, as
* defined in the Trusted Board Boot Requirements (TBBR) specification, * defined in the Trusted Board Boot Requirements (TBBR) specification,
* ARM DEN0006C-1. * ARM DEN0006C-1.
*
* Non-ARM platform owners that wish to align with the TBBR should define
* constants with the same name in their own platform port(s), using their
* own OIDs obtained from the ITU-T.
*/ */
...@@ -140,4 +136,4 @@ ...@@ -140,4 +136,4 @@
/* NonTrustedWorldBootloaderHash - BL33 */ /* NonTrustedWorldBootloaderHash - BL33 */
#define NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID "1.3.6.1.4.1.4128.2100.1201" #define NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID "1.3.6.1.4.1.4128.2100.1201"
#endif /* __BOARD_ARM_OID_H__ */ #endif /* __TBBR_OID_H__ */
...@@ -54,7 +54,7 @@ endef ...@@ -54,7 +54,7 @@ endef
# Convenience function for verifying option has a boolean value # Convenience function for verifying option has a boolean value
# $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1 # $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1
define assert_boolean define assert_boolean
$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean)) $(if $(filter-out 0 1,$($1)),$(error $1 must be boolean))
endef endef
0-9 := 0 1 2 3 4 5 6 7 8 9 0-9 := 0 1 2 3 4 5 6 7 8 9
......
...@@ -128,6 +128,9 @@ TRUSTED_BOARD_BOOT := 0 ...@@ -128,6 +128,9 @@ TRUSTED_BOARD_BOOT := 0
# Build option to choose whether Trusted firmware uses Coherent memory or not. # Build option to choose whether Trusted firmware uses Coherent memory or not.
USE_COHERENT_MEM := 1 USE_COHERENT_MEM := 1
# Use tbbr_oid.h instead of platform_oid.h
USE_TBBR_DEFS = $(ERROR_DEPRECATED)
# Build verbosity # Build verbosity
V := 0 V := 0
......
/* /*
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <arm_def.h> #include <arm_def.h>
#include <assert.h> #include <assert.h>
#include <platform.h> #include <platform.h>
#include <platform_oid.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <tbbr_oid.h>
/* Weak definition may be overridden in specific platform */ /* Weak definition may be overridden in specific platform */
#pragma weak plat_match_rotpk #pragma weak plat_match_rotpk
......
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h> #include <assert.h>
#include <platform_oid.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <tbbr_oid.h>
#include "fvp_def.h" #include "fvp_def.h"
/* /*
......
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "../../../../../include/plat/arm/board/common/board_arm_oid.h"
/*
* Required platform OIDs
* (Provided by included header)
*/
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "../../../../../include/plat/arm/board/common/board_arm_oid.h"
/*
* Required platform OIDs
* (Provided by included header)
*/
...@@ -87,6 +87,9 @@ SEPARATE_CODE_AND_RODATA := 1 ...@@ -87,6 +87,9 @@ SEPARATE_CODE_AND_RODATA := 1
# Enable new version of image loading on ARM platforms # Enable new version of image loading on ARM platforms
LOAD_IMAGE_V2 := 1 LOAD_IMAGE_V2 := 1
# Use generic OID definition (tbbr_oid.h)
USE_TBBR_DEFS := 1
PLAT_INCLUDES += -Iinclude/common/tbbr \ PLAT_INCLUDES += -Iinclude/common/tbbr \
-Iinclude/plat/arm/common -Iinclude/plat/arm/common
......
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -7,7 +7,11 @@ ...@@ -7,7 +7,11 @@
#include <assert.h> #include <assert.h>
#include <auth/auth_mod.h> #include <auth/auth_mod.h>
#include <platform.h> #include <platform.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h> #include <platform_oid.h>
#endif
#include <string.h> #include <string.h>
/* /*
......
# #
# Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. # Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
# #
...@@ -27,6 +27,13 @@ MAKE_HELPERS_DIRECTORY := ../../make_helpers/ ...@@ -27,6 +27,13 @@ MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
include ${MAKE_HELPERS_DIRECTORY}build_env.mk include ${MAKE_HELPERS_DIRECTORY}build_env.mk
ifeq (${USE_TBBR_DEFS},1)
# In this case, cert_tool is platform-independent
PLAT_MSG := TBBR Generic
PLAT_INCLUDE := ../../include/tools_share
else
PLAT_MSG := ${PLAT}
PLATFORM_ROOT := ../../plat/ PLATFORM_ROOT := ../../plat/
include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
...@@ -35,6 +42,7 @@ PLAT_INCLUDE := $(wildcard ${PLAT_DIR}include) ...@@ -35,6 +42,7 @@ PLAT_INCLUDE := $(wildcard ${PLAT_DIR}include)
ifeq ($(PLAT_INCLUDE),) ifeq ($(PLAT_INCLUDE),)
$(error "Error: Invalid platform '${PLAT}' has no include directory.") $(error "Error: Invalid platform '${PLAT}' has no include directory.")
endif endif
endif
ifeq (${DEBUG},1) ifeq (${DEBUG},1)
CFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40 CFLAGS += -g -O0 -DDEBUG -DLOG_LEVEL=40
...@@ -47,6 +55,9 @@ else ...@@ -47,6 +55,9 @@ else
Q := Q :=
endif endif
$(eval $(call add_define,USE_TBBR_DEFS))
CFLAGS += ${DEFINES}
# Make soft links and include from local directory otherwise wrong headers # Make soft links and include from local directory otherwise wrong headers
# could get pulled in from firmware tree. # could get pulled in from firmware tree.
INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
...@@ -62,7 +73,7 @@ all: clean ${BINARY} ...@@ -62,7 +73,7 @@ all: clean ${BINARY}
${BINARY}: ${OBJECTS} Makefile ${BINARY}: ${OBJECTS} Makefile
@echo " LD $@" @echo " LD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ @echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
const char platform_msg[] = "${PLAT}";' | \ const char platform_msg[] = "${PLAT_MSG}";' | \
${CC} -c ${CFLAGS} -xc - -o src/build_msg.o ${CC} -c ${CFLAGS} -xc - -o src/build_msg.o
${Q}${CC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ ${Q}${CC} src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -14,11 +14,16 @@ ...@@ -14,11 +14,16 @@
#include <openssl/sha.h> #include <openssl/sha.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h>
#endif
#include "cert.h" #include "cert.h"
#include "cmd_opt.h" #include "cmd_opt.h"
#include "debug.h" #include "debug.h"
#include "key.h" #include "key.h"
#include "platform_oid.h"
#include "sha.h" #include "sha.h"
#define SERIAL_RAND_BITS 64 #define SERIAL_RAND_BITS 64
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -13,11 +13,16 @@ ...@@ -13,11 +13,16 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h>
#endif
#include "cert.h" #include "cert.h"
#include "cmd_opt.h" #include "cmd_opt.h"
#include "debug.h" #include "debug.h"
#include "key.h" #include "key.h"
#include "platform_oid.h"
#include "sha.h" #include "sha.h"
#define MAX_FILENAME_LEN 1024 #define MAX_FILENAME_LEN 1024
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -18,12 +18,17 @@ ...@@ -18,12 +18,17 @@
#include <openssl/sha.h> #include <openssl/sha.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h>
#endif
#include "cert.h" #include "cert.h"
#include "cmd_opt.h" #include "cmd_opt.h"
#include "debug.h" #include "debug.h"
#include "ext.h" #include "ext.h"
#include "key.h" #include "key.h"
#include "platform_oid.h"
#include "sha.h" #include "sha.h"
#include "tbbr/tbb_ext.h" #include "tbbr/tbb_ext.h"
#include "tbbr/tbb_cert.h" #include "tbbr/tbb_cert.h"
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -8,8 +8,14 @@ ...@@ -8,8 +8,14 @@
#include <string.h> #include <string.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#if USE_TBBR_DEFS
#include <tbbr_oid.h>
#else
#include <platform_oid.h>
#endif
#include "ext.h" #include "ext.h"
#include "platform_oid.h"
#include "tbbr/tbb_ext.h" #include "tbbr/tbb_ext.h"
#include "tbbr/tbb_key.h" #include "tbbr/tbb_key.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment