Commit Graph

35062 Commits

Author SHA1 Message Date
Gilles Peskine c3d6599465 Merge pull request #283 from gilles-peskine-arm/audit_validity_dates-move-from-mbedtls
Move some scripts from mbedtls
2026-03-12 09:57:39 +01:00
Gilles Peskine c5135a0c47 Add pylint duplicate-code exceptions for newly moved files
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine 345b13a2b4 Run pylint and mypy on all files in mbedtls_framework
We were missing `mbedtls_framework/code_wrapper/*.py` because we were not
traversing the directory recursively.

Also improve the comment explaining the duplicate-code workaround for code
that's being moved between files in different repositories.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine 95367dbdf1 Remove temporary code from the tf-psa-crypto split
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine c77ecf059c Fix or silence minor issues reported by pylint
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine d393ebd792 Fix cosmetic issues reported by pylint
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine 7bc3cdfd12 Update paths after moving some scripts to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine 72215295d8 Add requirements in the framework for scripts in the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-09 10:50:57 +01:00
Gilles Peskine 731ff38bf9 Merge remote-tracking branch 'main' into audit_validity_dates-move-from-mbedtls 2026-03-09 10:50:00 +01:00
Valerio Setti 9b92164c47 Merge pull request #280 from ronald-cron-arm/tf-psa-crypto-reorg-prep
Prepare for TF-PSA-Crypto repository reorganization
2026-03-07 14:07:50 +01:00
Gilles Peskine 08e8a79146 Merge pull request #286 from gilles-peskine-arm/psasim-serialize-unsigned-int
psasim serialize: Support a few more standard C types
2026-03-05 22:11:12 +01:00
Gilles Peskine 0058f4c4cb psasim serialize: Support a few more standard C types
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-05 10:59:26 +01:00
Gilles Peskine 7dffa3505a Merge branch 'tmp-branch-move-files-to-framework' into audit_validity_dates-move-from-mbedtls 2026-03-03 13:37:11 +01:00
Gilles Peskine 7e011cca07 Move some scripts from mbedtls into the framework
Move a bunch of files from `scripts` and `mbedtls/scripts` to the framework.

The following files will be added (moved from Mbed TLS `development`):

* `scripts/ecp_comb_table.py`
* `scripts/massif_max.pl`
* `tests/scripts/audit-validity-dates.py` (moved to `scripts/`)
* `tests/scripts/gen_ctr_drbg.pl` (moved to `scripts/`)
* `tests/scripts/gen_gcm_decrypt.pl` (moved to `scripts/`)
* `tests/scripts/gen_gcm_encrypt.pl` (moved to `scripts/`)
* `tests/scripts/gen_pkcs1_v21_sign_verify.pl` (moved to `scripts/`)
* `tests/scripts/generate-afl-tests.sh` (moved to `scripts/`)
* `tests/scripts/generate_server9_bad_saltlen.py` (moved to `scripts/`)
* `tests/scripts/run-metatests.sh` (moved to `scripts/`)
* `tests/scripts/run_demos.py` (moved to `scripts/`)
* `tests/scripts/test_config_script.py` (moved to `scripts/`)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-03 13:36:26 +01:00
Valerio Setti e07b6643e8 Merge pull request #278 from gilles-peskine-arm/generate_mldsa_tests-create
Support committed generated test data and generate PQCP test data
2026-02-27 11:12:44 +01:00
Gilles Peskine 0879d0c806 Merge pull request #279 from gilles-peskine-arm/unix-detection-202601-framework
Simplify platform requirements before 1.1/4.1: framework support
2026-02-26 19:10:22 +01:00
Bence Szépkúti c2cb8565a5 Merge pull request #10607 from gilles-peskine-arm/timing-use-mstime
Simplify MBEDTLS_TIMING_C to use mbedtls_ms_time()
2026-02-26 14:38:50 +00:00
Gilles Peskine d1bb3a61a5 dilithium_py reproducible output requires pycryptodome
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-25 21:12:46 +01:00
Gilles Peskine d6dce9b3f8 Make the output deterministic
Tests using randomized signatures were currently randomized. We need the
output of the script to be reproducible, so this won't do.

