Commit graph

277 commits

Author SHA1 Message Date
Lauren Wehrmeister
07da4854e9 Merge changes from topics "rcar-tools-fix", "toolchain-cleanup" into integration
* changes:
  build: remove the `NM` variable
  build: prefer `gcc-ar` over `ar`
  build: add `--no-warn-rwx-segments` when linking with GCC
  build: always use the C compiler to assemble
  build: always use the C compiler to preprocess
  fix(rcar): fix implicit rule invocations in tools
2024-01-24 16:11:22 +01:00
Olivier Deprez
9f9b4814c5 Merge "fix(marvell-tools): include mbedtls/version.h before use" into integration 2024-01-23 10:55:11 +01:00
Madhukar Pappireddy
0ec25e386a Merge "fix(spm): silence warning in sp_mk_generator" into integration 2024-01-19 17:33:05 +01:00
Manish V Badarkhe
9653570e28 Merge "feat(memmap): add RELA section display" into integration 2024-01-18 19:19:56 +01:00
Chris Kay
e068a7ca86 fix(rcar): fix implicit rule invocations in tools
The `rzg_layout_create` and `rcar_layout_create` tools have a rule to
build object files from C files, but it depends on object files in the
parent directory when it should depend on object files in the current
directory. Consequently, the rule is not triggering and the implicit C
compilation rule is executed instead. This rule works, so I have
replaced the broken rule with exactly the same command as what the
implicit rule is executing and fixed the dependency.

Change-Id: Ib8d640361adff8c4d660738dda230e5536bec629
Signed-off-by: Chris Kay <chris.kay@arm.com>
2024-01-18 13:58:03 +00:00
Manish V Badarkhe
2c5c394fe7 Merge "refactor(juno): move plat_def_uuid_config to fiptool" into integration 2024-01-18 14:55:11 +01:00
Yann Gautier
a6462e05cf feat(memmap): add RELA section display
When PIE is enabled, it can be handy to display the .rela.dyn section.
Add RELA in the list of symbols parsed, to display this section in
memory map.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ic40da54ce6fb6e281fb1a6627e9b8830993cfb2c
2024-01-18 14:02:18 +01:00
Sekhar Nori
6dc8ee61ff fix(memmap): fix memory map dump when SEPARATE_CODE_AND_RODATA=0
When building BL1 with SEPARATE_CODE_AND_RODATA=0, symbol names
__RO_{START|END}__ are ignored by memory map dump script.

Fix it by including the symbol in regular expression.

While at it, update the copyright year to current.

Change-Id: Iafeab75c5711429ea0b744510caf27dd8784a29a
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2024-01-18 13:02:53 +05:30
J-Alves
6a3225e227 fix(spm): silence warning in sp_mk_generator
Silence warning from sp_mk_generator that 'is not' operator
is not meant for integers. This replaces the referred instance
with '!='.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I0d31ad65466dbeafebbfc929e506c3e290913aca
2024-01-17 09:15:28 +00:00
Manish V Badarkhe
a4fab36d51 Merge "fix(spm): not defining load-address in SP config" into integration 2024-01-15 17:00:01 +01:00
Harrison Mutai
9e72d01ed2 fix(memmap): fix footprint free space calculation
Calculate the free space as the range between the
limit and the end of the memory region *_REGION_END.

Change-Id: I9cacadea2543c9f5ddaebca82344a83678cd7d55
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-01-12 10:27:22 +00:00
J-Alves
04e7f80823 fix(spm): not defining load-address in SP config
The FF-A specification has made it such that SPs
may optionally specify their load address in the manifest.

This info was being retrieved to generate some information
for the SPMC manifest. However, it is not a mandatory utility.

