35109 Commits

Author SHA1 Message Date
Ronald Cron 8f0240c350 ssl-opt.sh: Remove CH reassembly unsupported test
We are about to have full support for TLS 1.2
CH reassembly on server side. The equivalent
positive test would be a duplicate of one of
the tests generated by generate_tls_handshake_tests.py.
Thus just removing the negative test.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron 7fe38dd934 ssl_msg.c: Improve HS message reassembly completed message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron 86b7df5591 ssl_tls.c: Rename and expand ssl_tls13_get_hs_msg_name
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:21:48 +01:00
Ronald Cron 8ab14401d7 ssl_server2.c: Flush stdout to improve logs timeliness
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:26 +01:00
Ronald Cron 1b5a0b1877 Add branch specific generate_tls_handshake_tests.py file
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:26 +01:00
Ronald Cron 57b29c2fe5 Introduce branch specific make_generated_files.py
Introduce branch specific make_generated_files.py
and use it in the development branch.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:26 +01:00
Ronald Cron 29eb988669 Update framework pointer
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 13:02:24 +01:00
David Horstmann 3f2a8b0ad3 Merge pull request #10601 from davidhorstmann-arm/fix-missing-type-conversion-tls-exporter
Fix missing type conversion in the TLS-Exporter
2026-02-17 18:31:01 +00:00
Gilles Peskine f41a9f6056 New macro TEST_ASSERT_ERRNO
Show errno if a test assertion fails.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-17 17:21:20 +01:00
Valerio Setti 4398e83f29 Merge pull request #10600 from gilles-peskine-arm/update-submodules-20260216
Update submodules
2026-02-17 11:59:40 +00:00
David Horstmann 059fe77e4b Fix missing type conversion in the TLS-Exporter
In the TLS-Exporter for TLS 1.3 we mistakenly call PSA_HASH_LENGTH() on
an mbedtls_md_type_t when it should be called on a psa_algorithm_t.

Fortunately, these two types have almost the same values, since we have
previously aligned them to make conversion more efficient. As a result,
PSA_HASH_LENGTH() produces exactly the same value when called on an
mbedtls_md_type_t as with the equivalent psa_algorithm_t.

Thanks to this happy coincidence, fix a largely cosmetic issue (rather
than a major functional bug).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-16 16:59:20 +00:00
David Horstmann bac74a050c Merge pull request #10593 from gilles-peskine-arm/bump-version-202602-4.0
Minor improvements to bump_version.sh
2026-02-16 16:50:16 +00:00
Ronald Cron 8ed11c99fe Merge pull request #274 from ronald-cron-arm/dtls-client-hello-defragmentation-prep
Some preparatory work for DTLS client hello defragmentation
2026-02-16 17:48:56 +01:00
Gilles Peskine 26e1a7c5c8 Update framework with XOF support in psasim
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-16 16:49:26 +01:00
Gilles Peskine 24c80cc536 Update tf-psa-crypto with mldsa-native
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-16 16:49:11 +01:00
Valerio Setti 4a57bd209d Merge pull request #265 from gilles-peskine-arm/crypto_knowledge-psa_spec_1.4-no_pake
Crypto knowledge: up to PSA Crypto 1.4, XOF test driver
2026-02-16 16:05:56 +01:00
Gilles Peskine c99fb5762d Fix SM3 hash length (bits/bytes confusion)
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-16 11:07:24 +01:00
Gilles Peskine 4602f36a93 Merge pull request #10596 from gilles-peskine-arm/check_committed_generated_files-mbedtls-actually_check_mbedtls
Actually check committed generated files
2026-02-12 15:11:38 +00:00
Valerio Setti 384a16746f library: check_config: remove redundant check on hash algorithms for TLS 1.2
TLS-PRF uses either SHA-256 and SHA-384, so the removed paragraph was not
correct. The correct version is already available few lines below in the
same header file.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-02-12 14:12:30 +01:00
Gilles Peskine d3a8582606 Actually check committed generated files
We were accidentally running the check in TF-PSA-Crypto instead of in Mbed TLS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-12 13:16:18 +01:00
Gilles Peskine 05d8c71202 Don't treat --help as an error
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-10 14:52:21 +01:00
Gilles Peskine 4cce03530a Remove unused variable
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-10 14:52:16 +01:00
Gilles Peskine 4857228971 psasim: add XOF operation support
XOF operations are not available on every branch, so their serialization
code needs to be compiled conditionally on the availability of the type.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-10 12:21:28 +01:00
Gilles Peskine 2ffd883d80 Driver entry point test code: add XOF support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 21:16:28 +01:00
Gilles Peskine 4484c52f9a Support test_suite_psa_crypto_metadata functions for new algorithm categories
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 567f89ade9 Remain compatible with generate_psa_constants.py which is outside the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 43a6e55ece Match field names to algorithm category names
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine d60e412a2d generate_test_keys.py: Support ML-DSA, ML-KEM and SLH-DSA keys
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine dec6c51f7d Add sample keys for ML-DSA, ML-KEM and SLH-DSA
Use NIST test vectors. I copied the first test case for each parameter set.
For ML-KEM and ML-DSA, I did it manually. For SLH-DSA, I used the following
Python script:

```
<gen-val/json-files/SLH-DSA-keyGen-FIPS205/internalProjection.json python -c '
import json, re, sys
data = json.load(sys.stdin)
types = {family: {} for family in ["SHA2_F", "SHA2_S", "SHAKE_F", "SHAKE_S"]}
for group in data["testGroups"]:
  t = group["tests"][0]
  m = re.match(r"SLH-DSA-(\w+)-([0-9]+)(\w+)", group["parameterSet"])
  type = m.group(1) + "_" + m.group(3).upper()
  size = m.group(2)
  prv = t["skSeed"] + t["skPrf"] + t["pkSeed"] + t["pk"]
  pub = t["pkSeed"] + t["pk"]
  types[type][size] = (prv, pub)
for type in sorted(types.keys()):
  print("")
  print(f"    # https://github.com/usnistgov/ACVP-Server/blob/v1.1.0.41/gen-val/json-files/SLH-DSA-keyGen-FIPS205/internalProjection.json")
  print(f"    \x27SLH_DSA(PSA_SLH_FAMILY_{type})\x27: {{")
  for size in sorted(types[type].keys()):
    entry = types[type][size]
    print(f"        {size}: (\"{entry[0]}\",")
    print(f"              \"{entry[1]}\"),")
  print(f"    }},")
'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 87e3988537 Add all algorithms from PSA Crypto 1.4 PQC extension
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 4c54ebd97d OpFail: only consider categories in which at least one algorithm is supported
Addresses https://github.com/Mbed-TLS/mbedtls-framework/issues/264
but perhaps not in the best way.

Keep an exception for PAKE, for which we already have algorithm
support (`PSA_ALG_JPAKE`) but no `pake_fail` function.
https://github.com/Mbed-TLS/mbedtls-framework/issues/263

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 987737675a OpFail generator: pre-compute the lists of categories and algorithms
No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 29697c90ff Support new destructor in PSA Crypto API 1.4
Recognize `PSA_ALG_SIGN_SUPPORTS_CONTEXT` as a destructor.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 1ef0e676bf Add all mechanisms up to PSA Crypto API 1.4
Define the necessary new categories (key wrap, key encapsulation, XOF).

This completes the list of mechanisms in the PSA Crypto API version 1.4,
except for PAKE that are more challenging (family parametrization, need to
find sample keys in `asymmetric_key_data.py`), and except for the PQC
extension.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine e9f66f7ec2 Add DH family RFC3526
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 1e8f77d47c Add elliptic curve FRP256v1
Sample key from
https://www.ietf.org/archive/id/draft-lspm-cose-c509-test-vectors-00.html#name-weierstrass-ec-public-key-with-f

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine 000b04968f Indicate the provenance of keys
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 18:04:13 +01:00
Gilles Peskine c0a8a9cbed Merge pull request #276 from gilles-peskine-arm/psasim-generate-wrappers-dynamically
psasim: generate wrappers dynamically
2026-02-09 17:58:27 +01:00
Gilles Peskine a9bb80e699 Document the psasim build
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-09 15:34:29 +01:00
Gilles Peskine 2bc58125fe Add missing dependencies on generated headers
Without those dependencies, the headers don't get generated.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 22:23:52 +01:00
Gilles Peskine 3a69598ade Clean up psasim/.gitignore
Add generated files that are no longer checked in.

Remove obsolete things (including things now covered at the framework root).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 14:03:57 +01:00
Gilles Peskine b6c23e6e01 Remove psasim generated files
The files are now generated during the build. Stop having them in version
control.

As formerly in Mbed TLS, `make clean` doesn't remove
configuration-independent target-independent generated files, but the new
target `make neat` does.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 13:58:22 +01:00
Gilles Peskine 9dca598383 Add rules to generate wrappers during the psasim build
We don't need to check those generated files into version control.

This fixes the problem that the generated files have precise knowledge of
the functions that exist on whatever branch of TF-PSA-Crypto is consuming
the framework.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 13:58:22 +01:00
Gilles Peskine 4b0febffa1 psasim: Update generation script instructions for the TF-PSA-Crypto split
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 13:39:25 +01:00
Gilles Peskine 499dd4322e Update psasim generated files
TF-PSA-Crypto no longer has `psa_can_do_hash()` (except as a temporary stub
to avoid breaking the build of psasim).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-05 13:38:12 +01:00
Valerio Setti 2a72766d75 Merge pull request #10570 from valeriosetti/issue10349
mbedtls 4.x does not expose mbedtls_ecp_curve_list()
2026-02-03 11:01:11 +00:00
Valerio Setti 318e4314df changelog: add notes about helpers added to get list of known/supported TLS groups
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-02-02 13:38:03 +01:00
Valerio Setti c3f585b8ee tests: ssl: fix typo in comment in test_mbedtls_ssl_get_supported_group_list
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-30 22:02:08 +01:00
David Horstmann 8b1d9e49d9 Reword to be more specific
Specify that the cryptographic operations of Mbed TLS are governed by
its threat model and point specifically to block ciphers as an important
case of this.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-01-30 14:51:59 +00:00
David Horstmann 7bba265eed Add link to TF-PSA-Crypto SECURITY.md
To avoid confusion about the threat model of cryptographic code, add a
link to the SECURITY.md of TF-PSA-Crypto. This should help users who are
unaware that the cryptography has been split into a separate repository.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-01-30 12:23:16 +00:00