Commit Graph

1634 Commits

Author SHA1 Message Date
Gilles Peskine
202b69c2b6
Merge pull request #9302 from valeriosetti/psa-use-static-slots
PSA: use static key slots to store keys
2024-10-24 07:27:48 +00: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
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
David Horstmann
13d2939563
Merge pull request #9673 from eleuzi01/issue-54-fw
Move TLS auxiliary test scripts to the framework
2024-10-17 17:15:46 +00:00
Janos Follath
c1cb3dcc0f
Merge pull request #9597 from Harry-Ramsey/code-style-framework-submodule-support
Improve support for submodules in code_style.py
2024-10-15 14:18:16 +00:00
Elena Uziunaite
b74c3eaf87 Adjust file path for generate_tls13_compat_tests.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:45:05 +01:00
Elena Uziunaite
09fee364a3 Adjust file path for generate_ssl_debug_helpers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:43:51 +01:00
Elena Uziunaite
2df289290f Move some files to framework repository
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:41:39 +01:00
Ronald Cron
cb81d8086f
Merge pull request #9671 from Harry-Ramsey/duplicate-common-header-file-development
Refactor duplicate common header file
2024-10-15 06:05:07 +00:00
Harry Ramsey
b81cd1af64 Update includes for generated files
This commit replaces the include of "common.h" with "ssl_misc.h" for
generated files.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 08:41:23 +01:00
Tom Cosgrove
0b4ccdd7c9
Merge pull request #9674 from gergelykarm/development
Fix driver schema json default type requirements
2024-10-10 13:53:14 +00:00
Gilles Peskine
80352ac58c
Merge pull request #9668 from gilles-peskine-arm/analyze_outcome-split-dev
Split check_test_cases.py and outcome_analysis.py
2024-10-10 13:45:49 +00:00
Gergely Korcsák
a3c2a8f2a2 Fix driver schema json default type requirements
Signed-off-by: Gergely Korcsák <gergely.korcsak@arm.com>
2024-10-10 13:16:32 +02:00
Gilles Peskine
041a84d1dc Downgrade mypy to a version that works with our code base
mypy >=0.960 rejects macro_collector.py.
https://github.com/Mbed-TLS/mbedtls-framework/issues/50

We currently need mypy >=0.940, <0.960. Pick 0.942, which works, and is the
system version on Ubuntu 22.04.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:59 +02:00
Gilles Peskine
1c5a252729 Upgrade mypy to the last version supporting Python 3.6
Upgrade mypy to 0.971, which is the last version that supports Python 3.6
(the oldest Python version that we currently run on the CI).

This fixes the error
```
framework/scripts/mbedtls_framework/outcome_analysis.py:119: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
framework/scripts/mbedtls_framework/outcome_analysis.py:121: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
```
As far as I can tell the fix is https://github.com/python/mypy/pull/9275
which was released in mypy 0.940.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:12:59 +02:00
Harry Ramsey
da8f42a357 Improve support for submodules in code_style.py
This commit improves support for submodules within code_style.py. A new
function get_submodule_hash retrieves the submodule hash at the time of
a commit allowing an appropriate diff to be seen.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-07 10:41:47 +01:00
Harry Ramsey
c19f8aea8a Update config.py crypto for version files
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
Manuel Pégourié-Gonnard
560265154c
Merge pull request #9604 from gilles-peskine-arm/config-full-booleans-only
config.py: don't rely on section names
2024-09-26 10:03:19 +00:00
Gilles Peskine
3943a1a3bf Automatically generate tests/opt-testcases/tls13-compat.sh
`tests/opt-testcases/tls13-compat.sh` is supposed to be automatically
generated by `tests/scripts/generate_tls13_compat_tests.py`. So far, the
output has been updated by running the script manually and committing the
output. Switch to using our framework for generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Paul Elliott
edc27bc080
Merge pull request #9128 from gilles-peskine-arm/make_generated_files-document_CC
make_generated_files.bat: document C compiler requirement
2024-09-24 12:36:14 +00:00
Tom Cosgrove
475ed86c7a
Merge pull request #9600 from gilles-peskine-arm/use_psa_crypto-key_id_encodes_owner-compatible-config-dev
Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
2024-09-24 10:44:56 +00:00
Gilles Peskine
00b9144608 Don't pass the section name to adapters
We have finished removing the reliance of named configuration on section
names.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-23 15:56:26 +02:00
Gilles Peskine
36571d6d8a Change "realfull" to activate everything
Change "realfull" to activate everything. After investigation, it seems that
having "realfull" not activate everything was a historical oddity due to
proximity with "full", not a goal in itself.

