1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-13 09:01:48 +03:00
Commit Graph

12456 Commits

Author SHA1 Message Date
ba2376c580 Merge pull request #10275 from ariwo17/remove-des-core-before-crypto
Remove DES from Mbed TLS core (except references blocked by TF PSA Crypto)
2025-07-09 09:52:31 +00:00
5d8d299f43 Disable PSA_WANT_KEY_TYPE_DES to stop DES from being re-enabled
Signed-off-by: Ari Weiler-Ofek <ariwei01@e134794.arm.com>
2025-07-09 00:18:18 +01:00
83bef5b66a Merge tag 'mbedtls-4.0.0-beta' into mbedtls-4.0.0-beta-mergeback
Mbed TLS 4.0.0-beta
2025-07-07 17:40:18 +03:00
86422e5509 Remove: DES selftest, component_test_psa_crypto_config_accel_des and dead DES mentions prior to TF-PSA-Crypto cleanup
Signed-off-by: Ari Weiler-Ofek <ariwei01@e134794.arm.com>
2025-07-07 11:29:50 +01:00
921331867d Merge pull request #10197 from gilles-peskine-arm/ssl_helpers-split_perform_handshake-dev
Break down mbedtls_test_ssl_perform_handshake
2025-06-30 09:39:29 +00:00
0038408f55 Properly initialize SSL endpoint objects
In some cases, we were calling `mbedtls_test_ssl_endpoint_free()` on an
uninitialized `mbedtls_test_ssl_endpoint` object if the test case failed
early, e.g. due to `psa_crypto_init()` failing. This was largely harmless,
but could have caused weird test results in case of failure, and was flagged
by Coverity.

Use a more systematic style for initializing the stack object as soon as
it's declared.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-27 11:12:55 +01:00
042ee3b318 Fix accidentally skipped test assertion
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-27 11:12:55 +01:00
ed87da7ad7 Merge remote-tracking branch 'restricted/development-restricted' into future_rc
As set by process the tf-psa-crypto submodule is set
to point to tf-psa-crypto-release-sync input.
2025-06-27 10:50:33 +01:00
42c4bddc07 Merge pull request #10245 from felixc-arm/gcc-15-remove-wnoerror-dev
[Dev] Turn Wunterminated-string-initialization back into an error
2025-06-26 07:08:33 +00:00
f68f45c827 Merge pull request #10213 from valeriosetti/issue298-development
[development] PK: try storing all private RSA keys in PSA (2/3)
2025-06-25 15:23:27 +00:00
27eb0141b9 tests: suite_x509parse: rename variable in x509parse_crt()
- rename result_ext to result_back_comp
- add a comment to describe its purpose

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
210b61111b tests: suite_x509parse: fix indentation in x509parse_crt()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
2747ac1e70 tests: x509parse: fix RSA key in DER certificates
The previous key was not correct so it could not be imported into PSA
for validation inside the PK module.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
11345e9de3 tests: x509parse: fix return values for invalid RSA keys
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
760608d47b Properly initialize SSL endpoint objects
In some cases, we were calling `mbedtls_test_ssl_endpoint_free()` on an
uninitialized `mbedtls_test_ssl_endpoint` object if the test case failed
early, e.g. due to `psa_crypto_init()` failing. This was largely harmless,
but could have caused weird test results in case of failure, and was flagged
by Coverity.

Use a more systematic style for initializing the stack object as soon as
it's declared.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-24 18:42:04 +02:00
b836d46870 Fix accidentally skipped test assertion
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-24 18:42:04 +02:00
8e95ba94c6 Merge pull request #10214 from ariwo17/fix-typo
Fixed some minor typos in comments.
2025-06-23 16:33:45 +00:00
95c48b3b44 Turn Wunterminated-string-initialization back into an error
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-23 14:54:33 +01:00
78b0521449 Remove trailing whitespace
Signed-off-by: Ari Weiler-Ofek <ariwei01@e134794.arm.com>
2025-06-20 11:48:50 +01:00
69f5706431 Add explanatory comment above #include "../tf-psa-crypto/core/common.h"
Signed-off-by: Ari Weiler-Ofek <ariwei01@e134794.arm.com>
2025-06-20 11:48:50 +01:00
cfbee27b45 Add include so psasim files can find new macro
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-20 11:48:50 +01:00
5b84ae14e9 Replace __attribute__((nonstring)) with macro MBEDTLS_ATTRIBUTE_UNTERMINATED_STRING
This macro applies __attribute__((nonstring)) when using a compiler that supports it

Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-20 11:48:16 +01:00
79b513894a Add __attribute__ ((nonstring)) to remove unterminated-string-initialization warning
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-20 11:48:16 +01:00
48552b620d Merge pull request #10187 from valeriosetti/ecp-restartable-development
[development] Always enable MBEDTLS_PK_USE_PSA_EC_DATA + use PSA interruptible operations as backend for PK restartable ones
2025-06-16 07:24:50 +00:00
b1d3e2e4e0 Merge pull request #9634 from gabor-mezei-arm/9144_update_depends.py_hashes_domain
Update the `hashes` domain to use PSA macros in `depends.py`
2025-06-13 07:25:04 +00:00
f5a63d1456 Fix invalid test data by aligning with 3.6
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-06-12 09:42:03 +02:00
d2262f2304 Uncomment tests now that crypto is fixed
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-06-12 09:42:03 +02:00
a81d6dfb05 tests|programs: remove usage of mbedtls_ecp_set_max_ops()
PK restartable operations are now implemented using PSA interruptible
ones, so mbedtls_ecp_set_max_ops() can be removed in favor of
psa_interruptible_set_max_ops().

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-12 06:39:18 +02:00
6ee4d9220e Fixed the same typo in ssl-opt.sh
Signed-off-by: Ari Weiler-Ofek <ari.weiler-ofek@arm.com>
2025-06-11 17:40:42 +01:00
3795f8ab74 Remove temporary component created for SHA3 testing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-10 15:40:53 +02:00
ef013a6970 Use PSA macros for the hashes domain
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-10 15:40:41 +02:00
43c891ae98 Remove requirement on MBEDTLS_PLATFORM_C from configs
Signed-off-by: Felix Conway <felix.conway@arm.com>
2025-06-10 13:45:34 +01:00
cdd91da1af Merge pull request #10145 from gabor-mezei-arm/remove_sha3_config_option
Remove `MBEDTLS_SHA3_C` config option
2025-06-10 09:57:22 +00:00
2649800f7c Do not disable PSA_WANT_SHA3 macros when driver accel is used
The SW implementation is guarded with the `MBEDTLS_PSA_BUILTIN_ALG_SHA3`
macros and not enabled when driver accelaration is set. So disabling
the `PSA_WANT` macros is not needed.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-05 14:01:30 +02:00
b4cbc156ef Merge pull request #10192 from valeriosetti/fixes-for-ecp-restartable-part2
[development] Some pre-requisites for psa#299
2025-06-05 07:50:53 +00:00
e8061342a2 Merge pull request #10173 from gilles-peskine-arm/oid-split-x509
OID: make X.509 independent from crypto
2025-06-04 08:26:59 +00:00
4aa974f7c7 Remove MBEDTLS_SHA3_C config option
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-03 17:49:23 +02:00
b828820f7a Declare oid_xxx_numeric_string only when they are defined
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
02ec585518 Replace MBEDTLS_OID_C by function-specific dependencies
For each function in `x509_oid.c`, determine where it is used and only
include it in the build if it is needed by the X.509 code. Define the
corresponding internal tables only when they are consumed by a function.

