32095 Commits

Author SHA1 Message Date
Valerio Setti
a7ce589fbc mbedtls_config: move MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE to the correct place
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
a47b045a68 test: add new component to test core library without calloc/free
This commit also fixes issues found in test suites
function/data files.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
dbb646b99a test: add new component to test MBEDTLS_PSA_STATIC_KEY_SLOTS
This commit also fixes related errors in test suites. In all
cases those failures are related to the use of raw keys whose
size cannot be determined a-priori.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
678e0fb3e5 psa: allow to use static key buffers instead of dynamic ones
This helps reducing heap memory usage and, if heap memory is
not used anywhere else in an embedded device, it also reduces
code footprint since there is no need for heap management code
in this case.

A new build symbol is added for this purpose, named
MBEDTLS_PSA_STATIC_KEY_SLOTS. It's disabled by default so that
normal usage of Mbed TLS library is not affected.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Harry Ramsey
08007ed23d Update guards for crypto only builds
This commit updates the guards for crypto only builds to prevent error.c
being built.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-22 16:35:31 +01:00
Manuel Pégourié-Gonnard
6b644938d2
Merge pull request #9657 from mpg/refactor-all.sh-dev
Refactor all.sh
2024-10-22 13:33:45 +00:00
Ronald Cron
7917074649
Merge pull request #9292 from gabor-mezei-arm/9140_depends-py_use_psa
Support the crypto_config.h usage in depends.py
2024-10-22 11:44:44 +00:00
David Horstmann
a40e95fda0 Add newline to ChangeLog entry
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-22 12:22:47 +01:00
Harry Ramsey
ddc59dca21 Refactor error_common ifdef header
This commit refactors MBEDTLS_ERRORCOMMON_H to MBEDTLS_ERROR_COMMON_H.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-22 10:43:23 +01:00
Harry Ramsey
fa3663d633 Fix include for tf-psa-crypto tests
This commit replaces #includes "error.h" with #include "error_common.h"
since error.h no longer exists in tf-psa-crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-22 10:43:23 +01:00
Harry Ramsey
331f08430c Move error.o to OBJS_X509
This commit moves error.o to a build object for OBJS_X509.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-22 10:42:33 +01:00
Gabor Mezei
6a986d9122
Update coverage datebase
With the `depend.py` using the crypto config the `PBKDF2_HMAC` can be
enabled so thest cases can be run.

The equivalence (synonym) between `PSA_WANT_ALG_RSA_PSS_ANY_SALT` and
`PSA_WANT_ALG_RSA_PSS` is now done properly, the test can be run.