This change relaxes the case in which the SP manifest doesn't
have a load address.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ic4c1b1ec6666522900c113903be45ba0eb5d0bf6
2024-01-11 17:31:59 +00:00
Andrey Skvortsov
503cf99273 refactor(juno): move plat_def_uuid_config to fiptool
The same was done for other platforms: stm32mp1, tc before in
commit 034a2e3ef8 ('refactor(fiptool):
move plat_fiptool.mk to tools')

Additionally this will make ignore generated files:

 Untracked files:
	plat/arm/board/juno/fip/plat_def_uuid_config.d
	plat/arm/board/juno/fip/plat_def_uuid_config.o

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Change-Id: Ia5f1082fcd6d9dfc0be012759493e61ddb869956
2023-12-26 08:51:50 +03:00
Takuya Sakata
4f7e0fa38f fix(rcar3): fix load address range check
Fixed the check of the address range which the program is loaded to.
Use the addresses and sizes in the BL31 and BL32 certificates to check
that they are within the range of the target address and size
defined inside the TF-A.
It also uses the addresses and sizes in the BL33x certificates to check
that they are outside the protected area defined inside the TF-A.

Signed-off-by: Hideyuki Nitta <hideyuki.nitta.jf@hitachi.com>
Signed-off-by: Toshiyuki Ogasahara <toshiyuki.ogasahara.bo@hitachi.com>
Signed-off-by: Yoshifumi Hosoya <yoshifumi.hosoya.wj@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> # Code clean up
Change-Id: Iade15431fc86587489fb0ca9106f6baaf7e926e2
2023-12-13 22:12:15 +01:00
Henrik Nordstrom
8eb4efe70b fix(marvell-tools): include mbedtls/version.h before use
mbedtls/version.h needs to be included before the use of any
mbedtls config variables.

Fixes a build failure regression from commit a8eadc51a.

Change-Id: Idd955d7955b0a55ffd127f31053335542cb15e22
Signed-off-by: Henrik Nordstrom <henrik.nordstrom@addiva.se>
2023-12-06 13:35:06 +01:00
Manish V Badarkhe
9873580997 docs(changelog): changelog for v2.10 release
Added changelog for v2.10 release.

Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
Change-Id: Id06263047fcc1ec60e82f85cd09e2e4bc95830f5
2023-11-22 11:52:02 +00:00
Manish Pandey
256c1c60e0 Revert "docs(changelog): changelog for v2.10 release"
This reverts commit 0abbfab320.

Reason for revert: Changelog was based on rc0 tag but we got few more patches after that which were not captured.

Change-Id: I9829f2b6dc09f0bd5c538845cbae051f6e4c8a75
2023-11-21 14:37:29 +01:00
Juan Pablo Conde
0abbfab320 docs(changelog): changelog for v2.10 release
Change-Id: I44b88c3232d099b85ff71ee14c4918c4f8180146
Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
2023-11-20 09:31:32 -06:00
Sandrine Bailleux
bb3b0c0b09 fix(cert-create): fix key loading logic
When key_load() attempts to load the key from a file and it fails to
open this file, the 'err_code' output argument is set to
'KEY_ERR_OPEN' error code. However, it is incorrectly overwritten
later on with 'KEY_ERR_NONE' or 'KEY_ERR_LOAD'.

The latter case messes up with the key creation scenario. The
'KEY_ERR_LOAD' error leads the tool to exit, when it should attempt to
create the said key file if invoked with the --new-keys/-n option.

Note that, to complicate matters further, which of 'KEY_ERR_OPEN' or
'KEY_ERR_NONE' values is returned by key_load() depends on the version
of OpenSSL in use:

 - If using v3+, KEY_ERROR_LOAD is returned.

 - If using <v3, KEY_ERROR_NONE is returned as a result of the key
   pair container being initialized by key_new().

This patch fixes this bug and also takes the opportunity to refactor
key_load() implementation to (hopefully) make it more straight-forward
and easier to reason about.

Fixes: 616b3ce27d "feat(cert-create): add pkcs11 engine support"
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Reported-by: Wenchen Tan <xtaens@qq.com>
Change-Id: Ia78ff442e04c5ff98e6ced8d26becbd817a8ccb7
2023-10-19 11:34:55 +02:00
laurenw-arm
c512c89cde feat(cert-create): ecdsa p384 key support
Adding ECDSA P384 (secp384r1) key creation support through key_bits
obtained from KEY_SIZE.

Change-Id: I571251caef20222990bd927cdfb5f35bf2a185d0
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2023-10-13 09:59:25 -05:00
Manish V Badarkhe
7c3ff62d22 Merge "feat(fiptool): add ability to build statically" into integration 2023-09-26 17:46:18 +02:00
Olivier Deprez
4d4fec2818 feat(fiptool): add ability to build statically
Provide a STATIC command line build option for platforms willing to
build fiptool statically and remove dependency to toolchain and OpenSSL
libraries.

Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I1d1b6676df50081828170e2b0ab7b71c4ec19d6e
2023-09-25 18:13:10 +02:00
Robin van der Gracht
616b3ce27d feat(cert-create): add pkcs11 engine support
Add pkcs11 engine support which allows using keys that are securely
stored on a HSM or TPM. To use this feature the user has to supply
an RFC 7512 compliant PKCS11 URI to a key instead of a file as an
argument to one of the key options. This change is fully backwards
compatible.

This change makes use of the openssl engine API which is deprecated
since openssl 3.0 and will most likely be removed in version 4. So
pkcs11 support will have to be updated to the openssl provider API
in the near future.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
Change-Id: If96725988ca62c5613ec59123943bf15922f5d1f
2023-09-21 13:27:25 +02:00
Robin van der Gracht
ea6f8452f6 fix(cert-create): key: Avoid having a temporary value for pkey in key_load
key->key and k will point to the same if PEM_read_PrivateKey
(pem_read_bio_key_decoder) succeeds. There is no need for the temporary
'k' pointer here.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
Change-Id: I219c49d331eb6dd7200b49b75d47fd66da3d82dd
2023-09-20 16:54:46 +02:00
Karl Meakin
20629b3153 feat(sptool): generate ARM_BL2_SP_LIST_DTS file from sp_layout.json
TF-A makefile accepts a device-tree snippet to override hardcoded SP
nodes, via the `ARM_BL2_SP_LIST_DTS` variable. However the SPs declared
in `ARM_BL2_SP_LIST_DTS` must be in the same order as they are in the
FIP image, otherwise hash authentication will fail when loaded by BL2.

This patch generates the `ARM_BL2_SP_LIST_DTS` file from the
`sp_layout.json` file. The SPs in the FIP image are also generated from
`sp_layout.json`, so this ensures that there is only one source of truth
for the SP list, removing the possibility to have the lists disagree
with each other.

Signed-off-by: Karl Meakin <karl.meakin@arm.com>
Change-Id: I7d76715135c596605c6a02aad5196d967dfeb1ce
2023-08-11 11:49:47 +01:00
Rajasekaran Kalidoss
352366ede4 refactor(ethos-n): move build flags to ethosn_npu.mk
The build flags to enable the Arm(R) Ethos(TM)-N NPU driver are in arm
platform specific make files i.e. plat/arm/common/arm_common.mk. These
flags are renamed and moved to ethosn_npu.mk. Other source and make
files are changed to reflect the changes in these flags.

Signed-off-by: Rajasekaran Kalidoss <rajasekaran.kalidoss@arm.com>
Change-Id: I6fd20225343c574cb5ac1f0f32ff2fc28ef37ea6
2023-08-07 19:13:45 +02:00
Vincent Stehlé
aa57ce632c build(tools): avoid unnecessary link
In their respective makefiles, cert_create, encrypt_fw and fiptool
depend on the --openssl phony target as a prerequisite. This forces
those tools to be re-linked each time.

Move the dependencies on the --openssl target from the tools to their
makefiles all targets, to avoid unnecessary linking while preserving the
OpenSSL version printing done in the --openssl targets when in debug.

Fixes: cf2dd17ddd ("refactor(security): add OpenSSL 1.x compatibility")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Change-Id: I98a3ab30f36dffc253cecaaf3a57d2712522135d
2023-07-05 13:00:18 +02:00
Joanna Farley
92a44d5587 Merge "build(changelog): pretend scope-less build changes have the build scope" into integration 2023-06-20 15:16:26 +02:00
Michal Simek
f7d445fcbb chore(bl): add UNALIGNED symbols for TEXT/RODATA
Add symbols to mark end of TEXT/RODATA before page alignment.
Similar change was done by commit 8d69a03f6a ("Various
improvements/cleanups on the linker scripts") for
RO_END/COHERENT_RAM. These symbols help to know how much free
space is in the final binary because of page alignment.

Also show all *UNALIGNED__ symbols via poetry.
For example:
poetry run memory -p zynqmp -b debug

Change-Id: I322beba37dad76be9f4e88ca7e5b3eff2df7d96e
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-06-12 12:50:08 +02:00
Harrison Mutai
d0e3053c4f fix(memmap): reintroduce support for GNU map files
The intial patch stack only supported ELF files, which proved
particularly problematic when dealing with incomplete builds (i.e. build
didn't complete due to linker errors). This adds support for GNU map
files. Most analysis performed by the tool should be possible with map
files alone.

Change-Id: I89f775a98efc5aef6671a17d0e6e973df555a6fa
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-06-08 14:06:00 +01:00
Manish Pandey
f6bf4d6bc8 Merge changes from topic "hm/memmap-feat" into integration
* changes:
  feat(memmap): add topological memory view
  feat(memmap): add tabular memory use data
2023-06-07 17:48:14 +02:00
Manish Pandey
d4affdce80 Merge "fix(stm32mp1): add void entry in plat_def_toc_entries" into integration 2023-06-07 17:30:11 +02:00
Manish Pandey
ba56ea6fed Merge "fix(fiptool): move juno plat_fiptool.mk" into integration 2023-06-05 12:42:03 +02:00
Sandrine Bailleux
7f126ccff6 Merge changes from topic "cot_cca_nvctr" into integration
* changes:
  feat(fvp): mock support for CCA NV ctr
  feat(auth): add CCA NV ctr to CCA CoT
  feat(build): pass CCA NV ctr option to cert_create
  feat(cert-create): add new option for CCA NV ctr
2023-06-05 08:13:33 +02:00
Sandrine Bailleux
9b5c0fcdba Merge changes from topic "hm/memmap-feat" into integration
* changes:
  build(bl32): add symbols for memory layout
  build(bl31): add symbols for memory layout
  build(bl2): add symbols for memory layout
  build(bl1): add symbols for memory layout
  refactor: improve readability of symbol table
2023-06-01 14:36:46 +02:00
laurenw-arm
60753a6329 feat(cert-create): add new option for CCA NV ctr
Extends cert_create tool with a new option for CCA NV
counter: ccafw_nvctr.

And changes the non-volatile counter used to protect
the CCA Content Certificate from the Trusted FW NV counter
to the CCA FW NV counter in the CCA CoT description.

Change-Id: I27f3ab2e25809f0dcc56fa05e5c3a25a2e861ef6
Signed-off-by: Lauren Wehrmeister <lauren.wehrmeister@arm.com>
2023-05-25 16:40:43 -05:00
Juan Pablo Conde
b78ad00e58 docs(changelog): changelog for v2.9 release
Change-Id: Ic8cd82c5424af422feedefdc001d291001817a8b
Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
2023-05-19 13:49:08 -05:00
Chris Kay
c84d632d0d build(changelog): pretend scope-less build changes have the build scope
In response to feedback provided during review of the v2.9 changelog,
commits with the `build` type and without a scope are now treated as
though they have the `build` scope as well.

Change-Id: I9628e0faf1fcf31fe88758ad3e75ca8febf1bb36
Signed-off-by: Chris Kay <chris.kay@arm.com>
2023-05-18 15:58:29 +01:00
Rob Hughes
570a23099c fix(fiptool): move juno plat_fiptool.mk
plat_fiptool.mk files now need to be in tools/fiptool/plat_fiptool/, so
this file has been moved to the new location so that it is picked up
correctly by the build system.

Change-Id: Id3596b08bc856362e300f3dfefcaab5d75b4c400
Signed-off-by: Rob Hughes <robert.hughes@arm.com>
2023-05-17 09:19:35 +02:00
Harrison Mutai
cc60aba227 feat(memmap): add topological memory view
Present memory usage in hierarchical view. This view maps modules to
their respective segments and sections.

Change-Id: I5c374b46738edbc83133441ff3f4268f08cb011d
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Harrison Mutai
d9d5eb138d feat(memmap): add tabular memory use data
Add support for tabulating static memory consumption data from ELF
binaries. This relies on static symbols, defined in the linker files,
that provide information about the memory ranges.

Change-Id: Ie19cd2b80a7b591607640feeb84c63266963ea4d
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Harrison Mutai
af5b49e992 refactor: improve readability of symbol table
Make the symbol table produced by the memory mapping script more
readable. Add a generic interface for interacting with ELF binaries.
This interface enables us to get symbols that provide some insights into
TF-A's memory usage.

Change-Id: I6646f817a1d38d6184b837b78039b7465a533c5c
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Yann Gautier
8214ecdab2 fix(stm32mp1): add void entry in plat_def_toc_entries
The fill_image_descs() function in fiptool adds images until
.cmdline_name is NULL.
Add a void entry to STM32MP1 plat_def_toc_entries[] to properly
escape the loop.
Also reported by Valentyn Korniienko (@ValentiWorkLearning) on github
with pull requests [1] and [2].

[1] https://github.com/ARM-software/arm-trusted-firmware/pull/1997
[2] https://github.com/STMicroelectronics/arm-trusted-firmware/pull/8

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I94fd36ca677d46ce6df95c7674c6b6bd365b28c7
2023-05-12 08:56:14 +02:00
Elyes Haouas
1b491eead5 fix(tree): correct some typos
found using codespell (https://github.com/codespell-project/codespell).

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I1bfa797e3460adddeefa916bb68e22beddaf6373
2023-05-09 15:57:12 +01:00
Sandrine Bailleux
c89fdb4a51 Merge "refactor(fiptool): move plat_fiptool.mk to tools" into integration 2023-05-02 10:47:15 +02:00
Mikael Olsson
0165ddd7c0 build(fiptool): add object dependency generation
The object target in the fiptool Makefile only depends on the
corresponding source file so it won't rebuild the object, if a header
file used by the source file is changed.

To make it rebuild the object file for both source and header file
changes, a dependency file will now be generated for each object and
included in the Makefile.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I0468c6e9c54126242150667268d471f28e011b0d
2023-04-04 11:36:07 +02:00
Govindraj Raja
a8eadc51a3 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>
2023-02-21 11:09:47 +00:00
laurenw-arm
76a85cfa0a fix(cert-create): change WARN to VERBOSE
SAVE_KEYS is set to '0' by default, causing cert_create to
show the 'Key filename not specified' message on each run
even though this is perfectly normal. Show the message only
in the VERBOSE log level.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Change-Id: I472cdec2670055ab0edd99d172f79d01ad575972
2023-02-09 11:55:33 -06:00
Raef Coles
034a2e3ef8 refactor(fiptool): move plat_fiptool.mk to tools
Move all plat_fiptool.mks into tools, change the logic to recursively
check for tools/fiptool/plat_fiptool/<plat_path>/plat_fiptool.mk

I.e. for a platform that has the path "plat/arm/board/tc/platform.mk",
the makefile will now load the first existing file from:
 - tools/fiptool/plat_fiptool/arm/board/tc/plat_fiptool.mk
 - tools/fiptool/plat_fiptool/arm/board/plat_fiptool.mk
 - tools/fiptool/plat_fiptool/arm/plat_fiptool.mk

This enables fiptool to support multiple platforms, or a specific one.

Remove file-copying previously being used to handle old default path.
Remove custom file cleaning in plat_fiptool.mk.

Change-Id: I95245bcf7143b329481d4394ab64f29bfe9de5ab
Signed-off-by: Raef Coles <raef.coles@arm.com>
2023-02-06 09:36:39 +00:00
Manish V Badarkhe
5a53c6c667 Merge "feat(fiptool): handle FIP in a disk partition" into integration 2023-01-23 13:57:39 +01:00