292 Commits

Author SHA1 Message Date
Ronald Cron
2d453c9b07 cmake: Remove custom LIB_INSTALL_DIR variable to set install dir
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:23:15 +02:00
Ronald Cron
b58c2254d6 tf-psa-crypto: cmake: Add build of documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:23:09 +02:00
Ronald Cron
f584e97aed cmake: Use MBEDTLS/TF_PSA_CRYTPO_AS_SUBPROJECT
Use MBEDTLS/TF_PSA_CRYTPO_AS_SUBPROJECT
instead of using the test employed to set
MBEDTLS/TF_PSA_CRYTPO_AS_SUBPROJECT value.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:16:35 +02:00
Ronald Cron
7b2fae2be9 cmake: Remove partial support for partial use CMake build system
Let the projects using some CMakeLists.txt files
without the top CMakeLists.txt define the variables
that the top CMakeLists.txt set for all.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:16:35 +02:00
Ronald Cron
493595665e tf-psa-crypto: cmake: Fix p-256 installation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:16:35 +02:00
Gilles Peskine
e1f37c58a2
Merge pull request #9566 from gilles-peskine-arm/error-codes-4.0-enforce-add-macro
Error codes: enforce add macro
2024-10-16 17:28:04 +00:00
Gilles Peskine
4e4647a4e7
Merge pull request #9690 from valeriosetti/fix-pk-write-buffer-overrun
pkwrite: fix buffer overrun
2024-10-16 12:00:52 +00:00
Gilles Peskine
5255a9e805 Include "error.h" for MBEDTLS_ERROR_ADD
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 11:52:47 +02:00
Gilles Peskine
ed6feae513 Use MBEDTLS_ERROR_ADD instead of explicit addition: simple cases
Replace obvious additions of an `MBEDTLS_ERR_xxx` constant by a call to
`MBEDTLS_ERROR_ADD`.

Skip `case` statements since `MBEDTLS_ERROR_ADD(pp_constant)` is not a
preprocessor constant.

This commit does not replace additions split over lines. Those will be
handled in a subsequent commit.

