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 against mbedtls::cffd7135c (PR8328) with TF-PSA-Crypto::e3fa47289 (PR83) #84

Merged
merged 110 commits into from
Oct 12, 2023
Merged

Update against mbedtls::cffd7135c (PR8328) with TF-PSA-Crypto::e3fa47289 (PR83) #84

merged 110 commits into from
Oct 12, 2023

Conversation

ronald-cron-arm
Copy link
Contributor

PR to update the main branch based on mbedtls::cffd7135c (PR8328) and TF-PSA-Crypto::e3fa47289 (PR83).
The result of the build of the main branch based on mbedtls::cffd7135c (PR8328) and TF-PSA-Crypto::e3fa47289 (PR83) can be seen here: https://github.com/ronald-cron-arm/TF-PSA-Crypto/tree/new-main-cffd7135c-PR8328-with-e3fa47289-PR83. The build is as described in docs/architecture/tf-psa-crypto-repository.md plus one additional commit to add the generated files in the tree: ready for cross-compilation that way.

ronald-cron-arm and others added 30 commits July 5, 2023 13:56
Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
…odules

Add remaining crypto modules to PSA repo
Add mbedtls_zeroize_and_free prototype in
core/common.h as it has been added in
library/common.h in mbedtls and the
function is used in PSA core code.

Signed-off-by: Ronald Cron <[email protected]>
Build a list of testsuites to exclude rather than to include.

Signed-off-by: David Horstmann <[email protected]>
For now, naively copy the entire directory, even things that may not be
used in crypto tests

Signed-off-by: David Horstmann <[email protected]>
Reproduce the following fix from Mbed TLS (760f3a0):

Install CMake files in MbedTLS dir

Right now, CMake files are installed in <prefix>/cmake. That being said,
it gets easily bloated, and the standard is to use a directory with the
same name as the project.

I discovered this issue with this "bug":
termux/termux-packages#12416
The issue's author claimed that MbedTLS's files were not installed in
the lib directory. But the patch applied by termux team broke CMake's
search of MbedTLS config files. So I wanted to upstream the real fix
here instead.

Here are some examples of projects using directories:
 - https://github.com/xiph/flac/blob/1.4.2/CMakeLists.txt#L239
 - https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.15.2/CMakeLists.txt#L675
 - https://github.com/catchorg/Catch2/blob/v3.2.0/CMakeLists.txt#L62
 - https://github.com/capnproto/capnproto/blob/v0.10.2/c++/CMakeLists.txt#L162

Signed-off-by: Issam E. Maghni <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Reproduce the following fix from Mbed TLS (0ab6c8a):

Remove obsolete target covtest

This target dates back from before basic-build-test.sh existed. Refer to
that script instead.

Signed-off-by: Gilles Peskine <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Reproduce the following fix from Mbed TLS (3861062):

Tell cmake to get SKIP_TEST_SUITES from ENV

If the variable SKIP_TEST_SUITES is not defined with -D, but is defined
in an environment variable, tell cmake to get it from there.

Signed-off-by: David Horstmann <[email protected]>
Reproduce the following commit from Mbed TLS (1a0feb3):

Set LANGUAGES explicitly in CMakeLists.txt project()

When Mbed TLS is built as a TF-M subproject with a recent
enough version of cmake (i.e. 3.22), GNUInstallDirs complains
about LANGUAGES not being set in project when the short
signature is used. So make sure to use the normal signature,
i.e. set the LANGUAGES option explicitly

Signed-off-by: Antonio de Angelis <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Reproduce Mbed TLS CMake changes from c9187c5 and fdb7223.

These add test generation script dependencies to tests/CMakeLists.txt.

Signed-off-by: David Horstmann <[email protected]>
Copy CMake code from Mbed TLS that generates tests for ECP and Bignum.

Signed-off-by: David Horstmann <[email protected]>
These modules are included in PSA Crypto, so we should test it.

Signed-off-by: David Horstmann <[email protected]>
* Copy pkcs1 tests
* Do not copy debug, error, timing and platform tests

Signed-off-by: David Horstmann <[email protected]>
This allows real reading and writing of the NV seed file in tests where
we have PSA_CRYPTO_FS_IO but not PSA_CRYPTO_STD_FUNCTIONS.

Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Rename CMake package TF-PSA-Crypto instead
of PSACrypto.

Signed-off-by: Ronald Cron <[email protected]>
Rename the crypto compiled library tdpsacrypto
instead of psacrypto.

Signed-off-by: Ronald Cron <[email protected]>
Replace PSA_CRYPTO by TF_PSA_CRYPTO.
This inpacts mostly CMake variable names,
configuration option macros, various macros,
header guards.

Not modified as shared with Mbed TLS code:
MBEDTLS_PSA_CRYPTO_*, MBEDTLS_USE_PSA_CRYPTO,
PSA_CRYPTO_DRIVER_TEST.

Signed-off-by: Ronald Cron <[email protected]>
Replace psa-crypto patterns (grep -i "psa-crypto") by
tf-psa-crypto ones.

Signed-off-by: Ronald Cron <[email protected]>
This mainly changes the name of the
platform abstraction functions.

Excluded as shared with Mbed TLS:
psa_crypto_init, psa_crypto_key_ower_id_t,
psa_crypto_external_random_context_t,
psa_crypto_external_get_random(), psa_crypto*.c,
psa_crypto_buffer_offset*,
psa_crypto_driver_wrappers*

Signed-off-by: Ronald Cron <[email protected]>
grep -E -i -r "psa crypto([^g]|g[^r])"

Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Add check_test_cases.py to TF-PSA-Crypto.
It is needed by analyze_outcomes.py.

Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Signed-off-by: Ronald Cron <[email protected]>
Copy link
Member

@paul-elliott-arm paul-elliott-arm left a comment

Choose a reason for hiding this comment

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

LGTM (once I managed to actually clean my tree....)

Copy link
Contributor

@davidhorstmann-arm davidhorstmann-arm left a comment

Choose a reason for hiding this comment

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

LGTM, reproduced except minor difference in entropy files and the like

@davidhorstmann-arm davidhorstmann-arm added approved Design and code approved - may be waiting for CI or backports priority-very-high Highest priority - prioritise this over other review work labels Oct 12, 2023
@ronald-cron-arm ronald-cron-arm merged commit feb09e2 into Mbed-TLS:main Oct 12, 2023
@yanesca
Copy link
Contributor

yanesca commented Oct 13, 2023

I have cloned and built the project without a problem. Run the unit tests successfully with make test and then after scanning the readme with ctest as well. I've built the test in programs/test/cmake_package successfully and run ./programs/psa/aead_demo chachapoly as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports priority-very-high Highest priority - prioritise this over other review work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants