1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00
Commit Graph

13676 Commits

Author SHA1 Message Date
Anton Matkin
72d6030f89 Combine psa_pake_set_password_key and psa_pake_setup into a single function
Signed-off-by: Anton Matkin <anton.matkin@arm.com>
2025-08-01 09:21:17 +02:00
Gilles Peskine
3e23cdc754 Merge pull request #10313 from ronald-cron-arm/dependency-on-generated-files-dev
cmake: library: Fix potential concurrent file generation
2025-07-30 11:44:18 +00:00
Gilles Peskine
db99ca95a7 Merge remote-tracking branch 'development' into dependency-on-generated-files-dev 2025-07-30 11:16:34 +02:00
Gilles Peskine
bb9ca493a1 Merge pull request #10271 from bjwtaylor/new-mbedtls_pk_sigalg_t
Update functions to use alias
2025-07-30 08:09:59 +00:00
Ben Taylor
73b3987291 Correct rebase and add in additional type cast
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-29 07:54:44 +01:00
Ben Taylor
d3ae1701f3 Remove pragmas and use alias
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-29 07:54:44 +01:00
Ben Taylor
1c1535f153 Make pragmas more specific
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-29 07:54:43 +01:00
Ben Taylor
04b03d7712 Replace Werror removal with pragma
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-29 07:54:43 +01:00
Gilles Peskine
1819a915bc Include limits.h where needed
This will be needed when TF-PSA-Crypto's `build_info.h` stops including
`limits.h`, which it currently does by accident because it includes
`check_config.h` which wants `limits.h` to check `CHAR_BIT`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-07-28 15:45:12 +02:00
Gilles Peskine
ac637ac9f8 Make check_config.h private
`check_config.h` only needs to run once on the configuration. It doesn't
need to run every time an application is built. It used to be public up to
Mbed TLS 2.x because it was included from `config.h`, and users could
substitute that file completely and should still include `check_config.h`
from their file. But since Mbed TLS 3.x, including `check_config.h` is a
purely internal thing (done in `build_info.h`). So make the file itself
purely internal.

We don't need to include `check_config.h` when building every library file,
just one: `mbedtls_config.c`, that's its job.

Give the file a unique name, to avoid any clashes with TF-PSA-Crypto's
`check_config.h`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-07-28 15:45:12 +02:00
Gilles Peskine
018e09872d New source file for configuration checks
This will be populated in subsequent commits.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-07-28 15:45:12 +02:00
Ronald Cron
8719c2f00b ssl_misc.h: Update PKCS1 dependencies
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-07-24 08:42:16 +02:00
Bence Szépkúti
27125ceacf Update references to tf-psa-crypto/core/common.h
This commit was generated using the following command:

sed -i 's/\(^\|[^_]\)common\.h/\1tf_psa_crypto_common.h/g' \
    $(git ls-files .                                       \
        ':!:programs/fuzz'                                 \
        ':!:tests/psa-client-server'                       \
        ':!:tf-psa-crypto'                                 \
        ':!:framework')                                    \
    $(git grep -l 'tf-psa-crypto/core/common.h')

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-07-21 20:02:30 +02:00
Ronald Cron
a2c37b3b2d cmake: library: Add custom targets for generated files
Add a custom target that depends on TLS
generated files, and make both the static and
shared crypto libraries depend on it.

This ensures that when both libraries are built,
the files are not generated concurrently
by the static and shared library targets.

Do the same for the x509 libraries.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-07-21 09:49:14 +02:00
Ronald Cron
ed4a10661c cmake: library: Remove unnecessary link_to_source
If we do not generate error.c, version_features.c, ...
then they are supposed to be in the source tree.
The CMake build get them from here and there is no
need for a symbolic link or a copy in the build tree.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-07-21 09:48:29 +02:00
Ben Taylor
0de87611bb Remove additional calls to mbedtls_pk_verify_ext
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-21 07:53:15 +01:00
Ben Taylor
306ffd3a36 Switch to mbedtls_pk_verify_new
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-21 07:53:15 +01:00
Ben Taylor
1030f80a0b Add private include to additional files
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2025-07-17 15:22:08 +01:00
Minos Galanakis
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
Manuel Pégourié-Gonnard
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
Minos Galanakis
09dc57d323 Version Bump
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-06-27 12:17:28 +01:00
Minos Galanakis
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
Valerio Setti
e0fb40e6fb library: debug: add error log message in mbedtls_debug_print_psa_rsa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:03 +02:00
Valerio Setti
069617fdce library: debug: improve input param check in mbedtls_debug_print_psa_rsa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
Valerio Setti
0c92466bb0 library: debug: rename len as bitlen in mbedtls_debug_print_integer()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
Valerio Setti
a18627a625 library: debug: add comment to explain no-code-check comments
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
Valerio Setti
1e4423bcfa library: debug: add comment for follow-up in mbedtls_debug_print_psa_rsa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
Valerio Setti
6676f72a5f library: debug: rename mbedtls_debug_print_ec_coord()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
Valerio Setti
3388c4acee library: debug: add support for RSA keys in PSA friendly format
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-25 10:25:02 +02:00
David Horstmann
8e95ba94c6 Merge pull request #10214 from ariwo17/fix-typo
Fixed some minor typos in comments.
2025-06-23 16:33:45 +00:00
Gilles Peskine
2180a7e5d3 Merge pull request #10240 from valeriosetti/prereq-for-psa298
library: Makefile: use wildcard to select sources for crypto library
2025-06-20 14:01:51 +00:00
Valerio Setti
06d64ad6a0 library: Makefile: use wildcard to select sources for crypto library
This gives the possibility to add new source files in tf-psa-crypto
library without any need to update this Makefile.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-20 13:45:57 +02:00
Felix Conway
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
Felix Conway
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
Valerio Setti
eaf578978e library: remove ECDSA_C dependency from ECP_RESTARTABLE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-12 06:37:29 +02:00
Valerio Setti
c394fd0ebc library: debug: replace MBEDTLS_PK_USE_PSA_EC_DATA with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY
MBEDTLS_PK_USE_PSA_EC_DATA is a legacy symbol that is used in 3.6 LTS
branch, but now it is assumed to be always true. It's only kept for
legacy reasons so it's better to replace it with
PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY instead.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-12 06:35:45 +02:00
Valerio Setti
ae89dcc4be library: tls12: remove usage of MBEDTLS_PK_USE_PSA_EC_DATA
PK module will now always use PSA storing pattern when working with
EC keys therefore MBEDTLS_PK_USE_PSA_EC_DATA is assumed to be always
enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-06-12 06:21:30 +02:00
Ari Weiler-Ofek
67aa959ea1 Fixed some minor typos in comments.
Signed-off-by: Ari Weiler-Ofek <ari.weiler-ofek@arm.com>
2025-06-10 16:59:44 +01:00
Gilles Peskine
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
Gilles Peskine
7e7dc6fdda Align endif comments with auxiliary macros
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
Gilles Peskine
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
Gilles Peskine
6354411670 Remove unused function
mbedtls_oid_get_md_alg() is used in X.509, but
mbedtls_oid_get_oid_by_md() is only used in crypto.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
Gilles Peskine
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
Gilles Peskine
71ccc723cd Remove macros for crypto OID
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00
Gilles Peskine
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
Gilles Peskine
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
Gilles Peskine
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
Gilles Peskine
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
Gilles Peskine
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
Gilles Peskine
d2fe51cfc4 Add the x509_oid module to the build
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-06-03 15:51:34 +02:00