Commit Graph

12753 Commits

Author SHA1 Message Date
Ronald Cron
67152f3049 Merge pull request #10543 from gilles-peskine-arm/split-crypto-makefiles
Split crypto part of Mbed TLS makefiles
2026-01-07 15:18:32 +00:00
Gilles Peskine
8a528cfed5 Split the rules to generate config tests
Have crypto handle the crypto part and tls handle the tls part.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
49d698588b Move crypto-specific code from tests/Makefile to a new file
The new file is in Mbed TLS for now. Once we have finished moving code to
it, it will move to TF-PSA-Crypto.

What got moved:

* List of generated .data files in crypto
* Rules to generate .data files in crypto
* List of test suites in crypto
* List of generated .h files in crypto
* Rules to generate .h in crypto

What didn't get moved:

* Rules to generate the crypto part of `$(GENERATED_CONFIG_DATA_FILES)`,
  because they are currently mixed with the rule for the mbedtls part. This
  will be done in a subsequent commit.
* Rules to generate .c files from .function files, and to compile the
  resulting .c files. At least for now, we let Mbed TLS decide how to do
  that on its own.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
d9c6a411c6 Introduce intermediate variables for various TF-PSA-Crypto lists
Use separate variables for the crypto part of lists of generated C files,
generated objects, sample programs and test data files.

No behavior change.

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

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
e3e4da61a8 Use intermediate variables for TF-PSA-Crypto's contribution to LOCAL_CFLAGS
Define these intermediate variables in the crypto helper file.

No behavior change except possibly an inconsequential reordering of compiler
options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
f79f4014b6 Fix missing dependencies of test_certs.h
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
a1502f54f5 Drop the ability to build the library without the framework
We put that in 3.6.0 because we wanted to minimize changes in a minor
release, and in particular we wanted users to be able to build the library
if they were checking out a release tag without checking out submodules
recursively. That was possible because 3.6.x release tags contain the
generated files.

Since 4.0.0, it's completely impossible to build Mbed TLS without the
`tf-psa-crypto` submodule. So there's no point in trying to allow a build
without the `framework` submodule.

In the libtestdriver1 build, where we copy part of the framework, copy the
framework makefile as well, which is what we use to check for the presence
of the framework (even though the framework makefile doesn't do anything
useful after all).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-07 11:17:43 +01:00
Gilles Peskine
40b11f59df Remove component_test_sha3_variations
TF-PSA-Crypto is getting a component with similar coverage in
https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/618

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-06 17:07:17 +01:00
Gilles Peskine
64ab9a287e Merge pull request #10548 from gilles-peskine-arm/config-checks-generator-current-mbedtls
mbedtls: generate_config_checks.py: use current data
2026-01-06 10:07:34 +00:00
Gilles Peskine
168c6ec50c Improve out-of-date message
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
b6c30c3639 Print a useful message when the file is out of date
Don't print the differences: interested users can just run `git diff` (or
save the old file and run `comm`).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
93ef003cdc Check that the config option list shadow file is up to date
Test that `scripts/data_files/config-options-current.txt` is up-to-date.
This file needs to change every time we add or remove a config option.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
0e2eb22145 New script to check or update config-options-current.txt
This script may be generalized to check other files that need lists of
current options. But for now, the script just checks
`scripts/data_files/config-options-current.txt`.

This script is identical to the file in crypto. If the file grows to support
multiple targets, we'll probably want to split it, with a generic part in
the framework and a project-specific part (probably little more than the
list of targets) in each project. But for now the file is too simple to split.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Ben Taylor
27c22840b4 Re-instate failure when disabling non-existing option
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-12-24 08:20:09 +00:00
Valerio Setti
a7337251f7 tests: remove temporary fix for secp192 curves in test_psa_crypto_without_heap
secp192 curves are no more supported in tf-psa-crypto and also all the
temporary fixes has been removed. This one can be removed as well.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-11 17:37:06 +01:00
Nico Geyso
6140cfb438 tests/ssl_get_alert_after_fatal - add invalid param case
Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 23:01:57 +01:00
Nico Geyso
13200ab116 Fix more C code style issues
Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:37:07 +01:00
Nico Geyso
f9a734f2b7 Fix C code style issues
Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:37:07 +01:00
Nico Geyso
0841ceadf7 test ssl_get_alert_after_fatal - remove mbedtls_ssl_conf_rng
Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:37:07 +01:00
Nico Geyso
d589854611 mbedtls_ssl_get_alert(): getter for fatal alerts
Even though the TLS RFCs do not mandate libraries to expose *Error
Alerts* (as defined in RFC8446 6.2 for TLS 1.3 and in RFC5246 7.2.2 for
TLS 1.2) to the user, there are use cases when it is handy to get the
actual last received fatal error instead of a generic one. For instance
this enables the user to differ between received fatal errors in case
`mbedtls_ssl_handshake()`, `mbedtls_ssl_handshake_step()` or
`mbedtls_ssl_read()` returned `MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE`.

This changesets stores the last incoming fatal alert in
`mbedtls_ssl_context` and provides `mbedtls_ssl_get_alert()` as a getter
for retrieving it. Another option would be to provide a callback
mechanisms for all kinds of alerts (not only fatals) but for simplicity
I discarded this option.

Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:37:07 +01:00
Manuel Pégourié-Gonnard
1c479f88d0 Avoid references to ecdh.o
We're going to remove ecdh.c soon, so use another way of testing whether
builtin ECDH is included in the build.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-05 09:23:39 +01:00
Valerio Setti
725e3f1daa tests: x509parse: replace certificates using secp192 with those using secp256
This replacement is either:
- "server5-rsa-signed.crt": if a generic secp256r1 EC key is enough, i.e.
	any EC key is fine as it's not secp192 since this support is being
	removed from TF-PSA-Crypto.