Force randomized signatures to use a specific RNG which is reset before
constructing each test case. This way, the script's output is reproducible.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-25 19:02:22 +01:00
Gilles Peskine 3ddf7bc717 Fix verify test cases not having a randomized signature
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-24 16:06:11 +01:00
Janos Follath 9394d25048 Merge pull request #10584 from davidhorstmann-arm/add-link-to-crypto-security-md
Add link to TF-PSA-Crypto `SECURITY.md`
2026-02-24 08:36:39 +00:00
Ronald Cron 25db08b18b check-doxy-blocks.pl: Add dispatch, extras, platform and utilities directories
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 10:23:01 +01:00
Valerio Setti b41c8f6e04 Merge pull request #10608 from bjwtaylor/DriverVsReference_removal
Remove DriverVsReference tasks from analyze_outcomes.py
2026-02-23 09:01:25 +00:00
Ronald Cron 055618425f check_names.py: Add dispatch, extras, platform and utilities directories
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 08:17:50 +01:00
Bence Szépkúti bbf8bbbdb6 Merge pull request #10575 from ronald-cron-arm/dtls-client-hello-defragmentation-prep
Some preparatory work for DTLS client hello defragmentation
2026-02-22 23:30:39 +00:00
Gilles Peskine bd6dfd6d8a Fix check_names complaints about *_platform_requirements.h
Platform requirement headers are expected to define macro names
outside of our namespace.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-21 21:45:27 +01:00
Gilles Peskine b2eb76d575 Revert "Fix check_names complaints about *_platform_requirements.h"
This reverts commit 5452c7747b.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-21 21:45:20 +01:00
Gilles Peskine 99c4159681 Disable Unix-like integration code in baremetal builds in all.sh
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-21 21:20:36 +01:00
Gilles Peskine f004998303 Add issue number
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-21 21:20:34 +01:00
Gilles Peskine 6d5987a954 Include <test/test_common.h> first in test code
This lets us define things that we want to have everywhere in test code. In
particular, this lets us define platform-specific symbols that influence
what system headers declare. This also takes care of including the library
configuration.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-20 21:46:11 +01:00
Gilles Peskine 4f3a21f40d Stop using MBEDTLS_PRINTF_SIZET
Since Mbed TLS 3.6.0, all officially supported versions of Visual Studio
a printf function family that is sufficiently compliant to C99 for our
purposes, in particular supporting `%zu` for `size_t`. The only platform
without `%zu` that we semi-officially support is older versions of MinGW,
still used in our CI. MinGW provides either a Windows legacy printf or a
standards-compliant printf depending on the value of
`__USE_MINGW_ANSI_STDIO` when compiling each C file. Force the use of the
compliant version. Don't rely on `MBEDTLS_PRINTF_SIZET`, which is defined in
`<mbedtls/debug.h>` and no longer considers the Windows legacy version in
Mbed TLS >= 4.1.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-20 20:31:56 +01:00
Ben Taylor d507b46684 Remove DriverVsReference tasks from analyze_outcomes.py
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-02-20 15:08:33 +00:00
Valerio Setti 3b4984243f Merge pull request #10595 from valeriosetti/fix-tls12-sha-guards
library: check_config: fix required hash algorithms for TLS 1.2
2026-02-20 09:14:13 +00:00
Gilles Peskine c88127f488 ML-DSA test case generator
Generate some basic test cases for the mldsa-native functions.