Dependencies for `MBEDTLS_CIPHER_PADDING_PKCS7' has been updated and
now it can be actually disabled.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-22 10:43:03 +02:00
makejian
9606d560a7 net/mbedtls_net_connect: Preventing double close problem
In the test examples and real usage scenarios, 'mbedtls_net_free' is called after 'mbedtls_net_connect' fails, which will cause the problem of double close the same fd. It is possible to close this closed fd which has been applied by other link.

Signed-off-by: makejian <makejian@xiaomi.com>
2024-10-22 14:06:41 +08:00
Harry Ramsey
c0240b314f Fix formatting issue
This commit fixes a formatting issue where whitespace was added at the
end of lines.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-21 18:38:15 +01:00
Harry Ramsey
8b3f513c0a Fix linking error for mbedtls_test_hook_error_add
This commit fixes a linking error with psa_sim_crypto_server.c where
mbedtls_test_hook_error_add was undefined.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-21 14:49:57 +01:00
Gabor Mezei
b8a20676a3
Update framework
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:28:11 +02:00
Gabor Mezei
4fef797450
Update macro dependencies
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:27:23 +02:00
Gabor Mezei
f10402c028
Update macro dependencies
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:27:22 +02:00
Gabor Mezei
c9f01cf8b5
Use f-string instead of concatenation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:27:22 +02:00
Gabor Mezei
224152eec0
Remove unneeded newlines
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:27:22 +02:00
Gabor Mezei
fb06101b9f
Fix recursive dependencies for cross referencing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:27:22 +02:00
Gabor Mezei
4e10d6c21d
Add consistency check for option avalability
The PSA and MbedTLS options can switch the same functionality separately
so add a check to ensure the cpnsistency.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
8f94485166
Fix dependency
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
610e6e2aea
Add PSA macro dependencies
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
8ec990bc45
Apply config dependecies recursively
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
9ce6d244f1
Remove depends.py option to use without PSA
Also removed test which uses this option.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
035d7c8cfa
Move file backup support to config_common.py
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Gabor Mezei
f5408f0909
Enable usage of crypto config in depends.py
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-10-21 14:26:52 +02:00
Harry Ramsey
b791a88c33 Fix test case dependency
This commit fixes the error test suite to depend on MBEDTLS_ERROR_C
rather than MBEDTLS_ERRORCOMMON_C.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-21 12:07:27 +01:00
Harry Ramsey
bef54c5003 Remove unnecessary if defined
This commit removes unnecessary if defined for multiple files as they
are already guarded.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-21 12:00:24 +01:00
Gilles Peskine
6707584614
Merge pull request #9593 from gilles-peskine-arm/test-cases-not-executed-enforce-development
Test cases not executed: switch to enforcement mode
2024-10-18 18:19:34 +00:00
Harry Ramsey
924dca9d39 Move mbedtls_test_hook_error_add from error.c to helpers.c
This commit moves mbedtls_test_hook_error_add from error.c to helpers.c.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 15:16:05 +01:00
Harry Ramsey
c44f67b581 Fix error.c generation issue with headers
This commit fixes include issues with error.c. Since error_common.h now
defines error codes, this is a mandatory include. The macro
MBEDTLS_ERROR_C guards functions for strerror which is now found in
error.h.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 11:17:50 +01:00
Harry Ramsey
9c66405098 Disable strerror in test programs
This commit disables printing strerror messages in test programs. This
is due to moving the functions back to Mbed TLS and wanting to keep
dependencies of programs small. The code has not been removed but simply
commented out for when these functions are reimplemented.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 11:17:50 +01:00
Ronald Cron
d916cc9755 tf-psa-crypto: cmake: Add lcov target
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 11:45:37 +02:00
Ronald Cron
4802aaab56 Adapt lcov.sh to multiple source directories
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 11:45:37 +02:00
Ronald Cron
4cd797e7fb tf-psa-crypto: Add cmake_package test program
We cannot add the equivalent of
cmake_package_install yet as the build in
tf-psa-crypto still references some headers
in ./include/mbedtls like mbedtls_config.h.

We cannot add the equivalent of
cmake_subproject yet as currently only
the case of the Mbed TLS parent project is
supported.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 11:42:17 +02:00
Ronald Cron
4870e613f8 Refactor pkgconfig.sh
Refactor pkgconfig.sh to be able to use it
for Mbed TLS and TF-PSA-Crypto packages.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:23:15 +02:00
Ronald Cron
f85882de57 tf-psa-crypto: cmake: Add package config and install support
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-18 10:23:15 +02:00
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
Manuel Pégourié-Gonnard
fd4f2831d7 Fix a typo in a comment
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-18 09:58:11 +02:00
Harry Ramsey
8b4b15269a Fix test scripts for split error files
This commit fixes failing tests to do with generated files and code
styles.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 08:19:50 +01:00
Harry Ramsey
3901af52b8 Add x509 library to utility programs
This commit adds Mbed TLS x509 as a library dependency for utility
programs. This is necessary for strerror.c to work correctly.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 08:19:50 +01:00
Harry Ramsey
bd77a35b95 Move tests for error.c from tf-psa-crypto to Mbed TLS
This commit moves the test functions and test data from tf-psa-crypto to
Mbed TLS.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 08:19:50 +01:00
Harry Ramsey
a05bfeed1e Refactor tf-psa-crypto to use error_common.h instead of error.h
This commit refactors tf-psa-crypto to include error_common.h instead of
error.h as these files have been split and the relevant error codes are
now inside error_common.h.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 08:19:50 +01:00
Harry Ramsey
798d8b6533 Update build scripts for error.c generation
This commit updates the build scripts for error.c generation to be
generated in the Mbed TLS library directory.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-18 08:19:50 +01:00