- "server11-rsa-signed.crt": if an EC key which does not belong to "suite-b"
	is required. For this case "secp256r1" wouldn't be good, so we use
	a "secp256k1" key.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-03 13:03:07 +01:00
Valerio Setti
5ae6c62247 tests: x509parse: transition tests based on secp192 curves to secp256
After some analysis search it was determined that previous test data seem
not to belong to the "framework/data_files" certificate files. Therefore
new test data has been generated from scratch.

The improvement compared to the previous situation is that comments has
been added on top of each test in order to explain how to recreate new test
data.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-11-27 14:38:22 +01:00
Valerio Setti
65ec4cc771 tests: scripts: make enabling of secp192 curves fault tolerant in test_psa_crypto_without_heap
This is temporary but still required in order to have this commit merged
before the crypto#570, where these curves are really removed.
These lines will be removed in a follow-up PR once crypto#570 is merged.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-11-20 13:20:40 +01:00
Valerio Setti
910bf4bbc6 tests: suite_x509parse: remove temporary fixes
Removes the temporary fixes that were introduced in order to allow crypto#308
to be merged.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-11-03 10:27:24 +01:00
Minos Galanakis
2842c33e2c Merge tag 'v4.0.0' into mbedtls-4.0.0_mergeback
Mbed TLS 4.0.0

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-15 16:58:25 +01:00
Minos Galanakis
0283fa0656 Merge remote-tracking branch 'restricted/development-restricted' into mbedtls-4.0.0.rc
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-10-11 21:41:49 +01:00
Ben Taylor
91b8310e54 Remove internal deprecated items
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-10-07 08:19:44 +01:00
Ben Taylor
1317d7f14d Remove spurious make command
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-30 10:36:48 +01:00
Ben Taylor
c8e4fd3f1a Initial removal of DES from mbedtls
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-30 10:36:48 +01:00
Manuel Pégourié-Gonnard
2706002c6f Merge pull request #10426 from mpg/hide-small-curves
all.sh: prepare component for hiding small curves
2025-09-29 14:02:53 +00:00
Manuel Pégourié-Gonnard
9114d4ae0c all.sh: prepare component for hiding small curves
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-09-29 11:49:40 +02:00
David Horstmann
ee1991a387 Merge pull request #10408 from ronald-cron-arm/historical-libmbedcryto
Restore historical libmbedcrypto.* libraries
2025-09-29 08:41:06 +00:00
David Horstmann
98dfcd4908 Add missing include of stdio.h
This is required in util.h in PSASIM as it uses fprintf. Previously
stdio was inadvertantly included via psa/crypto_struct.h (of all
places).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-09-26 16:30:36 +01:00
Gilles Peskine
3415d2dd5f Merge pull request #10306 from gilles-peskine-arm/config-error-on-removed-options-mbedtls
Mechanism to error out on removed configuration options
2025-09-25 16:35:51 +00:00
Gilles Peskine
3cee43e8ab Be more consistent about method naming
Indicate which config file has the most relevant tweak.

Duplicate a few test cases so that both the crypto config and the mbedtls
config are tested.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Gilles Peskine
f7ed4e506f Add test case for allowing setting an always-on removed option
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Gilles Peskine
4bb82fdb16 Fix copypasta in documentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Gilles Peskine
379d38de1c Unit tests for checks for removed options in the config file
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Gilles Peskine
8e44a94d39 Automatically generate checkers for removed options
Read the list of historical config options in 3.6, compare that to 1.0/4.0
and emit the appropriate checkers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Gilles Peskine
24273c06db Checks for crypto options or internal macros set in mbedtls
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-24 17:20:35 +02:00
Ronald Cron
e5bae0dde3 Adapt basic-build-test.sh to make deprecation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-09-24 12:38:02 +02:00
Gilles Peskine
caaf52d6d0 Merge pull request #10391 from bjwtaylor/remove-deprecated-compilation-options-2
Remove deprecated compilation options 2
2025-09-23 08:40:11 +00:00
Ronald Cron
90979728ee Merge pull request #10382 from ronald-cron-arm/deprecate-make
Deprecate Make build system and remove MS visual studio files
2025-09-23 08:14:28 +00:00
Ronald Cron
e7bac84a22 Remove the generation of MS visual studio files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-09-22 18:00:26 +02:00
Ronald Cron
31f63210ec Deprecate Make
Move and rename the root Makefile to
scripts/legacy.make. That way running
make from the root fails.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-09-22 18:00:26 +02:00
Ronald Cron
401f20fb35 Prepare test components to scripts/legacy.make
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-09-22 18:00:26 +02:00
Gilles Peskine
9da0dce845 Bypass config checks when setting a low-level option directly
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-09-22 15:55:10 +02:00
Ronald Cron
35d59c6cb6 cmake: Install libmbedcrypto.* libraries
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-09-22 15:08:39 +02:00
Ben Taylor
fec1c002d5 Revert changes to analyze outcomes after dependencies have been merged
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-09-22 09:07:12 +01:00