Uses `dilithium_py` from https://github.com/GiacomoPope/dilithium-py
(`pip install dilithium-py`), which requires Python >=3.9.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 18:24:08 +01:00
Gilles Peskine d85217d8f5 Support test data generators in generate_files_helper.py
Support check and always-update mode. Update-if-needed mode falls back to
always-update mode because test_data_generation.py doesn't support
update-if-needed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 18:24:08 +01:00
Gilles Peskine 2fe235d289 Test data generators: add --list-outdated option
As part of a long-term unification effort of generation scripts, add an
option for test generators to list oudated targets without writing to files.
This corresponds to functionality that the new generate_files_helper module
offers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 18:24:08 +01:00
Gilles Peskine 151585f1a1 New utility Python module: generate_files_helper
A new utility to give a common interface to committed generated files.

For the time being, this module is only intended for committed generated
files, and `make_generated_files_common.py` is only intended for non-committed
generated files. The two may be unified at some point in the future.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 18:24:08 +01:00
Gilles Peskine f9a7620e5b Create a new directory for non-user-facing scripts
Create a directory for scripts that are useful to maintainers, and may be
invoked as part of the CI, but are not part of the normal build.

These scripts may require a recent Python version and may require additional
third-party modules, unlike user-facing scripts where we try to minimize
requirements.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 18:24:08 +01:00
Gilles Peskine ed642cab9e Fix inclusion of <time.h> when MBEDTLS_HAVE_TIME is disabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 17:38:00 +01:00
Gilles Peskine 5452c7747b Fix check_names complaints about *_platform_requirements.h
Platform requirement headers are expected to define macro names
outside of our namespace.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 17:18:03 +01:00
Gilles Peskine e2b04b6847 Don't use printf("%llu")
We can't easily printf a `long long` on MingW yet, pending the work on
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/675 for which this is an
early stage. A `long` is enough here anyway.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:53:52 +01:00
Gilles Peskine 5890b22b82 Fix a build error with MSVC
Also fixes a minor bug on Windows with timers running over ~49 days.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:53:52 +01:00
Gilles Peskine 7ea318246c Fix build error when MBEDTLS_TIMING_C and MBEDTLS_HAVE_TIME are both disabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:53:52 +01:00
Gilles Peskine 137b5b776d Simplify MBEDTLS_TIMING_C to use mbedtls_ms_time()
Don't ship two slightly different wheels.

This reduces our platform adherence by using only `clock_gettime()` in the
library and not `gettimeofday()` as well.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:53:52 +01:00
Gilles Peskine 86eac795c9 Have MBEDTLS_TIMING_C require MBEDTLS_HAVE_TIME
Nowadays, the timing module just builds on a function that provides a timer
with millisecond resolution. In terms of platform requirements, this is
almost exactly equivalent to `mbedtls_ms_time()`
provides (`mbedtls_ms_time()` is arguably a little stronger because it is
supposed to last longer than a single timer object, but an application could
start a timer when it starts, so there's no real difference.) So it's a bit
silly that `timing.c` essentially reimplements this. Rely on
`mbedtls_ms_time()` instead.

This is an API break because in Mbed TLS 4.0, it was possible to enable
`MBEDTLS_TIMING_C` without `MBEDTLS_HAVE_TIME`. However, `timing.c` only
provided an implementation for Windows and Unix-like platforms, and on those
platforms, it is very likely that the default implementation of
`MBEDTLS_HAVE_TIME` would also work. (The main exception would be a platform
that has the traditional Unix function `gettimeofday()`, but not the 1990s
novelty `clock_gettime()`.) So make this an official requirement, as a
belated change that really should have gone into 4.0 if we'd taken the time
to dig into it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 16:53:52 +01:00
Gilles Peskine 67538f61bc Remove an unused method
`TextChangelogFormat.version_title_text` never worked: it's missing a
parameter in the call to `re.sub`. Fortunately it's unused, so just remove it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-19 12:34:35 +01:00
Gilles Peskine 316ec76508 Modernize usage of re.sub deprecated in Python 3.13
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-18 20:10:40 +01:00
Ronald Cron 73be048c8a ssl-opt.sh: Revert leftover debug level increase
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron 076ddc3ac7 tests: cmake: Fix dependency on generate_tls_handshake_tests.py
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron 4f0741498c ssl_msg.c: Improve handshake message fragmenting message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00