Skip to content

Commit c6852b6

Browse files
hakonfammbolivar-nordic
authored andcommitted
[nrf fromlist] modules: tf-m: split configuration into multiple ...
... Kconfig files The TF-M project is higly configurable and we end up having a growing number of Kconfig option definitions in the main Kconfig file. This commit splits out the configuration options for the TF-M partition and for the crypto partition configuration into separate Kconfig files, for ease of reading. The commit does not introduce behavioral changes. Upstream PR: zephyrproject-rtos/zephyr#36027 Signed-off-by: Håkon Øye Amundsen <[email protected]> (cherry picked from commit 52c88d4)
1 parent 8c6ba95 commit c6852b6

File tree

4 files changed

+399
-385
lines changed

4 files changed

+399
-385
lines changed

modules/trusted-firmware-m/Kconfig

Lines changed: 4 additions & 385 deletions
Original file line numberDiff line numberDiff line change
@@ -1,390 +1,9 @@
11
# Configuration for the TF-M Module
22

33
# Copyright (c) 2019, 2020 Linaro Limited
4-
# Copyright (c) 2020 Nordic Semiconductor ASA
4+
# Copyright (c) 2020, 2021 Nordic Semiconductor ASA
55
# SPDX-License-Identifier: Apache-2.0
66

7-
config ZEPHYR_TRUSTED_FIRMWARE_M_MODULE
8-
bool
9-
10-
config TFM_BOARD
11-
string
12-
default "nordic_nrf/nrf9160dk_nrf9160" if BOARD_NRF9160DK_NRF9160NS
13-
default "nordic_nrf/nrf5340dk_nrf5340_cpuapp" if BOARD_NRF5340DK_NRF5340_CPUAPPNS
14-
default "nxp/lpcxpresso55s69" if BOARD_LPCXPRESSO55S69_CPU0
15-
default "mps2/an521" if BOARD_MPS2_AN521
16-
default "stm/nucleo_l552ze_q" if BOARD_NUCLEO_L552ZE_Q
17-
default "stm/stm32l562e_dk" if BOARD_STM32L562E_DK
18-
default "musca_b1/sse_200" if BOARD_MUSCA_B1
19-
default "musca_s1" if BOARD_MUSCA_S1
20-
default "lairdconnectivity/bl5340_dvk_cpuapp" if BOARD_BL5340_DVK_CPUAPPNS
21-
help
22-
The board name used for building TFM. Building with TFM requires that
23-
TFM has been ported to the given board/SoC.
24-
25-
menuconfig BUILD_WITH_TFM
26-
bool "Build with TF-M as the Secure Execution Environment"
27-
select CMSIS_RTOS_V2
28-
imply POLL
29-
imply THREAD_NAME
30-
imply THREAD_STACK_INFO
31-
imply INIT_STACKS
32-
imply THREAD_MONITOR
33-
depends on TRUSTED_EXECUTION_NONSECURE
34-
depends on TFM_BOARD != ""
35-
depends on ARM_TRUSTZONE_M
36-
select BUILD_OUTPUT_HEX
37-
imply INIT_ARCH_HW_AT_BOOT
38-
imply ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS
39-
help
40-
When enabled, this option instructs the Zephyr build process to
41-
additionaly generate a TF-M image for the Secure Execution
42-
environment, along with the Zephyr image. The Zephyr image
43-
itself is to be executed in the Non-Secure Processing Environment.
44-
The required dependency on TRUSTED_EXECUTION_NONSECURE
45-
ensures that the Zephyr image is built as a Non-Secure image. Both
46-
TF-M and Zephyr images, as well as the veneer object file that links
47-
them, are generated during the normal Zephyr build process.
48-
49-
Notes:
50-
Building with the "_nonsecure" BOARD variant (e.g.
51-
"mps2_an521_nonsecure") ensures that
52-
CONFIG_TRUSTED_EXECUTION_NONSECURE ie enabled.
53-
54-
By default we allow Zephyr preemptible threads be preempted
55-
while performing a secure function call.
56-
57-
if BUILD_WITH_TFM
58-
59-
config NUM_PREEMPT_PRIORITIES
60-
int
61-
default 56
62-
63-
config TFM_KEY_FILE_S
64-
string "Path to private key used to sign secure firmware images."
65-
depends on BUILD_WITH_TFM
66-
default "${ZEPHYR_BASE}/../modules/tee/tfm/trusted-firmware-m/bl2/ext/mcuboot/root-RSA-3072.pem"
67-
help
68-
The path and filename for the .pem file containing the private key
69-
that should be used by the BL2 bootloader when signing secure
70-
firmware images.
71-
72-
config TFM_KEY_FILE_NS
73-
string "Path to private key used to sign non-secure firmware images."
74-
depends on BUILD_WITH_TFM
75-
default "${ZEPHYR_BASE}/../modules/tee/tfm/trusted-firmware-m/bl2/ext/mcuboot/root-RSA-3072_1.pem"
76-
help
77-
The path and filename for the .pem file containing the private key
78-
that should be used by the BL2 bootloader when signing non-secure
79-
firmware images.
80-
81-
config TFM_PROFILE
82-
string
83-
depends on BUILD_WITH_TFM
84-
default "profile_small" if TFM_PROFILE_TYPE_SMALL
85-
default "profile_medium" if TFM_PROFILE_TYPE_MEDIUM
86-
default "profile_large" if TFM_PROFILE_TYPE_LARGE
87-
help
88-
Build profile used to build tfm_s image. The available values are
89-
profile_large, profile_medium and profile_small. The default profile
90-
does not need to have this configuration set.
91-
92-
choice TFM_PROFILE_TYPE
93-
prompt "TF-M build profile"
94-
depends on BUILD_WITH_TFM
95-
default TFM_PROFILE_TYPE_NOT_SET
96-
help
97-
The TF-M build profile selection. Can be empty (not set),
98-
small, medium or large. Certain profile types enable other
99-
TF-M configuration options, namely, the IPC model and the
100-
isolation level.
101-
102-
config TFM_PROFILE_TYPE_NOT_SET
103-
bool "TF-M build profile is not set"
104-
105-
config TFM_PROFILE_TYPE_SMALL
106-
bool "TF-M build profile: small"
107-
108-
config TFM_PROFILE_TYPE_MEDIUM
109-
bool "TF-M build profile: medium"
110-
111-
config TFM_PROFILE_TYPE_LARGE
112-
bool "TF-M build profile: large"
113-
114-
endchoice
115-
116-
choice TFM_CMAKE_BUILD_TYPE
117-
prompt "The build type for TFM"
118-
default TFM_CMAKE_BUILD_TYPE_RELEASE if SPEED_OPTIMIZATIONS && BUILD_OUTPUT_STRIPPED
119-
default TFM_CMAKE_BUILD_TYPE_MINSIZEREL if SIZE_OPTIMIZATIONS
120-
default TFM_CMAKE_BUILD_TYPE_DEBUG if DEBUG_OPTIMIZATIONS
121-
default TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO
122-
123-
config TFM_CMAKE_BUILD_TYPE_RELEASE
124-
bool "Release build"
125-
126-
config TFM_CMAKE_BUILD_TYPE_RELWITHDEBINFO
127-
bool "Release build with Debug info"
128-
129-
config TFM_CMAKE_BUILD_TYPE_MINSIZEREL
130-
bool "Release build, optimized for size"
131-
132-
config TFM_CMAKE_BUILD_TYPE_DEBUG
133-
bool "Debug build"
134-
135-
endchoice
136-
137-
config TFM_ISOLATION_LEVEL
138-
int "Isolation level setting." if (TFM_PROFILE_TYPE_NOT_SET && TFM_IPC)
139-
range 1 3
140-
depends on BUILD_WITH_TFM
141-
default 1 if TFM_PROFILE_TYPE_SMALL || !TFM_IPC
142-
default 2 if TFM_PROFILE_TYPE_MEDIUM
143-
default 3 if TFM_PROFILE_TYPE_LARGE
144-
help
145-
Manually set the required TFM isolation level. Possible values are
146-
1,2 or 3; the default is set by build configuration. When TF-M
147-
Profile option is supplied, do not allow manual setting of the
148-
isolation level, as it is determined by the profile setting.
149-
As isolation levels 2 and 3 require PSA_API (TFM_IPC) support,
150-
force level 1 when TFM_IPC is not enabled.
151-
152-
config TFM_BL2
153-
bool "Add MCUboot to TFM"
154-
default y
155-
depends on !NORDIC_SECURITY_BACKEND
156-
help
157-
TFM is designed to run with MCUboot in a certain configuration.
158-
This config adds MCUboot to the build - built via TFM's build system.
159-
We currently do not support builds with MCUboot and TF-M if the
160-
Nordic Security backend is used.
161-
162-
config TFM_MCUBOOT_IMAGE_NUMBER
163-
int "Granularity of FW updates of TFM and app"
164-
range 1 2
165-
default 2
166-
help
167-
How many images the bootloader sees when it looks at TFM and the app.
168-
When this is 1, the S and NS are considered as 1 image and must be
169-
updated in one atomic operation. When this is 2, they are split and
170-
can be updated independently if dependency requirements are met.
171-
172-
config TFM_PARTITION_PROTECTED_STORAGE
173-
bool "Enable secure partition 'Protected Storage'"
174-
default y
175-
help
176-
Setting this option will cause '-DTFM_PARTITION_PROTECTED_STORAGE'
177-
to be passed to the TF-M build system. Look at 'config_default.cmake'
178-
in the trusted-firmware-m repository for details regarding this
179-
parameter. Any dependencies between the various TFM_PARTITION_*
180-
options are handled by the build system in the trusted-firmware-m
181-
repository.
182-
183-
config TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
184-
bool "Enable secure partition 'Internal Trusted Storage'"
185-
default y
186-
help
187-
Setting this option will cause '-DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE'
188-
to be passed to the TF-M build system. Look at 'config_default.cmake'
189-
in the trusted-firmware-m repository for details regarding this
190-
parameter. Any dependencies between the various TFM_PARTITION_*
191-
options are handled by the build system in the trusted-firmware-m
192-
repository.
193-
194-
menuconfig TFM_PARTITION_CRYPTO
195-
bool "Enable secure partition 'Crypto'"
196-
default y
197-
help
198-
Setting this option will cause '-DTFM_PARTITION_CRYPTO'
199-
to be passed to the TF-M build system. Look at 'config_default.cmake'
200-
in the trusted-firmware-m repository for details regarding this
201-
parameter. Any dependencies between the various TFM_PARTITION_*
202-
options are handled by the build system in the trusted-firmware-m
203-
repository.
204-
205-
if TFM_PARTITION_CRYPTO
206-
207-
config TFM_CRYPTO_KEY_MODULE_ENABLED
208-
bool "Enable KEY crypto module"
209-
default y
210-
help
211-
Enables the KEY crypto module within the crypto partition.
212-
Unset this option if the functionality provided by 'crypto_key.c'
213-
is not used.
214-
215-
config TFM_CRYPTO_AEAD_MODULE_ENABLED
216-
bool "Enable AEAD crypto module"
217-
default y
218-
help
219-
Enables the AEAD crypto module within the crypto partition.
220-
Unset this option if the functionality provided by 'crypto_aead.c'
221-
is not used.
222-
223-
config TFM_CRYPTO_MAC_MODULE_ENABLED
224-
bool "Enable MAC crypto module"
225-
default y
226-
help
227-
Enables the MAC crypto module within the crypto partition.
228-
Unset this option if the functionality provided by 'crypto_mac.c'
229-
is not used.
230-
231-
config TFM_CRYPTO_HASH_MODULE_ENABLED
232-
bool "Enable HASH crypto module"
233-
default y
234-
help
235-
Enables the HASH crypto module within the crypto partition.
236-
Unset this option if the functionality provided by 'crypto_hash.c'
237-
is not used.
238-
239-
config TFM_CRYPTO_CIPHER_MODULE_ENABLED
240-
bool "Enable CIPHER crypto module"
241-
default y
242-
help
243-
Enables the CIPHER crypto module within the crypto partition.
244-
Unset this option if the functionality provided by 'crypto_cipher.c'
245-
is not used.
246-
247-
config TFM_CRYPTO_GENERATOR_MODULE_ENABLED
248-
bool "Enable GENERATOR crypto module"
249-
default y
250-
help
251-
Enables the GENERATOR crypto module within the crypto partition.
252-
Unset this option if the key generation, generate, raw key and
253-
key derivation features from 'tfm_crypto_secure_api.c' is not used.
254-
255-
config TFM_CRYPTO_ASYMMETRIC_MODULE_ENABLED
256-
bool "Enable ASYMMETRIC crypto module"
257-
default y
258-
help
259-
Enables the ASYMMETRIC crypto module within the crypto partition.
260-
Unset this option if the functionality provided by 'crypto_asymmetric.c'
261-
is not used.
262-
263-
config TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED
264-
bool "Enable KEY DERIVATION crypto module"
265-
default y
266-
help
267-
Enables the KEY_DERIVATION crypto module within the crypto partition.
268-
Unset this option if the functionality provided by 'crypto_key_derivation.c'
269-
is not used.
270-
271-
endif # TFM_PARTITION_CRYPTO
272-
273-
config TFM_PARTITION_INITIAL_ATTESTATION
274-
bool "Enable secure partition 'Initial Attestation'"
275-
default y
276-
help
277-
Setting this option will cause '-DTFM_PARTITION_INITIAL_ATTESTATION'
278-
to be passed to the TF-M build system. Look at 'config_default.cmake'
279-
in the trusted-firmware-m repository for details regarding this
280-
parameter. Any dependencies between the various TFM_PARTITION_*
281-
options are handled by the build system in the trusted-firmware-m
282-
repository.
283-
284-
config TFM_PARTITION_PLATFORM
285-
bool "Enable secure partition 'Platform'"
286-
default y
287-
help
288-
Setting this option will cause '-DTFM_PARTITION_PLATFORM'
289-
to be passed to the TF-M build system. Look at 'config_default.cmake'
290-
in the trusted-firmware-m repository for details regarding this
291-
parameter. Any dependencies between the various TFM_PARTITION_*
292-
options are handled by the build system in the trusted-firmware-m
293-
repository.
294-
295-
config TFM_PARTITION_AUDIT_LOG
296-
bool "Enable secure partition 'Audit Log'" if !TFM_IPC
297-
depends on !TFM_IPC
298-
default y
299-
help
300-
Setting this option will cause '-DTFM_PARTITION_AUDIT_LOG'
301-
to be passed to the TF-M build system. Look at 'config_default.cmake'
302-
in the trusted-firmware-m repository for details regarding this
303-
parameter. Any dependencies between the various TFM_PARTITION_*
304-
options are handled by the build system in the trusted-firmware-m
305-
repository.
306-
Note: the Audit Log service does not implement the IPC model
307-
interface so it may not be enabled together with IPC option.
308-
309-
config TFM_IPC
310-
bool "IPC" if TFM_PROFILE_TYPE_NOT_SET
311-
default y if (TFM_PROFILE_TYPE_MEDIUM || TFM_PROFILE_TYPE_LARGE)
312-
help
313-
When enabled, this option signifies that the TF-M build supports
314-
the PSA API (IPC mode) instead of the secure library mode. When
315-
TF-M Profile option is supplied, do not allow manual setting of
316-
the IPC mode, as it is determined by the profile setting.
317-
318-
config TFM_REGRESSION_S
319-
bool "TF-M Secure Regression tests"
320-
help
321-
When enabled, this option signifies that the TF-M build includes
322-
the Secure domain regression tests.
323-
324-
config TFM_REGRESSION_NS
325-
bool "Use the TF-M Non-Secure Regression test application"
326-
help
327-
When this is enabled, the Zephyr application as a whole will be
328-
replaced with the TF-M Non-Secure Regression test application.
329-
330-
choice TFM_PSA_TEST
331-
prompt "Enable a PSA test suite"
332-
default TFM_PSA_TEST_NONE
333-
334-
config TFM_PSA_TEST_CRYPTO
335-
bool "Crypto tests"
336-
depends on MAIN_STACK_SIZE >= 4096
337-
help
338-
Enable the PSA Crypto test suite.
339-
340-
config TFM_PSA_TEST_PROTECTED_STORAGE
341-
bool "Storage tests"
342-
help
343-
Enable the PSA Protected Storage test suite.
344-
345-
config TFM_PSA_TEST_INTERNAL_TRUSTED_STORAGE
346-
bool "Internal Trusted Storage tests"
347-
help
348-
Enable the PSA Internal Trusted Storage test suite.
349-
350-
config TFM_PSA_TEST_STORAGE
351-
bool "Storage tests"
352-
help
353-
Enable the PSA Storage test suite. This is a combination of the
354-
protected storage and internal trusted storage tests.
355-
356-
config TFM_PSA_TEST_INITIAL_ATTESTATION
357-
bool "Initial attestation tests"
358-
depends on MAIN_STACK_SIZE >= 4096
359-
help
360-
Enable the PSA Initial Attestation test suite.
361-
362-
config TFM_PSA_TEST_NONE
363-
bool "No PSA test suite"
364-
365-
endchoice
366-
367-
if TFM_BL2
368-
369-
config ROM_START_OFFSET
370-
hex "ROM Start Offset accounting for BL2 Header in the NS image"
371-
default 0x400
372-
help
373-
By default BL2 header size in TF-M is 0x400. ROM_START_OFFSET
374-
needs to be updated if TF-M switches to use a different header
375-
size for BL2.
376-
377-
endif # !TFM_BL2
378-
379-
# Option to instruct flashing a merged binary consisting of BL2 (optionally),
380-
# TF-M (Secure), and application (Non-Secure).
381-
config TFM_FLASH_MERGED_BINARY
382-
bool
383-
help
384-
This option instructs west flash to program the
385-
combined (merged) binary consisting of the TF-M
386-
Secure firmware image, optionally, the BL2 image
387-
(if building with TFM_BL2 is enabled), and the
388-
Non-Secure application firmware.
389-
390-
endif # BUILD_WITH_TFM
7+
rsource "Kconfig.tfm"
8+
rsource "Kconfig.tfm.partitions"
9+
rsource "Kconfig.tfm.crypto_modules"

0 commit comments

Comments
 (0)