```
git ls-files '*.h' '*.c' '*.function' '*.data' |
xargs perl -i -pe '
    next if /\bcase\b/;
    s/\b(MBEDTLS_ERR_\w+)\s*\+\s*(\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g;
    s/\b(\w+)\s*\+\s*(MBEDTLS_ERR_\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 11:52:24 +02:00
Gilles Peskine
50d7579dd1 Temporarily comment out tests that are clogging the CI
The pk_write_pubkey_check sometimes take ~3 hours to run with
GCC+Asan on the CI in the full config. Comment out the slowest
ones while we investigate and release 3.6.2.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 10:48:56 +02:00
Ronald Cron
6197cdf869 Fix comment
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-16 10:45:38 +02:00
Ronald Cron
360928af9d Pacify check_names.py
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
a0afbfb2a4 Fix/Add documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
67cc6a73aa Use config_adjust_test_accelerators.h
Use config_adjust_test_accelerators.h
to adjust the configuration needed for
test_psa_crypto_drivers all.sh component
with PSA_CRYPTO_CONFIG enabled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
1520875247 config_adjust_test_accelerators.h: Error out if wrong usage
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
e8a9258ff0 config_adjust_test_accelerators.h: Do not define PSA_CRYPTO_DRIVER_TEST
PSA_CRYPTO_DRIVER_TEST needs to be defined
upper in build_info.h sequence of definitions/
inclusions.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
2b36f5f5ab config_adjust_test_accelerators.h: Do not error if PSA_CRYPTO_CONFIG is ON
That's the purpose of the changes, to have
PSA_CRYPTO_CONFIG enabled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
db11561352 Introduce config_adjust_test_accelerators.h
As we move to PSA_CRYPTO_CONFIG always on,
the way to configure the build with both
the builtin drivers and the transparent test
drivers (that are wrappers around the
builtin drivers) cannot be done through the
MBEDTLS_USER_CONFIG_FILE mechanism anymore.

With this mechanism and PSA_CRYPTO_CONFIG
enabled, the PSA_ACCEL_ macros are defined
before including config_adjust_legacy_from_psa.h
and the builtin implementations are removed.

Thus, we will rather define the PSA_ACCEL_
just after the inclusion of
config_adjust_legacy_from_psa.h through the
dedicated config_adjust_test_accelerators.h
header introduced by this commit.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Valerio Setti
63348bed30 test_suite_pkwrite: extend coverage of wrong output buffer sizes in pk_write_check_common()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-14 09:44:06 +02:00
Valerio Setti
91577020a2 pkwrite: fix buffer overrun
This commit fixes potential buffer overrun in:
- pk_write_rsa_der
- pk_write_ec_pubkey

In both functions, when dealing with opaque keys, there was no
check that the provided buffer was large enough to contain the
key being exported. This commit fixes this problem and it also
adds some testing in test_suite_pkwrite to trigger these checks.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-11 14:55:24 +02:00
Harry Ramsey
d45763456e Remove version.c from .gitignore
This commit removes version.c from .gitignore as version 4.0 will not
include version generation.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-04 13:37:42 +01:00
Harry Ramsey
f7e7acc9c1 Move version tests from tf-psa-crypto/test/suite to test/suites
This commit reverts the moves the test for version from
tf-psa-crypto/test/suite to test/suites.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-04 13:37:42 +01:00
Harry Ramsey
468c0aede9 Revert move of version.h to tf-psa-crypto libray
This commit moves version.h back into /include/mbedtls from
tf-psa-crypto/drivers/builtin/include. This commit also changes the
necessary build files and scripts to generate version_features.c

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-04 13:37:42 +01:00
Ronald Cron
d2ca9a1b7e Add support to build only the tf-psa-crypto tree
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
e9e7b763ef TF-PSA-Crypto.cmake: Fix paths to tests scripts and C modules
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
9c8472624d TF-PSA-Crypto.cmake: TF-PSA-Cryto-ify the file
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
31829a8abf TF-PSA-Crypto.cmake: Fix submodules
Remove framework and pkgconfig for the time
being.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
97d05e5e53 TF-PSA-Crypto.cmake: Remove TLS and x509 specifics
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
4c3fa0aa99 TF-PSA-Crypto.cmake: Do not support package config/install/apidoc/lcov
Do not support package config, install, apidoc
and lcov for the time being.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
701faac8de Introduce TF-PSA-Crypto.cmake
Copy of mbedtls top CMakeLists.txt file.
The TF-PSA-Crypto top CMakeList.txt file
will be derived from that file to outline
what is common and what is different
between the two.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
8d887d18f1 cmake: tf-psa-crypto: Replace some Mbed TLS options/variables by TF-PSA-Crypto ones
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
b6254f5b97 cmake: Add MBEDTLS_FRAMEWORK_DIR
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
4c670fa98e cmake: Add TF_PSA_CRYPTO_DIR
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
d3f717d536 CMake: Move build of crypto test suites to tf-psa-crypto
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
69c489c25a Move PSA drivers to drivers/builtin/src
They were mistakenly moved to the
core directory from the library
directory.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
e82ad15f5e CMake: Move build of the crypto library to tf-psa-crypto
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
ac01d6eb7c CMake: Move build of legacy crypto modules to tf-psa-crypto
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
ac8dcb8966 Remove dependency on mbedtls_test_helpers
Remove dependency on mbedtls_test_helpers
to build the crypto test suites.
mbedtls_test_helpers is TLS specific.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
7d5419b6f1 Move test_suite_constant_time_hmac back to mbedtls
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-01 15:32:01 +02:00
Ronald Cron
96c6f5eb36
Merge pull request #9492 from eleuzi01/remove-legacy-symbol-definitions
Remove definitions of legacy symbols
2024-10-01 10:33:06 +00:00
Elena Uziunaite
404311a702 Remove MBEDTLS_ECP_HAVE_SECP256R1 leftovers
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-26 14:48:59 +01:00
David Horstmann
b268d270ed
Merge pull request #9413 from sezrab/split_numeric_string_conversions_oid-development
Split numeric string conversions out of the OID module
2024-09-26 12:50:37 +00:00
David Horstmann
bae154d76c
Merge pull request #9385 from eleuzi01/replace-ecdsa-some
Replace MBEDTLS_PK_HAVE_ECDSA* with PSA_WANT counterparts
2024-09-19 13:53:18 +00:00
Sam Berry
3da783b468 Move static OID functions to x509.c
This commit moves static functions that are necessary for
mbedtls_oid_get_numeric_string and mbedtls_oid_from_numeric_string from
oid.c to x509.c

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:17 +01:00
Sam Berry
2bb3f4d6d4 Move mbedtls_oid_from_numeric_string unit tests to test_suite_x509write
This commit moves all related mbedtls_oid_from_numeric_string unit tests
from test_suite_oid to test_suite_x509write.

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:17 +01:00
Sam Berry
c71abc3fd3 Move mbedtls_oid_from_numeric_string to x509_create.c
This commit moves the mbedtls_oid_from_numeric_string function
definition from oid.c to x509_create.c

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:17 +01:00
Sam Berry
4aee6a25ca Move mbedtls_oid_get_numeric_string unit tests to test_suite_x509parse
This commit moves all related mbedtls_oid_get_numeric_string unit tests
from test_suite_oid to test_suite_x509parse.

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:17 +01:00
Sam Berry
4f76194eaf Move function mbedtls_oid_get_numeric_string to x509.c
This commit moves the mbedtls_oid_get_numeric_string function definition
from oid.c to x509.c.

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:17 +01:00
Sam Berry
f8db5b6f72 Move the function declarations to x509.h
This commit moves the function declarations for
mbedtls_oid_get_numeric_string and mbedtls_oid_from_numeric_string from
oid.h to x509.h.

Signed-off-by: Sam Berry <sam.berry@arm.com>
2024-09-18 21:23:09 +01:00
Tom Cosgrove
b80516816d
Merge pull request #9536 from mpg/rsapub-perf-dev
[dev] Rsapub performance fix
2024-09-18 14:20:50 +00:00