This makes Mbed TLS completely independent of the compilation option
`MBEDTLS_OID_C`. This option remains present only in sample configs for
crypto, where it must stay until TF-PSA-Crypto no longer relies on this
option.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
cd4c0d7b00 Move OID string definitions back to mbedtls/oid.h
Some code that parses or writes X.509 needs to know OID values. We provide a
convenient list. Don't remove this list from the public interface of the
library.

For user convenience, expose these values in the same header as before and
with the same name as before: `MBEDTLS_OID_xxx` in `<mbedtls/oid.h>`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
4c83221320 Replace MBEDTLS_ERR_OID_NOT_FOUND with MBEDTLS_ERR_X509_UNKNOWN_OID
Replace the non-X.509-named error code `MBEDTLS_ERR_OID_NOT_FOUND` with
`MBEDTLS_ERR_X509_UNKNOWN_OID`, which already exists and is currently not
used for anything.

Public functions in X.509 propagate this error code, so it needs to have a
public name.

Remove the definition of `MBEDTLS_ERR_OID_NOT_FOUND` in `x509_oid.h`, then

```
git grep -l MBEDTLS_ERR_OID_NOT_FOUND | xargs perl -i -pe 's/\bMBEDTLS_ERR_OID_NOT_FOUND\b/MBEDTLS_ERR_X509_UNKNOWN_OID/g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
47f1d7be95 Replace MBEDTLS_ERR_OID_BUF_TOO_SMALL with PSA_ERROR_BUFFER_TOO_SMALL
Remove the definition of `MBEDTLS_ERR_OID_BUF_TOO_SMALL` in `x509_oid.h`,
and use the corresponding PSA error instead.

```
git grep -l MBEDTLS_ERR_OID_BUF_TOO_SMALL | xargs perl -i -pe 's/\bMBEDTLS_ERR_OID_BUF_TOO_SMALL\b/PSA_ERROR_BUFFER_TOO_SMALL/p'
edit library/x509_oid.h
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
32a1112e88 Remove MBEDTLS_OID_X509_EXT_xxx constants
They're just aliases for the corresponding MBEDTLS_X509_EXT_xxx. We don't
need separate names.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
b7ef4df001 Remove OID tables that are not used in X.509
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
532e3ee104 Switch library and tests to the x509_oid module
```
git grep -l -P 'mbedtls_oid_get_(?!numeric_string\b)' | xargs perl -i -pe 's/\bmbedtls_oid_get_(?!numeric_string\b)/mbedtls_x509_oid_get_/'
./framework/scripts/code_style.py --since HEAD~1 --fix
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
86a47f85fa Switch to "x509_oid.h" in code that uses OID functions
Keep "mbedtls/oid.h" in code that only uses OID macros.

```
git grep -l mbedtls_oid_ '**/*.[hc]' tests/suites/*.function | xargs perl -i -pe 's!["<]mbedtls/oid\.h[">]!"x509_oid.h"!g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
b9d728467a Fix calling config.py and update comment
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-02 17:22:53 +02:00
8e5ee478e1 Add temporary component for SHA3 testing
With the removal of MBEDTLS_SHA3_C the test cases with disabled SHA3
dependency are never executed. Adding a temporary `all.sh` component
which disabling the `PSA_WANT_ALG_SHA3_*` macros to cover
these test cases.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2025-06-02 13:28:39 +02:00
6edb76cba4 mbedtls_test_ssl_endpoint_init: split configuration and setup
Split `mbedtls_test_ssl_endpoint_init()` into two separate stages:
constructing the SSL configuration, and setting up an SSL session context
with that configuration.

No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-01 21:53:52 +02:00
00eb072846 mbedtls_test_ssl_endpoint_init: store user_data_n in the endpoint object
This will allow splitting the configuration and setup stages of
`mbedtls_test_ssl_endpoint_init()`, while still checking that the value is
carried over from the configuration to the session context.

No behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-01 21:52:30 +02:00