Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to 3.6.1 #60

Merged
merged 605 commits into from
Sep 4, 2024
Merged

Conversation

tomi-font
Copy link
Collaborator

Just re-applied the TF-M patches and added a small MCUboot fix from #58.

gilles-peskine-arm and others added 30 commits July 31, 2024 00:12
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
In particular, fix an off-by-one error right after I explain how the number
is off by one from what you'd expect. State explicitly that the number can
be negative.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…rflow-3.6

Backport 3.6: Fix stack buffer overflow in ECDSA signature format conversions
Explain that the hybrid key store is the historical implementation and
neither alternative is a drop-in replacement. Discuss how we could
potentially reduce the number of variants after the next major release.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
…ument-3.6

Backport 3.6: Document that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE does not force HMAC
This file is used for detecting which project a script is being
run from.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
[Backport 3.6] Adapt config.py to configuration file split
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
…op_info-3.6

[Backport 3.6] tests/ssl_helpers: Check that message queue is popped
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
…doc-3.6

Backport 3.6: Document the key store design
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
BenBaratte and others added 4 commits September 2, 2024 11:57
Signed-off-by: Benjamin Baratte <benjamin.baratte@st.com>

applied using:
git am modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0003-Allow-SE-key-to-use-key-vendor-id-within-PSA-crypto.patch

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This patch amends the order of initialisations performed in
psa_crypto_init() to make sure that the driver wrappers based
on the PSA driver API are initialised just after the key slots
in memory, both of them at the beginning of the initialisation
sequence.

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>

applied using:
git am modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0004-Initialise-driver-wrappers-as-first-step-in-psa_cryp.patch

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Manually hardcode PSA driver entry points for the CC3XX driver
into psa crypto driver wrappers file (and provide missing entry point
definitions if any). This is a temporary solution until the codegen
framework is available for automatic integration.

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>

applied using:
git am modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0005-Hardcode-CC3XX-entry-points.patch

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
CC312 driver want to use hash in md for entropy operations.
Enable psa_can_do_hash by directly returning 1.
This is a workaround for current cc312 driver. After switching
to new driver, this workaround is not needed.

Signed-off-by: Summer Qin <summer.qin@arm.com>

applied using:
git am modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0006-Enable-psa_can_do_hash.patch

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
tomi-font and others added 4 commits September 2, 2024 15:02
This reverts commit f9bbe0d.

See the following revert commit for an explanation.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
This reverts commit 469f781.

Remove the dependency on the framework directory.

It was introduced in MbedTLS 3.6.0 and for now
doesn't do much more than make CMake fail if
`git submodule update --init` is not run.

This needs to be revisited once bigger changes
are made (with Mbed TLS 4.0) and the whole
repository structure changes.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Gate relevant files for the thin PSA crypto core on MCUBOOT_USE_PSA_CRYPTO
during BL2 build instead of MBEDTLS_PSA_CRYPTO_C which is not defined in
such case. A full solution might require a change in config strategy of
Mbed TLS with the definition

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>

applied using:
git am modules/tee/tf-m/trusted-firmware-m/lib/ext/mbedcrypto/\
0007-Enable-sources-when-MCUBOOT_USE_PSA_CRYPTO-and-not-M.patch

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
MCUboot has its own version of the PSA Crypto core, named
"thin_psa_crypto_core.c" which is included in MCUboot's
build process when the MCUBOOT_USE_PSA_CRYPTO build symbol is
set. MCUBOOT_USE_PSA_CRYPTO mimics what MBEDTLS_PSA_CRYPTO_C
does for the official Mbed TLS, so we need to replicate
this symbol in "config_psa.h" in order to get the proper
PSA builtin support.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
@ithinuel
Copy link
Collaborator

ithinuel commented Sep 2, 2024

Do the commits like Enable psa_can_do_hash really need to be reverted and reapplied immediately ?

@tomi-font
Copy link
Collaborator Author

tomi-font commented Sep 3, 2024

Do the commits like Enable psa_can_do_hash really need to be reverted and reapplied immediately ?

Yeah, or rather this is the procedure we use. First revert the previously applied patches to be completely aligned with upstream, merge the new version to pull in, then re-apply whatever needed patches. No trying to pull in upstream commits on top of patches. Otherwise, there would be risks of (unending) merge conflicts, plus we getthe benefit that the applied patches don't get lost in the history.
Somehow Git shows the revert commits after the Mbed TLS ones (maybe because of the order they were written at, i.e. Mbed TLS ones existed already before the revert ones?), but the reverts are really done as the first thing.

Copy link
Collaborator

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked that:

  • up to bd3a26f the only difference with official Mbed TLS v3.6.1 tag is in in the framework folder. This is a submodule now and it's only used for Mbed TLS testing (which is something we don't do in Zephyr), so it's OK to skip it. Patches 5b86c71 and 95583ee are for this indeed.
  • all other TF-M/Zephyr patches are reverted before and re-applied after the merge of the v3.6.1 branch of Mbed TLS.

In short IMO this is a correct update to the new 3.6.1 LTS release.

@carlescufi
Copy link
Member

Somehow Git shows the revert commits after the Mbed TLS ones (maybe because of the order they were written at, i.e. Mbed TLS ones existed already before the revert ones?), but the reverts are really done as the first thing.

Git always shows the commits in order they have been created, so I guess that you are probably talking about commits that come from a merge operation. Those may be displayed differently.

@Vge0rge Vge0rge self-requested a review September 3, 2024 09:58
Copy link
Collaborator

@Vge0rge Vge0rge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small nit, but overall looks good

@carlescufi carlescufi merged commit fb36f3f into zephyrproject-rtos:zephyr Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.