| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 1 | Migrating from Mbed TLS 2.x to Mbed TLS 3.0 | 
|  | 2 | =========================================== | 
|  | 3 |  | 
|  | 4 | This guide details the steps required to migrate from Mbed TLS version 2.x to | 
|  | 5 | Mbed TLS version 3.0 or greater. Unlike normal releases, Mbed TLS 3.0 breaks | 
|  | 6 | compatibility with previous versions, so users (and alt implementors) might | 
|  | 7 | need to change their own code in order to make it work with Mbed TLS 3.0. | 
|  | 8 |  | 
|  | 9 | Here's the list of breaking changes; each entry should help you answer these | 
|  | 10 | two questions: (1) am I affected? (2) if yes, what's my migration path? | 
|  | 11 |  | 
|  | 12 | Some function parameters were made const | 
|  | 13 | ---------------------------------------- | 
|  | 14 |  | 
|  | 15 | Various functions in the PK and ASN.1 modules had a `const` qualifier added to | 
|  | 16 | some of their parameters. | 
|  | 17 |  | 
|  | 18 | This normally doesn't affect your code, unless you use pointers to reference | 
|  | 19 | those functions. In this case, you'll need to update the type of your pointers | 
|  | 20 | in order to match the new signature. | 
|  | 21 |  | 
|  | 22 | Deprecated functions were removed from hashing modules | 
|  | 23 | ------------------------------------------------------ | 
|  | 24 |  | 
| TRodziewicz | f41dc7c | 2021-06-21 13:27:29 +0200 | [diff] [blame] | 25 | Modules: MD5, SHA1, SHA256, SHA512, MD. | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 26 |  | 
|  | 27 | - The functions `mbedtls_xxx_starts()`, `mbedtls_xxx_update()`, | 
|  | 28 | `mbedtls_xxx_finish()` and `mbedtls_xxx()` were removed. Please use the | 
|  | 29 | function with the same name with `_ret` appended and check the return value. | 
|  | 30 | - The function `mbedtls_md_init_ctx()` was removed; please use | 
|  | 31 | `mbedtls_md_setup()` instead. | 
|  | 32 | - The functions `mbedtls_xxx_process()` were removed. You normally don't need | 
| Manuel Pégourié-Gonnard | 143b1e3 | 2021-05-05 09:46:01 +0200 | [diff] [blame] | 33 | to call that from application code. However if you do (or if you want to | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 34 | provide your own version of that function), please use | 
|  | 35 | `mbedtls_internal_xxx_process()` instead, and check the return value. | 
|  | 36 |  | 
|  | 37 | Deprecated error codes for hardware failures were removed | 
|  | 38 | --------------------------------------------------------- | 
|  | 39 |  | 
|  | 40 | - The macros `MBEDTLS_ERR_xxx_FEATURE_UNSUPPORTED` from various crypto modules | 
|  | 41 | were removed; `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` is now used | 
|  | 42 | instead. | 
|  | 43 | - The macros `MBEDTLS_ERR_xxx_HW_ACCEL_FAILED` from various crypto modules | 
|  | 44 | were removed; `MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED` is now used instead. | 
|  | 45 |  | 
|  | 46 | Deprecated names for PSA constants and types were removed | 
|  | 47 | --------------------------------------------------------- | 
|  | 48 |  | 
| Manuel Pégourié-Gonnard | 2960b2e | 2021-04-26 09:57:36 +0200 | [diff] [blame] | 49 | Some constants and types that were present in beta versions of the PSA Crypto | 
| Manuel Pégourié-Gonnard | 143b1e3 | 2021-05-05 09:46:01 +0200 | [diff] [blame] | 50 | API were removed from version 1.0 of specification. Please switch to the new | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 51 | names provided by the 1.0 specification instead. | 
|  | 52 |  | 
|  | 53 | Internal / alt-focused headers were moved to a private location | 
|  | 54 | ---------------------------------------------------------------- | 
|  | 55 |  | 
|  | 56 | This shouldn't affect users who took care not to include headers that | 
|  | 57 | were documented as internal, despite being in the public include directory. | 
|  | 58 |  | 
|  | 59 | If you're providing alt implementations of ECP or RSA, you'll need to add our | 
|  | 60 | `library` directory to your include path when building your alt | 
|  | 61 | implementations, and note that `ecp_internal.h` and `rsa_internal.h` have been | 
| Gilles Peskine | 6a2fb61 | 2021-05-24 22:25:04 +0200 | [diff] [blame] | 62 | renamed to `ecp_internal_alt.h` and `rsa_alt_helpers.h` respectively. | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 63 |  | 
|  | 64 | If you're a library user and used to rely on having access to a structure or | 
|  | 65 | function that's now in a private header, please reach out on the mailing list | 
|  | 66 | and explain your need; we'll consider adding a new API in a future version. | 
|  | 67 |  | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 68 | Remove the certs module from the library | 
|  | 69 | ---------------------------------------- | 
|  | 70 |  | 
|  | 71 | This should not affect production use of the library, as the certificates and | 
|  | 72 | keys included there were never suitable for production use. | 
|  | 73 |  | 
|  | 74 | However it might affect you if you relied on them for testing purposes. In | 
|  | 75 | that case, please embed your own test certificates in your test code; now that | 
|  | 76 | `certs.c` is out of the library there is no longer any stability guaranteed | 
|  | 77 | and it may change in incompatible ways at any time. | 
|  | 78 |  | 
|  | 79 | Remove the HAVEGE module | 
|  | 80 | ------------------------ | 
|  | 81 |  | 
|  | 82 | This doesn't affect people using the default configuration as it was already | 
|  | 83 | disabled by default. | 
|  | 84 |  | 
|  | 85 | This only affects users who called the HAVEGE modules directly (not | 
| Manuel Pégourié-Gonnard | 143b1e3 | 2021-05-05 09:46:01 +0200 | [diff] [blame] | 86 | recommended), or users who used it through the entropy module but had it as the | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 87 | only source of entropy. If you're in that case, please declare OS or hardware | 
|  | 88 | RNG interfaces with `mbedtls_entropy_add_source()` and/or use an entropy seed | 
|  | 89 | file created securely during device provisioning. See | 
|  | 90 | <https://tls.mbed.org/kb/how-to/add-entropy-sources-to-entropy-pool> for more | 
|  | 91 | information. | 
|  | 92 |  | 
|  | 93 | Remove support for parsing SSLv2 ClientHello | 
|  | 94 | -------------------------------------------- | 
|  | 95 |  | 
|  | 96 | This doesn't affect people using the default configuration as it was already | 
|  | 97 | disabled by default. | 
|  | 98 |  | 
| Manuel Pégourié-Gonnard | 143b1e3 | 2021-05-05 09:46:01 +0200 | [diff] [blame] | 99 | This only affects TLS servers that have clients who send an SSLv2 ClientHello. | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 100 | These days clients are very unlikely to do that. If you have a client that | 
|  | 101 | does, please try contacting them and encouraging them to upgrade their | 
|  | 102 | software. | 
|  | 103 |  | 
|  | 104 | Remove support for SSL 3.0 | 
|  | 105 | -------------------------- | 
|  | 106 |  | 
|  | 107 | This doesn't affect people using the default configuration as it was already | 
|  | 108 | disabled by default. | 
|  | 109 |  | 
|  | 110 | This only affects TLS users who explicitly enabled `MBEDTLS_SSL_PROTO_SSL3` | 
|  | 111 | and relied on that version in order to communicate with peers that are not up | 
| Manuel Pégourié-Gonnard | 143b1e3 | 2021-05-05 09:46:01 +0200 | [diff] [blame] | 112 | to date. If one of your peers is in that case, please try contacting them and | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 113 | encouraging them to upgrade their software. | 
|  | 114 |  | 
| Thomas Daubney | 379227c | 2021-06-18 10:46:12 +0100 | [diff] [blame] | 115 | Remove support for truncated HMAC | 
|  | 116 | --------------------------------- | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 117 |  | 
| Thomas Daubney | ac84469 | 2021-06-18 14:08:56 +0100 | [diff] [blame] | 118 | This affects users of truncated HMAC, that is, users who called | 
|  | 119 | `mbedtls_ssl_conf_truncated_hmac( ..., MBEDTLS_SSL_TRUNC_HMAC_ENABLED)`, | 
|  | 120 | regardless of whether the standard version was used or compatibility version | 
|  | 121 | (`MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT`). | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 122 |  | 
| Thomas Daubney | ac84469 | 2021-06-18 14:08:56 +0100 | [diff] [blame] | 123 | The recommended migration path for people who want minimal overhead is to use a | 
|  | 124 | CCM-8 ciphersuite. | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 125 |  | 
|  | 126 | Remove support for TLS record-level compression | 
|  | 127 | ----------------------------------------------- | 
|  | 128 |  | 
|  | 129 | This doesn't affect people using the default configuration as it was already | 
|  | 130 | disabled by default. | 
|  | 131 |  | 
|  | 132 | This only affects TLS users who enabled `MBEDTLS_ZLIB_SUPPORT`. This will not | 
|  | 133 | cause any failures however if you used to enable TLS record-level compression | 
|  | 134 | you may find that your bandwidth usage increases without compression. There's | 
|  | 135 | no general solution to this problem; application protocols might have their | 
|  | 136 | own compression mechanisms and are in a better position than the TLS stack to | 
|  | 137 | avoid variants of the CRIME and BREACH attacks. | 
|  | 138 |  | 
|  | 139 | Remove support for TLS RC4-based ciphersuites | 
|  | 140 | --------------------------------------------- | 
|  | 141 |  | 
|  | 142 | This does not affect people who used the default `config.h` and the default | 
| Manuel Pégourié-Gonnard | 2960b2e | 2021-04-26 09:57:36 +0200 | [diff] [blame] | 143 | list of ciphersuites, as RC4-based ciphersuites were already not negotiated in | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 144 | that case. | 
|  | 145 |  | 
|  | 146 | Please switch to any of the modern, recommended ciphersuites (based on | 
|  | 147 | AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support | 
|  | 148 | any, encourage them to upgrade their software. | 
|  | 149 |  | 
|  | 150 | Remove support for TLS single-DES ciphersuites | 
|  | 151 | ---------------------------------------------- | 
|  | 152 |  | 
|  | 153 | This doesn't affect people using the default configuration as it was already | 
|  | 154 | disabled by default. | 
|  | 155 |  | 
|  | 156 | Please switch to any of the modern, recommended ciphersuites (based on | 
|  | 157 | AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support | 
|  | 158 | any, encourage them to upgrade their software. | 
|  | 159 |  | 
|  | 160 | Remove support for TLS record-level hardware acceleration | 
|  | 161 | --------------------------------------------------------- | 
|  | 162 |  | 
|  | 163 | This doesn't affect people using the default configuration as it was already | 
|  | 164 | disabled by default. | 
|  | 165 |  | 
|  | 166 | This feature had been broken for a while so we doubt anyone still used it. | 
|  | 167 | However if you did, please reach out on the mailing list and let us know about | 
|  | 168 | your use case. | 
|  | 169 |  | 
|  | 170 | Remove wrapper for libpkcs11-helper | 
|  | 171 | ----------------------------------- | 
|  | 172 |  | 
|  | 173 | This doesn't affect people using the default configuration as it was already | 
|  | 174 | disabled by default. | 
|  | 175 |  | 
|  | 176 | If you used to rely on this module in order to store your private keys | 
|  | 177 | securely, please have a look at the key management facilities provided by the | 
|  | 178 | PSA crypto API. If you have a use case that's not covered yet by this API, | 
|  | 179 | please reach out on the mailing list. | 
|  | 180 |  | 
|  | 181 | Remove config option `MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME` | 
|  | 182 | ---------------------------------------------------------- | 
|  | 183 |  | 
|  | 184 | This doesn't affect people using the default configuration. | 
|  | 185 |  | 
| Manuel Pégourié-Gonnard | 57e93e5 | 2021-04-26 09:59:47 +0200 | [diff] [blame] | 186 | This option has not had any effect for a long time. Please use the `lifetime` | 
| Manuel Pégourié-Gonnard | 89d4ab0 | 2021-04-23 11:54:27 +0200 | [diff] [blame] | 187 | parameter of `mbedtls_ssl_ticket_setup()` instead. | 
|  | 188 |  | 
|  | 189 | Remove helpers for the transition from Mbed TLS 1.3 to Mbed TLS 2.0 | 
|  | 190 | ------------------------------------------------------------------- | 
|  | 191 |  | 
|  | 192 | This only affects people who've been using Mbed TLS since before version 2.0 | 
|  | 193 | and still relied on `compat-1.3.h` in their code. | 
|  | 194 |  | 
|  | 195 | Please use the new names directly in your code; `scripts/rename.pl` (from any | 
|  | 196 | of the 2.x releases - no longer included in 3.0) might help you do that. |