blob: c7d0b0c3b446b1b69bc34917139da8aa14e0b713 [file] [log] [blame] [view]
Ronald Cron9228e4a2025-10-05 16:25:43 +02001## CMake as the only build system
Ronald Crona5e1b6d2025-10-08 09:10:54 +02002Mbed TLS now uses CMake exclusively to configure and drive its build process.
3Support for the GNU Make and Microsoft Visual Studio project-based build systems has been removed.
Ronald Cron9228e4a2025-10-05 16:25:43 +02004
Ronald Crona5e1b6d2025-10-08 09:10:54 +02005The previous `.sln` and `.vcxproj` files are no longer distributed or generated.
Ronald Cron9228e4a2025-10-05 16:25:43 +02006
Ronald Crona5e1b6d2025-10-08 09:10:54 +02007See the `Compiling` section in README.md for instructions on building the Mbed TLS libraries and tests with CMake.
Ronald Cron9228e4a2025-10-05 16:25:43 +02008If you develop in Microsoft Visual Studio, you could either generate a Visual Studio solution using a CMake generator, or open the CMake project directly in Visual Studio.
9
10## Repository split
11In Mbed TLS 4.0, the project was split into two repositories:
12- [Mbed TLS](https://github.com/Mbed-TLS/mbedtls): provides TLS and X.509 functionality.
13- [TF-PSA-Crypto](https://github.com/Mbed-TLS/TF-PSA-Crypto): provides the standalone cryptography library, implementing the PSA Cryptography API.
14Mbed TLS consumes TF-PSA-Crypto as a submodule.
Ronald Cronc7646242025-10-08 09:59:01 +020015You should stay with Mbed TLS if you use TLS or X.509 functionality. You still have direct access to the cryptography library.
Ronald Cron9228e4a2025-10-05 16:25:43 +020016
17### File and directory relocations
18
19The following table summarizes the file and directory relocations resulting from the repository split between Mbed TLS and TF-PSA-Crypto.
20These changes reflect the move of cryptographic, cryptographic-adjacent, and platform components from Mbed TLS into the new TF-PSA-Crypto repository.
21
Ronald Crond3f02cd2025-10-08 09:52:59 +020022| Original location | New location(s) | Notes |
23|-----------------------------------------|--------------------------------------------------------------------------------------|-------|
24| `library/*` (\*) | `tf-psa-crypto/core/`<br>`tf-psa-crypto/drivers/builtin/src/` | Contains cryptographic, cryptographic-adjacent (e.g., ASN.1, Base64), and platform C modules and headers. |
25| `include/mbedtls/*` (\*) | `tf-psa-crypto/include/mbedtls/`<br>`tf-psa-crypto/drivers/builtin/include/private/` | Public headers moved to `include/mbedtls`; now internal headers moved to `include/private`. |
26| `include/psa` | `tf-psa-crypto/include/psa` | All PSA headers consolidated here. |
27| `3rdparty/everest`<br>`3rdparty/p256-m` | `tf-psa-crypto/drivers/everest`<br>`tf-psa-crypto/drivers/p256-m` | Third-party crypto driver implementations. |
Ronald Cron9228e4a2025-10-05 16:25:43 +020028
Ronald Crond3f02cd2025-10-08 09:52:59 +020029(\*) The `library` and `include/mbedtls` directories still exist in Mbed TLS, but not contain only TLS and X.509 components.
Ronald Cron9228e4a2025-10-05 16:25:43 +020030
31### Configuration file split
Ronald Cron79a26312025-10-08 11:29:52 +020032Cryptography and platform configuration options have been moved from `include/mbedtls/mbedtls_config.h` to `tf-psa-crypto/include/psa/crypto_config.h`, which is now mandatory.
33See [Compile-time configuration](#compile-time-configuration).
34
35The header `include/mbedtls/mbedtls_config.h` still exists and now contains only the TLS and X.509 configuration options.
36
37If you use the Python script `scripts/config.py` to adjust your configuration, you do not need to modify your scripts to specify which configuration file to edit, the script automatically updates the correct file.
38
39There has been significant changes in the configuration options, primarily affecting cryptography.
40
41#### Cryptography configuration
42- See [psa-transition.md](https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/development/docs/psa-transition.md#compile-time-configuration).
43- See also the following sections in the TF-PSA-Crypto 1.0 migration guide:
44 - *PSA as the Only Cryptography API* and its sub-section *Impact on the Library Configuration*
45 - *Random Number Generation Configuration*
46
47#### TLS configuration
48For details about TLS-related changes, see [Changes to TLS options](#changes-to-tls-options).
Ronald Cron9228e4a2025-10-05 16:25:43 +020049
50### Impact on some usages of the library
51
52#### Checking out a branch or a tag
53After checking out a branch or tag of the Mbed TLS repository, you must now recursively update the submodules, as TF-PSA-Crypto contains itself a nested submodule:
54```
55git submodule update --init --recursive
56```
57
58#### Linking directly to a built library
59The Mbed TLS CMake build system still provides the cryptography libraries under their legacy name, `libmbedcrypto.<ext>`, so you can continue linking against them.
60The cryptography libraries are also now provided as `libtfpsacrypto.<ext>` like in the TF-PSA-Crypto repository.
61
62#### Linking through a CMake target of the cryptography library
63The base name of the CMake cryptography library target has been changed from `mbedcrypto` to `tfpsacrypto`.
64If no target prefix is specified through the MBEDTLS_TARGET_PREFIX option, the associated CMake target is thus now `tfpsacrypto`.
65
66The same renaming applies to the cryptography library targets declared as part of the Mbed TLS CMake package.
67When no global target prefix is defined, use `MbedTLS::tfpsacrypto` instead of `MbedTLS::mbedcrypto`.
68
69As an example, the following CMake code:
70```
71find_package(MbedTLS REQUIRED)
72target_link_libraries(myapp PRIVATE MbedTLS::mbedtls MbedTLS::mbedx509 MbedTLS::mbedcrypto)
73
74```
75would be updated to something like
76```
77find_package(MbedTLS REQUIRED)
78target_link_libraries(myapp PRIVATE MbedTLS::mbedtls MbedTLS::mbedx509 MbedTLS::tfpsacrypto)
79```
80
81For more information, see the CMake section of `README.md`.
82You can also refer to the following example programs demonstrating how to consume Mbed TLS via CMake:
83* `programs/test/cmake_subproject`
84* `programs/test/cmake_package`
85* `programs/test/cmake_package_install`.
86
87#### Using Mbed TLS Crypto pkg-config file
88The Mbed TLS CMake build system still provides the pkg-config file mbedcrypto.pc, so you can continue using it. Internally, it now references the `tfpsacrypto` library.
Ronald Cronc7646242025-10-08 09:59:01 +020089A new pkg-config file, `tfpsacrypto.pc`, is also provided.
Ronald Cron9228e4a2025-10-05 16:25:43 +020090Both `mbedcrypto.pc` and `tfpsacrypto.pc` are functionally equivalent, providing the same compiler and linker flags.
91
92### Audience-Specific Notes
93
94#### Application Developers using a distribution package
Ronald Cron9228e4a2025-10-05 16:25:43 +020095- See [Impact on usages of the library](#impact-on-some-usages-of-the-library) for the possible impacts on:
96 - Linking against the cryptography library or CMake targets.
97 - Use the updated `pkg-config` files (`mbedcrypto.pc` / `tfpsacrypto.pc`).
98
99### Developer or package maintainers
100If you build or distribute Mbed TLS:
101- The build system is now CMake only, Makefiles and Visual Studio projects are removed.
102- You may need to adapt packaging scripts to handle the TF-PSA-Crypto submodule.
103- You should update submodules recursively after checkout.
104- Review [File and directory relocations](#file-and-directory-relocations) for updated paths.
105- See [Impact on usages of the library](#impact-on-some-usages-of-the-library) for the possible impacts on:
106 - Linking against the cryptography library or CMake targets.
107 - Use the updated `pkg-config` files (`mbedcrypto.pc` / `tfpsacrypto.pc`).
108- Configuration note: cryptography and platform options are now in `crypto_config.h` (see [Configuration file split](#configuration-file-split)).
109
110### Platform Integrators
111If you integrate Mbed TLS with a platform or hardware drivers:
112- TF-PSA-Crypto is now a submodule, update integration scripts to initialize submodules recursively.
113- The PSA driver wrapper is now generated in TF-PSA-Crypto.
114- Platform-specific configuration are now handled in `crypto_config.h`.
115- See [Repository split](#repository-split) for how platform components moved to TF-PSA-Crypto.