Commit Graph

34271 Commits

Author SHA1 Message Date
Gilles Peskine
1de879c6dd Also reject internal macros that weren't options in 3.6
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
30323afa6c Read current data rather than data about 4.0
It doesn't matter how a macro was used in a previous minor version of the
library. What matters is current information about options and internal
symbols, and information about past versions from which a macro may have
been removed.

The output is mostly the same, but:

* Macros that were options in 3.6, became internal in 4.0 and have now
  been completely removed are now shown as removed, not internal.
* Macros that were options in 3.6, were completely removed in 4.0, and are
  now back but internal, are now shown as internal, not removed.
* Macros that were options in 3.6, were removed in 4.0 and are back to
  being options are no longer rejected.
* Macros that were options in 3.6, were removed in 4.0 and are back to
  being internal derived macros in TF-PSA-Crypto are no longer rejected.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
35821e7c77 Switch from config_history to config_macros
Switch from the `config_history` module to the new module `config_macros`.
No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:21 +01:00
Gilles Peskine
262d9cab42 Update framework with config_macros.py
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-05 16:29:17 +01:00
Gilles Peskine
fe34bc8ea0 Merge pull request #10550 from bjwtaylor/restore-failure
Re-instate failure when disabling non-existing option
2026-01-02 20:14:58 +00:00
Gilles Peskine
da7aa7678c Merge pull request #10549 from bjwtaylor/replace-mbedtls_ecp_set_map_ops
Replace references of mbedtls_ecp_set_max_ops
2025-12-31 15:43:49 +00: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
Ben Taylor
23aad2cdad Replace references of mbedtls_ecp_set_max_ops with psa_interruptible_set_max_ops as it is now internal
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-12-23 16:11:49 +00:00
David Horstmann
216c1950f3 Merge pull request #10539 from valeriosetti/issue10518
Remove temporary fix for secp192 curves in `test_psa_crypto_without_heap`
2025-12-15 10:26:57 +00:00
Valerio Setti
a7fd88ae74 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-11 22:54:39 +01:00
Valerio Setti
3b74e0ee60 tf-psa-crypto: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-11 21:17:35 +01: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
33bd8f8f7f ssl - reset alert type for session reset
reset indicator (in_alert_recv) and type (in_alert_type) in
mbedtls_ssl_session_reset_msg_layer

Signed-off-by: Nico Geyso <ng@gsmk.de>
2025-12-10 19:43:36 +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
abb0b22954 Merge pull request #10505 from valeriosetti/issue10453
Remove use of `pk_can_do()`
2025-12-10 11:56:13 +00:00
Valerio Setti
c0ac4a6933 library: ssl: specify hash algorithm when checking signature in ssl_parse_certificate_verify
Since the hash algorithm is known, this can be used when calling
"mbedtls_pk_can_do_psa()" to get a more accurate answer.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-09 16:18:11 +01:00
Valerio Setti
5ad2bfa6c8 library: ssl: adjust return type of mbedtls_psa_alg_from_pk_sigalg()
The correct return type should have been "psa_algorithm_t" since the
beginning because this is what the function really returns and this is
what the returned value is then used for in the calling functions.

Change also the returned value in the default case from
MBEDTLS_PK_SIGALG_NONE to PSA_ALG_NONE in order to return the same type
as in other cases of the switch case.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-09 16:15:48 +01:00
Valerio Setti
d8f0b37d1a ssl: replace remaining occurrence of pk_can_do with pk_get_key_type
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-05 15:57:39 +01:00
Valerio Setti
e5ba96c5c6 Merge pull request #10528 from mpg/prep-rm-ecdh
Avoid references to ecdh.o
2025-12-05 11:17:41 +00: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
e7b035eeb7 Merge pull request #10532 from gilles-peskine-arm/race-condition-in-makefile-4.0
Fix race condition in makefile affecting test_sha3_variations
2025-12-04 21:42:15 +00:00
Pengyu Lv
d86c4ae1d2 Fix dependencies in programs/Makefile
Make fuzz depend on MBEDLIBS to avoid multiple instances for
generation the library files.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2025-12-04 17:07:05 +01:00
Pengyu Lv
8b364c7436 Fix the commands to build library
In `scripts/common.make`, used by `tests/Makefile` and `programs/Makefile`,
we have the following rules to build the library:

  ```
  $(MBEDLIBS):
      $(MAKE) -C ../library
  ```

$(MBEDLIBS) contains three library files but the command is for all
the 3 files instead of single target generation. This would cause a
race when doing parallel build. This commit fixes command so that
the recipe could generate a single library file.

Fix https://github.com/Mbed-TLS/mbedtls/issues/8229

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
Signed-off-by: Gilles Peskine <gilles.peskine@arm.com>
2025-12-04 17:07:05 +01:00
Valerio Setti
9eb5b2a146 x509: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_type()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
902467d62f ssl: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_type()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
1de094fb32 library: x509: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
9d1fa1a8d8 library: x509: change order of checks in x509_crt_check_signature()
Checking that parent PK type is OK is definitely faster than computing
an hash, so invert the checks.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
81a5a0914c library: ssl: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
92926ff4dc library: common: add helper to get PSA algorithm from PK sigalg
Add a simple helper to convert from PK sigalg to PSA algorithm. This is
handy when calling mbedtls_pk_can_do_psa() knowing the PK sigalg and the
used MD type.

This is being added in a separate file because it's meant to be consumed
by both ssl and x509 modules. It was not added to tf-psa-crypto because
this is only needed on the mbedtls repo and doing so reduce interdependencies
between the repos.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
Valerio Setti
024c3aeb9e library: ssl: remove duplicate check in ssl_parse_server_key_exchange()
The check being removed is already done few lines above so there is no
need to repeat it twice.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-04 16:28:44 +01:00
David Horstmann
8f66d59d83 Merge pull request #10522 from valeriosetti/issue568-mbedtls-part2
[mbedtls] Remove support for secp192[k|r]1 curves (part 2)
2025-12-03 15:26:46 +00:00
Valerio Setti
d36ed4a84d tf-psa-crypto: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-03 13:03:08 +01:00
Valerio Setti
35d90d15c7 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-12-03 13:03:08 +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
d262352601 Merge pull request #10523 from mpg/rm-ecdh
Remove some useless private includes
2025-12-02 15:21:24 +00:00
Manuel Pégourié-Gonnard
5341c86877 Add comments for remaining internal includes
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-02 12:35:20 +01:00
Manuel Pégourié-Gonnard
ea5718721f Remove two more useless internal includes
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-02 12:06:39 +01:00
Manuel Pégourié-Gonnard
3e6455d50e Remove useless includes of psa_util_internal
Those in SSL modules were redundant because it's already included from
ssl_misc.h.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-02 12:00:34 +01:00
Manuel Pégourié-Gonnard
d6551eaaa6 Add comment about internal crypto include
Besides using an internal crypto header, error.h is arguably the wrong
place: this file's docstring says it's about "Error to string
translation", quite unrelated to the things we use from error_common.h.
This is not surprising given the history, but no longer makes sense
today.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 11:06:02 +01:00
Manuel Pégourié-Gonnard
411282d126 x509: rm useless private include in C file
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 11:06:02 +01:00
Manuel Pégourié-Gonnard
eab6d3276b ssl: rm useless private include in C file
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 10:26:28 +01:00
Manuel Pégourié-Gonnard
c53c43c296 x509: rm useless private includes in internal headers
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 10:24:50 +01:00
Manuel Pégourié-Gonnard
4b663abecc ssl: rm useless private includes in internal headers
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 10:24:41 +01:00
Manuel Pégourié-Gonnard
53c511578a x509: rm useless private include in public header
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 10:04:11 +01:00
Manuel Pégourié-Gonnard
59c9ebfaae ssl: rm useless private includes in public headers
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-12-01 10:04:06 +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