1581 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
95395738b4 Drop building with armcc5 in all.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-29 11:39:41 +01:00
Valerio Setti
8d4f15013f 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 13:31:19 +02:00
David Horstmann
e905442f7e
Merge pull request #9675 from eleuzi01/backport-9673
[Backport 3.6] Move TLS auxiliary test scripts to the framework
2024-10-17 17:18:57 +00:00
Elena Uziunaite
1d8a2257d8 Adjust file path for generate_tls13_compat_tests.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
7f5ec13a12 Adjust file path for generate_ssl_debug_helpers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
6f4ec30bd1 Move some files to framework repository
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:12 +01:00
Harry Ramsey
5098d0474a 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-14 14:58:36 +01:00
Tom Cosgrove
d7408a69fc
Merge pull request #9679 from gergelykarm/mbedtls-3.6
Backport 3.6: Fix driver schema json default type requirements
2024-10-10 13:53:09 +00:00
Gergely Korcsák
36b0521b5f Fix driver schema json default type requirements
Signed-off-by: Gergely Korcsák <gergely.korcsak@arm.com>
2024-10-10 13:15:01 +02:00
Gilles Peskine
e816f1ef49 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:19:31 +02:00
Gilles Peskine
309051dc25 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:19:31 +02:00
Manuel Pégourié-Gonnard
d93161f366
Merge pull request #9637 from gilles-peskine-arm/config-full-booleans-only-3.6
Backport 3.6: config.py: don't rely on section names
2024-09-26 10:04:06 +00:00
Gilles Peskine
f5f90d517f 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-25 14:00:07 +02:00
Gilles Peskine
e5920a4ae8 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-25 14:00:07 +02:00
Gilles Peskine
bfdffc33b3 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-25 14:00:07 +02:00
Gilles Peskine
0ff1d984f8 Pass the setting's value to adapters
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 14:00:07 +02:00
Gilles Peskine
02f0f9f1ff Merge remote-tracking branch 'mbedtls-3.6' into tls13-middlebox-compat-disabled-3.6 2024-09-25 09:52:14 +02:00
Paul Elliott
d8c7eae2cf
Merge pull request #9596 from gilles-peskine-arm/make_generated_files-document_CC-3.6
Backport 3.6: make_generated_files.bat: document C compiler requirement
2024-09-24 12:36:28 +00:00
Tom Cosgrove
81163122e4
Merge pull request #9601 from gilles-peskine-arm/use_psa_crypto-key_id_encodes_owner-compatible-config-3.6
Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
2024-09-24 10:44:44 +00:00
Gabor Mezei
5a2bcf6f3e
Remove PSA macros usage from adapters
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-20 12:41:24 +02:00
Gilles Peskine
0e9ba089b9 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-20 07:44:36 +02:00
Gilles Peskine
3415dc828e 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:45:39 +02:00
Gabor Mezei
76f147d597
Remove unused CombinedConfig class
In 3.6 `MbedTLSConfig` is used instead of `ConbinedConfig` due to keep compatibility

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 13:01:06 +02:00
Gabor Mezei
1a0bd776b2
Use MbedTLSConfig for config handling to keep campatibility
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:59 +02:00
Gabor Mezei
8b54f0e7e8
Apply the parameter change
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:59 +02:00
Gabor Mezei
d72c9f9401
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:59 +02:00
Gabor Mezei
2285ed8282
Update member variable names
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:59 +02:00
Gabor Mezei
3ae480ba7d
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:58 +02:00
Gabor Mezei
634103c9f9
Update config.py to use config_common.py from the framework
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:51:58 +02:00
Gilles Peskine
83af88306d Document the C compiler requirement
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 14:17:14 +02:00
Gilles Peskine
605bc16e67 Make the file a bit more readable
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 14:17:13 +02:00
Tom Cosgrove
4306a69931
Merge pull request #9437 from tom-daubney-arm/bp_3-6_standardise_proj_detection
[3.6 Backport] Standardise Project Detection
2024-08-07 07:18:43 +00:00
Thomas Daubney
a542420e6d Call in_mbedtls_repo
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-08-06 18:01:42 +01:00
Gilles Peskine
52504f8568 Rename internal function psa_key_production_parameters_are_default
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-06 13:13:05 +02:00
Gilles Peskine
f5db72bbb9 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-06 13:13:04 +02:00
Gilles Peskine
f36d785188 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-06 13:12:06 +02:00
Thomas Daubney
2f556400c3 Add functions to detect project
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-31 16:05:35 +01:00
Thomas Daubney
ecb39368df Introduce project_name.txt
This file is used for detecting which project a script is being
run from.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-31 16:02:14 +01:00
David Horstmann
9c4dd4ee6f Update paths pointing to tests/data_files
These now point to framework/data_files instead.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-07-08 15:36:46 +01:00
Gilles Peskine
06fb1803be Generate config test cases for single options
Generate option-on and option-off cases for test_suite_config, for all
boolean options (MBEDTLS_xxx and PSA_WANT_xxx, collected from the mbedtls
and PSA config files).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
30805a733b Recognize that a double-inclusion guard is not a config setting
Fix PSA_CRYPTO_CONFIG_H being treated as a configuration setting in
include/psa/crypto_config.h.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
David Horstmann
93ee016836 Remove multi-type variable
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-06-06 16:20:58 +01:00
David Horstmann
8eaeb38b3a Allow code_style.py to work from a git hook
When running a git hook, git sets certain environment variables (such
as GIT_INDEX_FILE) which force git to look at the main repository,
overriding other options. This trips up code_style.py whenever it
tries to run a git command on the framework submodule.

Fix this by explicitly clearing git-related environment-variables
before running git commands on the framework. This is recommended
by git's documentation[1]:

> Environment variables, such as GIT_DIR, GIT_WORK_TREE, etc., are
> exported so that Git commands run by the hook can correctly locate
> the repository. If your hook needs to invoke Git commands in a
> foreign repository or in a different working tree of the same
> repository, then it should clear these environment variables so
> they do not interfere with Git operations at the foreign location.

[1] https://git-scm.com/docs/githooks

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-06-06 16:20:58 +01:00
Bence Szépkúti
2cfa6c9b45
Merge pull request #9208 from davidhorstmann-arm/move-test-generation-files-3.6
[Backport 3.6] Move test generation files to framework
2024-06-04 09:23:23 +00:00
David Horstmann
ea09152be9 Update file paths for moved files
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-31 15:51:41 +01:00
David Horstmann
8d398ee3d0 Make abi_check.py look in both locations
To deal with situations where we are comparing revisions before and
after the move of generate_psa_tests.py to the framework, look for
it in both the old and new locations.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-31 15:51:41 +01:00
Gilles Peskine
cddcd7ac0b
Merge pull request #9177 from ttytm/fix-typo-bp-3.6
Backport 3.6: fix typo
2024-05-30 17:24:57 +00:00
Ronald Cron
bc93d0e4f0 Extend C code style check to framework files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-29 09:51:26 +02:00
Turiiya
20f4488cd0 fix typo
Signed-off-by: Turiiya <34311583+ttytm@users.noreply.github.com>
2024-05-23 21:43:55 +02:00
David Horstmann
7f6c81a9e3 Rename framework_path to framework_scripts_path
This name is more descriptive of its purpose, since it actually adds
framework/scripts to the path rather than just framework/

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:44:37 +01:00