https://github.com/Mbed-TLS/mbedtls/issues/520#issuecomment-727190862
https://github.com/Mbed-TLS/mbedtls/pull/965/files#r523409092

This changes the output of `scripts/config.py realfull`: now all non-boolean
options are uncommented.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-23 15:44:46 +02:00
Gilles Peskine
e4c6955e43 Change "full" to affect boolean settings rather than use sections
To get rid on the reliance on sections, change "full" and friends to enable
settings based on whether the setting is boolean, rather than based on the
section it contains.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-23 15:44:46 +02:00
Gilles Peskine
702d75a2f9 Pass the setting's value to adapters
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-23 15:44:33 +02:00
Gilles Peskine
a22b95a91c Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER has been compatible with
MBEDTLS_USE_PSA_CRYPTO since https://github.com/Mbed-TLS/mbedtls/pull/5380.
We still don't want to enable it in the full config because it's a behavior
change, even an interface change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 13:43:57 +02:00
Gabor Mezei
cd326bfc49
Apply the parameter change
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:15 +02:00
Gabor Mezei
317a2a3fed
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
568808a41a
Update member variable names
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
f5f130879c
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
0e9e4cbbd8
Move commonly used part to config_common
Move the Setting, Config, ConfigFile and ConfigTool classes to config_common.
Also update the referencies to the moved classes.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
a12ed6bcb7
Unify spacing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
24d7cc71af
Create a class for command line config manipulation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
776ee9068d
Fix header file detection
Make the include directory check relative to the source file in case not called
from the project root.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
d53080da2a
Make the Config a proper base class
Due to the forward declaration issues, move the common descendant functions
and configfile handling to the `Config` base class.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
daf807f02d
Fix pylint issues
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:13 +02:00
Gabor Mezei
c659c1b164
Move config file modification flag handling to the Config class
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:13 +02:00
Gabor Mezei
9f2b817fa7
Update documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:08 +02:00
Gilles Peskine
fbb59bd73b Document the C compiler requirement
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 13:10:58 +02:00
Gilles Peskine
73c4096442 Make the file a bit more readable
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 13:10:56 +02:00
Tom Cosgrove
2d5b17be03
Merge pull request #8609 from tom-daubney-arm/standardise_proj_detection
Standardise Project Detection in Shell Scripts
2024-08-07 07:18:36 +00:00
Gilles Peskine
6b3bca5c78 Follow include path updates for C++ builds
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
ae8fa71669 Rename internal function psa_key_production_parameters_are_default
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
62ee8fdcf5 Test cpp_dummy_build in pedantic mode
In public headers, we want to avoid things that are not standard C++,
including features that GCC and Clang support as extensions, such as
flexible array members. So compile with `-pedantic`.

Non-regression for https://github.com/Mbed-TLS/mbedtls/issues/9020.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:32 +02:00
Gilles Peskine
f9408282e8 Implement psa_generate_key_custom
Implement `psa_generate_key_custom()` and
`psa_key_derivation_output_key_custom()`. These functions replace
`psa_generate_key_ext()` and `psa_key_derivation_output_key_ext()`.
They have the same functionality, but a slightly different interface:
the `ext` functions use a structure with a flexible array member to pass
variable-length data, while the `custom` functions use a separate parameter.

Keep the `ext` functions for backward compatibility with Mbed TLS 3.6.0.
But make them a thin wrapper around the new `custom` functions.

Duplicate the test code and data. The test cases have to be duplicated
anyway, and the test functions are individually more readable this way.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Thomas Daubney
bda3e46846 Check for file at script startup
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-30 15:52:58 +01:00
Thomas Daubney
5e9ffa9096 Redirect error message to stderr
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-29 12:09:57 +01:00
Thomas Daubney
6a864dc5fe Add check for existence of project name file
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-26 17:31:46 +01:00
Gabor Mezei
91f1746f35
Remove sanity check for None value
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-07-25 11:00:20 +02:00