Ron Eldor | c7acb91 | 2017-10-30 17:03:57 +0200 | [diff] [blame] | 1 | README for Mbed TLS |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 2 | =================== |
| 3 | |
Ronald Cron | d196cbd | 2025-09-30 09:58:08 +0200 | [diff] [blame] | 4 | Mbed TLS is a C library that implements X.509 certificate manipulation and the TLS and DTLS protocols. Its small code footprint makes it suitable for embedded systems. |
| 5 | Mbed TLS includes the [TF-PSA-Crypto repository](https://github.com/Mbed-TLS/TF-PSA-Crypto) that provides an implementation of the [PSA Cryptography API](https://arm-software.github.io/psa-api). |
Gilles Peskine | da5abbf | 2020-03-09 18:51:37 +0100 | [diff] [blame] | 6 | |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 7 | Configuration |
| 8 | ------------- |
Ronald Cron | 0f2ef4a | 2025-09-30 18:30:32 +0200 | [diff] [blame] | 9 | Configuration options related to X.509 and TLS are available in `include/mbedtls/mbedtls_config.h`, while cryptography and platform options are located in the TF-PSA-Crypto configuration file `tf-psa-crypto/include/psa/crypto_config.h`. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 10 | |
Ronald Cron | 0f2ef4a | 2025-09-30 18:30:32 +0200 | [diff] [blame] | 11 | With the default platform options, Mbed TLS should build out of the box on most systems. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 12 | |
Ronald Cron | 0f2ef4a | 2025-09-30 18:30:32 +0200 | [diff] [blame] | 13 | These configuration files can be edited manually, or programmatically using the Python 3 script scripts/config.py (run with --help for usage instructions). |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 14 | |
Ronald Cron | 0f2ef4a | 2025-09-30 18:30:32 +0200 | [diff] [blame] | 15 | We provide some non-standard configurations focused on specific use cases in the `configs/` directory. You can read more about those in `configs/README.txt`. |
Gilles Peskine | b05d89d | 2020-03-09 19:23:51 +0100 | [diff] [blame] | 16 | |
Gilles Peskine | a10cbda | 2020-03-09 19:21:51 +0100 | [diff] [blame] | 17 | Documentation |
| 18 | ------------- |
| 19 | |
Dave Rodgman | 7c19516 | 2022-10-12 16:27:14 +0100 | [diff] [blame] | 20 | The main Mbed TLS documentation is available via [ReadTheDocs](https://mbed-tls.readthedocs.io/). |
| 21 | |
Gilles Peskine | a10cbda | 2020-03-09 19:21:51 +0100 | [diff] [blame] | 22 | To generate a local copy of the library documentation in HTML format, tailored to your compile-time configuration: |
| 23 | |
Dave Rodgman | 2f458d3 | 2021-06-03 17:58:13 +0100 | [diff] [blame] | 24 | 1. Make sure that [Doxygen](http://www.doxygen.nl/) is installed. |
Ronald Cron | 200b89b | 2025-10-01 10:05:34 +0200 | [diff] [blame] | 25 | 1. Run `cmake -B /path/to/build_dir /path/to/mbedtls/source` |
| 26 | 1. Run `cmake --build /path/to/build_dir --target mbedtls-apidoc` |
Gilles Peskine | a10cbda | 2020-03-09 19:21:51 +0100 | [diff] [blame] | 27 | 1. Browse `apidoc/index.html` or `apidoc/modules.html`. |
| 28 | |
Manuel Pégourié-Gonnard | 80c02af | 2021-02-25 12:34:58 +0100 | [diff] [blame] | 29 | For other sources of documentation, see the [SUPPORT](SUPPORT.md) document. |
| 30 | |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 31 | Compiling |
| 32 | --------- |
| 33 | |
Ronald Cron | 7cf78b4 | 2025-10-01 10:28:17 +0200 | [diff] [blame] | 34 | We use CMake to configure and drive our build process. Three libraries are built: `libtfpsacrypto`, `libmbedx509`, and `libmbedtls`. Note that `libmbedtls` depends on `libmbedx509` and `libtfpsacrypto`, and `libmbedx509` depends on `libtfpsacrypto`. As a result, some linkers will expect flags to be in a specific order, for example the GNU linker wants `-lmbedtls -lmbedx509 -ltfpsacrypto`. The cryptographic library `libtfpsacrypto` is also provided under its legacy name, `libmbedcrypto`. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 35 | |
Gilles Peskine | 6769870 | 2020-03-09 19:30:08 +0100 | [diff] [blame] | 36 | ### Tool versions |
| 37 | |
Ronald Cron | 4ccdaf1 | 2025-10-01 12:40:27 +0200 | [diff] [blame^] | 38 | You need the following tools to build the library from the main branch with the provided CMake files. Mbed TLS minimum tool version requirements are set based on the versions shipped in the latest or penultimate (depending on the release cadence) long-term support releases of major Linux distributions, namely at time of writing: Ubuntu 22.04, RHEL 9, and SLES 15 SP4. |
Gilles Peskine | 6769870 | 2020-03-09 19:30:08 +0100 | [diff] [blame] | 39 | |
Ronald Cron | 4ccdaf1 | 2025-10-01 12:40:27 +0200 | [diff] [blame^] | 40 | * CMake 3.20.4 or later. |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 41 | * A build system that CMake supports. |
Bence Szépkúti | ae0d97a | 2024-03-12 17:23:01 +0100 | [diff] [blame] | 42 | * A C99 toolchain (compiler, linker, archiver). We actively test with GCC 5.4, Clang 3.8, Arm Compiler 6, IAR 8 and Visual Studio 2017. More recent versions should work. Slightly older versions may work. |
Ronald Cron | d196cbd | 2025-09-30 09:58:08 +0200 | [diff] [blame] | 43 | * Python 3.8 to generate the test code. Python is also needed to build the development branch (see next section). |
Gilles Peskine | d05a588 | 2021-05-17 23:57:42 +0200 | [diff] [blame] | 44 | * Perl to run the tests, and to generate some source files in the development branch. |
Ronald Cron | 4ccdaf1 | 2025-10-01 12:40:27 +0200 | [diff] [blame^] | 45 | * Doxygen 1.8.14 or later (if building the documentation; slightly older versions should work). |
Gilles Peskine | d05a588 | 2021-05-17 23:57:42 +0200 | [diff] [blame] | 46 | |
Gilles Peskine | 0c3f0e9 | 2024-03-04 15:54:54 +0100 | [diff] [blame] | 47 | ### Git usage |
| 48 | |
Gilles Peskine | 93b2822 | 2024-03-13 13:08:57 +0100 | [diff] [blame] | 49 | The `development` branch and the `mbedtls-3.6` long-term support branch of Mbed TLS use a [Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules#_cloning_submodules) ([framework](https://github.com/Mbed-TLS/mbedtls-framework)). This is not needed to merely compile the library at a release tag. This is not needed to consume a release archive (zip or tar). |
Gilles Peskine | 0c3f0e9 | 2024-03-04 15:54:54 +0100 | [diff] [blame] | 50 | |
Gilles Peskine | d05a588 | 2021-05-17 23:57:42 +0200 | [diff] [blame] | 51 | ### Generated source files in the development branch |
| 52 | |
| 53 | The source code of Mbed TLS includes some files that are automatically generated by scripts and whose content depends only on the Mbed TLS source, not on the platform or on the library configuration. These files are not included in the development branch of Mbed TLS, but the generated files are included in official releases. This section explains how to generate the missing files in the development branch. |
| 54 | |
| 55 | The following tools are required: |
| 56 | |
Ronald Cron | eef87b3 | 2025-09-30 13:06:32 +0200 | [diff] [blame] | 57 | * Perl, for some library source files. |
Ronald Cron | 4ccdaf1 | 2025-10-01 12:40:27 +0200 | [diff] [blame^] | 58 | * Python 3 and some Python packages, for some library source files, sample programs and test data. To install the necessary packages, run: |
Gilles Peskine | 87485a3 | 2021-11-17 19:17:03 +0100 | [diff] [blame] | 59 | ``` |
Gilles Peskine | 429e901 | 2023-03-07 20:40:04 +0100 | [diff] [blame] | 60 | python3 -m pip install --user -r scripts/basic.requirements.txt |
Gilles Peskine | 87485a3 | 2021-11-17 19:17:03 +0100 | [diff] [blame] | 61 | ``` |
Gilles Peskine | 429e901 | 2023-03-07 20:40:04 +0100 | [diff] [blame] | 62 | Depending on your Python installation, you may need to invoke `python` instead of `python3`. To install the packages system-wide, omit the `--user` option. |
Gilles Peskine | d05a588 | 2021-05-17 23:57:42 +0200 | [diff] [blame] | 63 | * A C compiler for the host platform, for some test data. |
| 64 | |
David Horstmann | 24e3388 | 2025-08-19 16:56:25 +0100 | [diff] [blame] | 65 | The scripts that generate the configuration-independent files will look for a host C compiler in the following places (in order of preference): |
| 66 | |
| 67 | 1. The `HOSTCC` environment variable. This can be used if `CC` is pointing to a cross-compiler. |
| 68 | 2. The `CC` environment variable. |
| 69 | 3. An executable called `cc` in the current path. |
| 70 | |
| 71 | Note: If you have multiple toolchains installed, it is recommended to set `CC` or `HOSTCC` to the intended host compiler before generating the files. |
Gilles Peskine | d05a588 | 2021-05-17 23:57:42 +0200 | [diff] [blame] | 72 | |
| 73 | Any of the following methods are available to generate the configuration-independent files: |
| 74 | |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 75 | * On non-Windows systems, when not cross-compiling, CMake generates the required files automatically. |
| 76 | * Run `framework/scripts/make_generated_files.py` to generate all the configuration-independent files. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 77 | |
| 78 | ### CMake |
| 79 | |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 80 | In order to build the libraries using CMake in a separate directory (recommended), just enter at the command line: |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 81 | |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 82 | mkdir /path/to/build_dir && cd /path/to/build_dir |
| 83 | cmake /path/to/mbedtls_source |
Carlos Gomes Martinho | 227a9db | 2020-04-03 09:42:57 +0200 | [diff] [blame] | 84 | cmake --build . |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 85 | |
| 86 | In order to run the tests, enter: |
| 87 | |
Carlos Gomes Martinho | 227a9db | 2020-04-03 09:42:57 +0200 | [diff] [blame] | 88 | ctest |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 89 | |
Ron Eldor | 276bd00 | 2019-01-17 17:51:55 -0600 | [diff] [blame] | 90 | The test suites need Python to be built and Perl to be executed. If you don't have one of these installed, you'll want to disable the test suites with: |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 91 | |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 92 | cmake -DENABLE_TESTING=Off /path/to/mbedtls_source |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 93 | |
| 94 | If you disabled the test suites, but kept the programs enabled, you can still run a much smaller set of tests with: |
| 95 | |
| 96 | programs/test/selftest |
| 97 | |
| 98 | To configure CMake for building shared libraries, use: |
| 99 | |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 100 | cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On /path/to/mbedtls_source |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 101 | |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 102 | There are many different build types available with CMake. Most of them are available for gcc and clang, though some are compiler-specific: |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 103 | |
Gilles Peskine | b21a085 | 2018-03-09 14:24:36 +0100 | [diff] [blame] | 104 | - `Release`. This generates the default code without any unnecessary information in the binary files. |
| 105 | - `Debug`. This generates debug information and disables optimization of the code. |
| 106 | - `Coverage`. This generates code coverage information in addition to debug information. |
| 107 | - `ASan`. This instruments the code with AddressSanitizer to check for memory errors. (This includes LeakSanitizer, with recent version of gcc and clang.) (With recent version of clang, this mode also instruments the code with UndefinedSanitizer to check for undefined behaviour.) |
| 108 | - `ASanDbg`. Same as ASan but slower, with debug information and better stack traces. |
Ronald Cron | 7cf78b4 | 2025-10-01 10:28:17 +0200 | [diff] [blame] | 109 | - `MemSan`. This instruments the code with MemorySanitizer to check for uninitialised memory reads. |
Gilles Peskine | b21a085 | 2018-03-09 14:24:36 +0100 | [diff] [blame] | 110 | - `MemSanDbg`. Same as MemSan but slower, with debug information, better stack traces and origin tracking. |
| 111 | - `Check`. This activates the compiler warnings that depend on optimization and treats all warnings as errors. |
Ronald Cron | 7cf78b4 | 2025-10-01 10:28:17 +0200 | [diff] [blame] | 112 | - `TSan`. This instruments the code with ThreadSanitizer to detect data races and other threading-related concurrency issues at runtime. |
| 113 | - `TSanDbg`. Same as TSan but slower, with debug information, better stack traces and origin tracking. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 114 | |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 115 | Switching build types in CMake is simple. For debug mode, enter at the command line: |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 116 | |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 117 | cmake -D CMAKE_BUILD_TYPE=Debug /path/to/mbedtls_source |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 118 | |
| 119 | To list other available CMake options, use: |
| 120 | |
| 121 | cmake -LH |
| 122 | |
Manuel Pégourié-Gonnard | 976dd16 | 2018-01-02 10:49:46 +0100 | [diff] [blame] | 123 | Note that, with CMake, you can't adjust the compiler or its flags after the |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 124 | initial invocation of cmake. This means that `CC=your_cc make` and `make |
| 125 | CC=your_cc` will *not* work (similarly with `CFLAGS` and other variables). |
| 126 | These variables need to be adjusted when invoking cmake for the first time, |
| 127 | for example: |
| 128 | |
| 129 | CC=your_cc cmake /path/to/mbedtls_source |
| 130 | |
| 131 | If you already invoked cmake and want to change those settings, you need to |
| 132 | remove the build directory and create it again. |
| 133 | |
| 134 | Note that it is possible to build in-place; this will however overwrite the |
Ronald Cron | ee63b64 | 2025-08-29 16:14:19 +0200 | [diff] [blame] | 135 | legacy Makefiles still used for testing purposes (see |
| 136 | `scripts/tmp_ignore_makefiles.sh` if you want to prevent `git status` from |
| 137 | showing them as modified). In order to do so, from the Mbed TLS source |
| 138 | directory, use: |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 139 | |
| 140 | cmake . |
| 141 | make |
| 142 | |
| 143 | If you want to change `CC` or `CFLAGS` afterwards, you will need to remove the |
| 144 | CMake cache. This can be done with the following command using GNU find: |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 145 | |
| 146 | find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 147 | |
Manuel Pégourié-Gonnard | 976dd16 | 2018-01-02 10:49:46 +0100 | [diff] [blame] | 148 | You can now make the desired change: |
Manuel Pégourié-Gonnard | b89c472 | 2017-12-26 12:52:53 +0100 | [diff] [blame] | 149 | |
| 150 | CC=your_cc cmake . |
| 151 | make |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 152 | |
Manuel Pégourié-Gonnard | 05c9271 | 2017-12-28 09:14:47 +0100 | [diff] [blame] | 153 | Regarding variables, also note that if you set CFLAGS when invoking cmake, |
| 154 | your value of CFLAGS doesn't override the content provided by cmake (depending |
| 155 | on the build mode as seen above), it's merely prepended to it. |
| 156 | |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 157 | #### Consuming Mbed TLS |
| 158 | |
| 159 | Mbed TLS provides a package config file for consumption as a dependency in other |
| 160 | CMake projects. You can include Mbed TLS's CMake targets yourself with: |
| 161 | |
| 162 | find_package(MbedTLS) |
| 163 | |
| 164 | If prompted, set `MbedTLS_DIR` to `${YOUR_MBEDTLS_INSTALL_DIR}/cmake`. This |
| 165 | creates the following targets: |
| 166 | |
Ronald Cron | 8126a68 | 2024-10-25 17:34:23 +0200 | [diff] [blame] | 167 | - `MbedTLS::tfpsacrypto` (Crypto library) |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 168 | - `MbedTLS::mbedtls` (TLS library) |
| 169 | - `MbedTLS::mbedx509` (X509 library) |
| 170 | |
| 171 | You can then use these directly through `target_link_libraries()`: |
| 172 | |
| 173 | add_executable(xyz) |
| 174 | |
| 175 | target_link_libraries(xyz |
| 176 | PUBLIC MbedTLS::mbedtls |
Ronald Cron | 8126a68 | 2024-10-25 17:34:23 +0200 | [diff] [blame] | 177 | MbedTLS::tfpsacrypto |
Chris Kay | d259e34 | 2021-03-25 16:03:25 +0000 | [diff] [blame] | 178 | MbedTLS::mbedx509) |
| 179 | |
| 180 | This will link the Mbed TLS libraries to your library or application, and add |
| 181 | its include directories to your target (transitively, in the case of `PUBLIC` or |
| 182 | `INTERFACE` link libraries). |
| 183 | |
Jaeden Amero | 41421c4 | 2019-06-20 17:26:29 +0100 | [diff] [blame] | 184 | #### Mbed TLS as a subproject |
| 185 | |
Manuel Pégourié-Gonnard | a4b99a2 | 2020-03-19 12:36:02 +0100 | [diff] [blame] | 186 | Mbed TLS supports being built as a CMake subproject. One can |
Jaeden Amero | 41421c4 | 2019-06-20 17:26:29 +0100 | [diff] [blame] | 187 | use `add_subdirectory()` from a parent CMake project to include Mbed TLS as a |
| 188 | subproject. |
| 189 | |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 190 | Example programs |
| 191 | ---------------- |
| 192 | |
Gilles Peskine | cf63f59 | 2020-03-09 19:24:18 +0100 | [diff] [blame] | 193 | We've included example programs for a lot of different features and uses in [`programs/`](programs/README.md). |
| 194 | Please note that the goal of these sample programs is to demonstrate specific features of the library, and the code may need to be adapted to build a real-world application. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 195 | |
| 196 | Tests |
| 197 | ----- |
| 198 | |
Ronald Cron | cf1af5a | 2024-07-12 19:32:58 +0200 | [diff] [blame] | 199 | Mbed TLS includes an elaborate test suite in `tests/` that initially requires Python to generate the tests files (e.g. `test\_suite\_ssl.c`). These files are generated from a `function file` (e.g. `suites/test\_suite\_ssl.function`) and a `data file` (e.g. `suites/test\_suite\_ssl.data`). The `function file` contains the test functions. The `data file` contains the test cases, specified as parameters that will be passed to the test function. |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 200 | |
| 201 | For machines with a Unix shell and OpenSSL (and optionally GnuTLS) installed, additional test scripts are available: |
| 202 | |
| 203 | - `tests/ssl-opt.sh` runs integration tests for various TLS options (renegotiation, resumption, etc.) and tests interoperability of these options with other implementations. |
| 204 | - `tests/compat.sh` tests interoperability of every ciphersuite with other implementations. |
| 205 | - `tests/scripts/test-ref-configs.pl` test builds in various reduced configurations. |
Andrzej Kurek | 29c002e | 2022-10-24 10:59:55 -0400 | [diff] [blame] | 206 | - `tests/scripts/depends.py` test builds in configurations with a single curve, key exchange, hash, cipher, or pkalg on. |
Bence Szépkúti | bb0cfeb | 2021-05-28 09:42:25 +0200 | [diff] [blame] | 207 | - `tests/scripts/all.sh` runs a combination of the above tests, plus some more, with various build options (such as ASan, full `mbedtls_config.h`, etc). |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 208 | |
Dave Rodgman | 0da8c51 | 2024-03-18 15:25:53 +0000 | [diff] [blame] | 209 | Instead of manually installing the required versions of all tools required for testing, it is possible to use the Docker images from our CI systems, as explained in [our testing infrastructure repository](https://github.com/Mbed-TLS/mbedtls-test/blob/main/README.md#quick-start). |
Manuel Pégourié-Gonnard | 59626b6 | 2022-12-15 10:08:26 +0100 | [diff] [blame] | 210 | |
Ron Eldor | c7acb91 | 2017-10-30 17:03:57 +0200 | [diff] [blame] | 211 | Porting Mbed TLS |
Andres AG | 1a6e9c3 | 2016-12-28 15:38:05 +0000 | [diff] [blame] | 212 | ---------------- |
| 213 | |
Simon Butcher | 6965f77 | 2018-07-23 23:57:07 +0100 | [diff] [blame] | 214 | Mbed TLS can be ported to many different architectures, OS's and platforms. Before starting a port, you may find the following Knowledge Base articles useful: |
Andres AG | 1a6e9c3 | 2016-12-28 15:38:05 +0000 | [diff] [blame] | 215 | |
Dave Rodgman | 7c19516 | 2022-10-12 16:27:14 +0100 | [diff] [blame] | 216 | - [Porting Mbed TLS to a new environment or OS](https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS/) |
| 217 | - [What external dependencies does Mbed TLS rely on?](https://mbed-tls.readthedocs.io/en/latest/kb/development/what-external-dependencies-does-mbedtls-rely-on/) |
| 218 | - [How do I configure Mbed TLS](https://mbed-tls.readthedocs.io/en/latest/kb/compiling-and-building/how-do-i-configure-mbedtls/) |
Andres AG | 1a6e9c3 | 2016-12-28 15:38:05 +0000 | [diff] [blame] | 219 | |
Minos Galanakis | c42cadb | 2021-12-09 13:16:54 +0000 | [diff] [blame] | 220 | Mbed TLS is mostly written in portable C99; however, it has a few platform requirements that go beyond the standard, but are met by most modern architectures: |
| 221 | |
Minos Galanakis | d7547fc | 2021-12-09 15:06:16 +0000 | [diff] [blame] | 222 | - Bytes must be 8 bits. |
minosgalanakis | 0f2a46c | 2021-12-09 15:38:39 +0000 | [diff] [blame] | 223 | - All-bits-zero must be a valid representation of a null pointer. |
Minos Galanakis | d7547fc | 2021-12-09 15:06:16 +0000 | [diff] [blame] | 224 | - Signed integers must be represented using two's complement. |
| 225 | - `int` and `size_t` must be at least 32 bits wide. |
| 226 | - The types `uint8_t`, `uint16_t`, `uint32_t` and their signed equivalents must be available. |
Dave Rodgman | 28f424f | 2022-12-01 09:49:44 +0000 | [diff] [blame] | 227 | - Mixed-endian platforms are not supported. |
Dave Rodgman | 37296a4 | 2023-02-10 15:39:22 +0000 | [diff] [blame] | 228 | - SIZE_MAX must be at least as big as INT_MAX and UINT_MAX. |
Minos Galanakis | c42cadb | 2021-12-09 13:16:54 +0000 | [diff] [blame] | 229 | |
Dan Handley | c76a545 | 2020-02-18 17:58:20 +0000 | [diff] [blame] | 230 | License |
| 231 | ------- |
| 232 | |
Dave Rodgman | 8ce5170 | 2023-11-02 17:36:49 +0000 | [diff] [blame] | 233 | Unless specifically indicated otherwise in a file, Mbed TLS files are provided under a dual [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) OR [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) license. See the [LICENSE](LICENSE) file for the full text of these licenses, and [the 'License and Copyright' section in the contributing guidelines](CONTRIBUTING.md#License-and-Copyright) for more information. |
Dan Handley | c76a545 | 2020-02-18 17:58:20 +0000 | [diff] [blame] | 234 | |
Manuel Pégourié-Gonnard | f851f14 | 2015-09-03 13:29:45 +0200 | [diff] [blame] | 235 | Contributing |
| 236 | ------------ |
| 237 | |
Dan Handley | c76a545 | 2020-02-18 17:58:20 +0000 | [diff] [blame] | 238 | We gratefully accept bug reports and contributions from the community. Please see the [contributing guidelines](CONTRIBUTING.md) for details on how to do this. |
Gilles Peskine | b6b15b2 | 2021-09-30 14:10:06 +0200 | [diff] [blame] | 239 | |
| 240 | Contact |
| 241 | ------- |
| 242 | |
| 243 | * To report a security vulnerability in Mbed TLS, please email <mbed-tls-security@lists.trustedfirmware.org>. For more information, see [`SECURITY.md`](SECURITY.md). |
Dave Rodgman | 017a199 | 2022-03-31 14:07:01 +0100 | [diff] [blame] | 244 | * To report a bug or request a feature in Mbed TLS, please [file an issue on GitHub](https://github.com/Mbed-TLS/mbedtls/issues/new/choose). |
Gilles Peskine | b6b15b2 | 2021-09-30 14:10:06 +0200 | [diff] [blame] | 245 | * Please see [`SUPPORT.md`](SUPPORT.md) for other channels for discussion and support about Mbed TLS. |