blob: ef6df7ae5affebcd83b870719d7262edb4883800 [file] [log] [blame] [view]
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +02001Migrating from Mbed TLS 2.x to Mbed TLS 3.0
2===========================================
3
4This guide details the steps required to migrate from Mbed TLS version 2.x to
5Mbed TLS version 3.0 or greater. Unlike normal releases, Mbed TLS 3.0 breaks
6compatibility with previous versions, so users (and alt implementors) might
7need to change their own code in order to make it work with Mbed TLS 3.0.
8
9Here's the list of breaking changes; each entry should help you answer these
10two questions: (1) am I affected? (2) if yes, what's my migration path?
11
Dave Rodgman1aea4042021-06-29 13:27:15 +010012The changes are detailed below, and include:
Dave Rodgman759c0102021-06-29 15:55:08 +010013
Dave Rodgman1aea4042021-06-29 13:27:15 +010014- Removal of many insecure / obsolete features
15- Tidying up of configuration options (including removing some less useful options)
16- Changing function signatures (e.g., adding return codes or extra parameters); introducing const to arguments.
17- Removal of functions marked as deprecated in 2.x
18
Dave Rodgmane45e6402021-06-29 13:21:55 +010019Introduce a level of indirection and versioning in the config files
20-------------------------------------------------------------------
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +020021
Dave Rodgmane45e6402021-06-29 13:21:55 +010022`config.h` was split into `build_info.h` and `mbedtls_config.h`.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +020023
Dave Rodgmane45e6402021-06-29 13:21:55 +010024* In code, use `#include <mbedtls/build_info.h>`. Don't include `mbedtls/config.h` and don't refer to `MBEDTLS_CONFIG_FILE`.
25* In build tools, edit `mbedtls_config.h`, or edit `MBEDTLS_CONFIG_FILE` as before.
26* If you had a tool that parsed the library version from `include/mbedtls/version.h`, this has moved to `include/mbedtls/build_info.h`. From C code, both headers now define the `MBEDTLS_VERSION_xxx` macros.
27
28Also, if you have a custom configuration file:
29
30* Don't include `check_config.h` or `config_psa.h` anymore.
31* Don't define `MBEDTLS_CONFIG_H` anymore.
32
33A config file version symbol, `MBEDTLS_CONFIG_VERSION` was introduced.
34Defining it to a particular value will ensure that Mbed TLS interprets
35the config file in a way that's compatible with the config file format
36used by the Mbed TLS release whose `MBEDTLS_VERSION_NUMBER` has the same
37value.
38The only value supported by Mbed TLS 3.0.0 is `0x03000000`.
39
Dave Rodgman759c0102021-06-29 15:55:08 +010040Remove support for TLS 1.0, 1.1 and DTLS 1.0
Dave Rodgmane45e6402021-06-29 13:21:55 +010041-------------------------------------------
42
43This change affects users of the TLS 1.0, 1.1 and DTLS 1.0 protocols.
44
45These versions have been deprecated by RFC 8996.
46Keeping them in the library creates opportunities for misconfiguration
47and possibly downgrade attacks. More generally, more code means a larger attack
48surface, even if the code is supposedly not used.
49
50The migration path is to adopt the latest versions of the protocol.
51
52As a consequence of removing TLS 1.0, support for CBC record splitting was
53also removed, as it was a work-around for a weakness in this particular
54version. There is no migration path since the feature is no longer relevant.
55
56As a consequence of currently supporting only one version of (D)TLS (and in the
Dave Rodgman759c0102021-06-29 15:55:08 +010057future 1.3 which will have a different version negotiation mechanism), support
Dave Rodgmane45e6402021-06-29 13:21:55 +010058for fallback SCSV (RFC 7507) was also removed. There is no migration path as
59it's no longer useful with TLS 1.2 and later.
60
61As a consequence of currently supporting only one version of (D)TLS (and in the
62future 1.3 which will have a different concept of ciphersuites), support for
63configuring ciphersuites separately for each version via
64`mbedtls_ssl_conf_ciphersuites_for_version()` was removed. Use
65`mbedtls_ssl_conf_ciphersuites()` to configure ciphersuites to use with (D)TLS
661.2; in the future a different API will be added for (D)TLS 1.3.
67
68Remove support for SSL 3.0
69--------------------------
70
71This doesn't affect people using the default configuration as it was already
72disabled by default.
73
74This only affects TLS users who explicitly enabled `MBEDTLS_SSL_PROTO_SSL3`
75and relied on that version in order to communicate with peers that are not up
76to date. If one of your peers is in that case, please try contacting them and
77encouraging them to upgrade their software.
78`0`.
79
80Strengthen default algorithm selection for X.509 and TLS
81--------------------------------------------------------
82
83The default X.509 verification profile (`mbedtls_x509_crt_profile_default`) and the default curve and hash selection in TLS have changed. They are now aligned, except that the X.509 profile only lists curves that support signature verification.
84
85Hashes and curves weaker than 255 bits (security strength less than 128 bits) are no longer accepted by default. The following hashes have been removed: SHA-1 (formerly only accepted for key exchanges but not for certificate signatures), SHA-224 (weaker hashes were already not accepted). The following curves have been removed: secp192r1, secp224r1, secp192k1, secp224k1.
86
87The compile-time options `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES` and `MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE` are no longer available.
88
89The curve secp256k1 has also been removed from the default X.509 and TLS profiles. [RFC 8422](https://datatracker.ietf.org/doc/html/rfc8422#section-5.1.1) deprecates it in TLS, and it is very rarely used, although it is not known to be weak at the time of writing.
90
91If you still need to accept certificates signed with algorithms that have been removed from the default profile, call `mbedtls_x509_crt_verify_with_profile` instead of `mbedtls_x509_crt_verify` and pass a profile that allows the curves and hashes you want. For example, to allow SHA-224:
92```
93mbedtls_x509_crt_profile my_profile = mbedtls_x509_crt_profile_default;
94my_profile.allowed_mds |= MBEDTLS_X509_ID_FLAG( MBEDTLS_MD_SHA224 );
95```
96
97If you still need to allow hashes and curves in TLS that have been removed from the default configuration, call `mbedtls_ssl_conf_sig_hashes()` and `mbedtls_ssl_conf_curves()` with the desired lists.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +020098
99Deprecated functions were removed from hashing modules
100------------------------------------------------------
101
TRodziewiczf41dc7c2021-06-21 13:27:29 +0200102Modules: MD5, SHA1, SHA256, SHA512, MD.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200103
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100104- The functions `mbedtls_xxx_starts_ret()`, `mbedtls_xxx_update_ret()`,
105 `mbedtls_xxx_finish_ret()` and `mbedtls_xxx_ret()` were renamed to replace
106 the corresponding functions without `_ret` appended. Please call the name without `_ret` appended and check the return value.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200107- The function `mbedtls_md_init_ctx()` was removed; please use
108 `mbedtls_md_setup()` instead.
109- The functions `mbedtls_xxx_process()` were removed. You normally don't need
Manuel Pégourié-Gonnard143b1e32021-05-05 09:46:01 +0200110 to call that from application code. However if you do (or if you want to
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100111 provide your own version of that function), please use
112 `mbedtls_internal_xxx_process()` instead, and check the return value.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200113
114Deprecated error codes for hardware failures were removed
115---------------------------------------------------------
116
117- The macros `MBEDTLS_ERR_xxx_FEATURE_UNSUPPORTED` from various crypto modules
118 were removed; `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` is now used
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100119 instead.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200120- The macros `MBEDTLS_ERR_xxx_HW_ACCEL_FAILED` from various crypto modules
121 were removed; `MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED` is now used instead.
122
123Deprecated names for PSA constants and types were removed
124---------------------------------------------------------
125
Manuel Pégourié-Gonnard2960b2e2021-04-26 09:57:36 +0200126Some constants and types that were present in beta versions of the PSA Crypto
Manuel Pégourié-Gonnard143b1e32021-05-05 09:46:01 +0200127API were removed from version 1.0 of specification. Please switch to the new
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200128names provided by the 1.0 specification instead.
129
130Internal / alt-focused headers were moved to a private location
131----------------------------------------------------------------
132
133This shouldn't affect users who took care not to include headers that
134were documented as internal, despite being in the public include directory.
135
136If you're providing alt implementations of ECP or RSA, you'll need to add our
137`library` directory to your include path when building your alt
138implementations, and note that `ecp_internal.h` and `rsa_internal.h` have been
Gilles Peskine6a2fb612021-05-24 22:25:04 +0200139renamed to `ecp_internal_alt.h` and `rsa_alt_helpers.h` respectively.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200140
141If you're a library user and used to rely on having access to a structure or
142function that's now in a private header, please reach out on the mailing list
143and explain your need; we'll consider adding a new API in a future version.
144
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200145Remove the certs module from the library
146----------------------------------------
147
148This should not affect production use of the library, as the certificates and
149keys included there were never suitable for production use.
150
151However it might affect you if you relied on them for testing purposes. In
152that case, please embed your own test certificates in your test code; now that
153`certs.c` is out of the library there is no longer any stability guaranteed
154and it may change in incompatible ways at any time.
155
156Remove the HAVEGE module
157------------------------
158
159This doesn't affect people using the default configuration as it was already
160disabled by default.
161
162This only affects users who called the HAVEGE modules directly (not
Manuel Pégourié-Gonnard143b1e32021-05-05 09:46:01 +0200163recommended), or users who used it through the entropy module but had it as the
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200164only source of entropy. If you're in that case, please declare OS or hardware
165RNG interfaces with `mbedtls_entropy_add_source()` and/or use an entropy seed
166file created securely during device provisioning. See
167<https://tls.mbed.org/kb/how-to/add-entropy-sources-to-entropy-pool> for more
168information.
169
170Remove support for parsing SSLv2 ClientHello
171--------------------------------------------
172
173This doesn't affect people using the default configuration as it was already
174disabled by default.
175
Manuel Pégourié-Gonnard143b1e32021-05-05 09:46:01 +0200176This only affects TLS servers that have clients who send an SSLv2 ClientHello.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200177These days clients are very unlikely to do that. If you have a client that
178does, please try contacting them and encouraging them to upgrade their
179software.
180
Thomas Daubney379227c2021-06-18 10:46:12 +0100181Remove support for truncated HMAC
182---------------------------------
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200183
Thomas Daubneyac844692021-06-18 14:08:56 +0100184This affects users of truncated HMAC, that is, users who called
185`mbedtls_ssl_conf_truncated_hmac( ..., MBEDTLS_SSL_TRUNC_HMAC_ENABLED)`,
186regardless of whether the standard version was used or compatibility version
187(`MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT`).
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200188
Thomas Daubneyac844692021-06-18 14:08:56 +0100189The recommended migration path for people who want minimal overhead is to use a
190CCM-8 ciphersuite.
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200191
192Remove support for TLS record-level compression
193-----------------------------------------------
194
195This doesn't affect people using the default configuration as it was already
196disabled by default.
197
198This only affects TLS users who enabled `MBEDTLS_ZLIB_SUPPORT`. This will not
199cause any failures however if you used to enable TLS record-level compression
200you may find that your bandwidth usage increases without compression. There's
201no general solution to this problem; application protocols might have their
202own compression mechanisms and are in a better position than the TLS stack to
203avoid variants of the CRIME and BREACH attacks.
204
205Remove support for TLS RC4-based ciphersuites
206---------------------------------------------
207
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +0200208This does not affect people who used the default `mbedtls_config.h` and the default
Manuel Pégourié-Gonnard2960b2e2021-04-26 09:57:36 +0200209list of ciphersuites, as RC4-based ciphersuites were already not negotiated in
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200210that case.
211
212Please switch to any of the modern, recommended ciphersuites (based on
213AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support
214any, encourage them to upgrade their software.
215
216Remove support for TLS single-DES ciphersuites
217----------------------------------------------
218
219This doesn't affect people using the default configuration as it was already
220disabled by default.
221
222Please switch to any of the modern, recommended ciphersuites (based on
223AES-GCM, AES-CCM or ChachaPoly for example) and if your peer doesn't support
224any, encourage them to upgrade their software.
225
226Remove support for TLS record-level hardware acceleration
227---------------------------------------------------------
228
229This doesn't affect people using the default configuration as it was already
230disabled by default.
231
232This feature had been broken for a while so we doubt anyone still used it.
233However if you did, please reach out on the mailing list and let us know about
234your use case.
235
236Remove wrapper for libpkcs11-helper
237-----------------------------------
238
239This doesn't affect people using the default configuration as it was already
240disabled by default.
241
242If you used to rely on this module in order to store your private keys
243securely, please have a look at the key management facilities provided by the
244PSA crypto API. If you have a use case that's not covered yet by this API,
245please reach out on the mailing list.
246
247Remove config option `MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME`
248----------------------------------------------------------
249
250This doesn't affect people using the default configuration.
251
Manuel Pégourié-Gonnard57e93e52021-04-26 09:59:47 +0200252This option has not had any effect for a long time. Please use the `lifetime`
Manuel Pégourié-Gonnard89d4ab02021-04-23 11:54:27 +0200253parameter of `mbedtls_ssl_ticket_setup()` instead.
254
255Remove helpers for the transition from Mbed TLS 1.3 to Mbed TLS 2.0
256-------------------------------------------------------------------
257
258This only affects people who've been using Mbed TLS since before version 2.0
259and still relied on `compat-1.3.h` in their code.
260
261Please use the new names directly in your code; `scripts/rename.pl` (from any
262of the 2.x releases - no longer included in 3.0) might help you do that.
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100263
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100264Remove 3DES ciphersuites
265--
266
267This change does not affect users using default settings for 3DES in `mbedtls_config.h`
268because the 3DES ciphersuites were disabled by that.
269
2703DES has weaknesses/limitations and there are better alternatives, and more and
271more standard bodies are recommending against its use in TLS.
272
Dave Rodgman759c0102021-06-29 15:55:08 +0100273The migration path here is to chose from the recommended in literature alternatives.
274
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100275CCM interface changes: impact for alternative implementations
276-------------------------------------------------------------
277
278The CCM interface has changed with the addition of support for
279multi-part operations. Five new API functions have been defined:
280mbedtls_ccm_starts(), mbedtls_ccm_set_lengths(),
281mbedtls_ccm_update_ad(), mbedtls_ccm_update() and mbedtls_ccm_finish().
282Alternative implementations of CCM (`MBEDTLS_CCM_ALT`) have now to
283implement those additional five API functions.
Dave Rodgman759c0102021-06-29 15:55:08 +0100284
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100285Calling `mbedtls_cipher_finish()` is mandatory for all multi-part operations
286----------------------------------------------------------------------------
287
288This only affects people who use the cipher module to perform AEAD operations
289using the multi-part API.
290
291Previously, the documentation didn't state explicitly if it was OK to call
292`mbedtls_cipher_check_tag()` or `mbedtls_cipher_write_tag()` directly after
293the last call to `mbedtls_cipher_update()` - that is, without calling
294`mbedtls_cipher_finish()` in-between. If you code was missing that call,
295please add it and be prepared to get as much as 15 bytes of output.
296
297Currently the output is always 0 bytes, but it may be more when alternative
298implementations of the underlying primitives are in use, or with future
299versions of the library.
Dave Rodgman759c0102021-06-29 15:55:08 +0100300
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100301Combine the `MBEDTLS_SSL_CID_PADDING_GRANULARITY` and `MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY` options
302--
303
304This change affects users who modified the default `mbedtls_config.h` padding granularity
305settings, i.e. enabled at least one of the options.
306
307The `mbedtls_config.h` options `MBEDTLS_SSL_CID_PADDING_GRANULARITY` and
308`MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY` were combined into one option because
309they used exactly the same padding mechanism and hence their respective padding
310granularities can be used in exactly the same way. This change simplifies the
311code maintenance.
312
313The new single option `MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY` can be used
314for both DTLS-CID and TLS 1.3.
Dave Rodgman759c0102021-06-29 15:55:08 +0100315
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100316Change the API to allow adding critical extensions to CSRs
317------------------------------------------------------------------
318
319This affects applications that call the `mbedtls_x509write_csr_set_extension`
320function.
321
322The API is changed to include the parameter `critical` which allow to mark an
Dave Rodgman759c0102021-06-29 15:55:08 +0100323extension included in a CSR as critical. To get the previous behavior pass TODO
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100324
325TLS now favors faster curves over larger curves
326-----------------------------------------------
327
328The default preference order for curves in TLS now favors resource usage (performance and memory consumption) over size. The exact order is unspecified and may change, but generally you can expect 256-bit curves to be preferred over larger curves.
329
330If you prefer a different order, call `mbedtls_ssl_conf_curves()` when configuring a TLS connection.
Dave Rodgman759c0102021-06-29 15:55:08 +0100331
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100332GCM interface changes: impact for alternative implementations
333-------------------------------------------------------------
334
335The GCM multipart interface has changed as described in [“GCM multipart interface: application changes”](#gcm-multipart-interface:-application-changes). The consequences for an alternative implementation of GCM (`MBEDTLS_GCM_ALT`) are as follows:
336
337* `mbedtls_gcm_starts()` now only sets the mode and the nonce (IV). The new function `mbedtls_gcm_update_ad()` receives the associated data. It may be called multiple times.
338* `mbedtls_gcm_update()` now allows arbitrary-length inputs, takes an extra parameter to indicate the actual output length. Alternative implementations may choose between two modes:
339 * Always return the partial output immediately, even if it does not consist of a whole number of blocks.
340 * Buffer the data for the last partial block, to be returned in the next call to `mbedtls_gcm_update()` or `mbedtls_gcm_finish()`.
341* `mbedtls_gcm_finish()` now takes an extra output buffer for the last partial block if needed.
Dave Rodgman759c0102021-06-29 15:55:08 +0100342
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100343GCM multipart interface: application changes
344--------------------------------------------
345
346The GCM module now supports arbitrary chunked input in the multipart interface.
347This changes the interface for applications using the GCM module directly for multipart operations.
348Applications using one-shot GCM or using GCM via the `mbedtls_cipher_xxx` or `psa_aead_xxx` interfaces do not require any changes.
349
350* `mbedtls_gcm_starts()` now only sets the mode and the nonce (IV). Call the new function `mbedtls_gcm_update_ad()` to pass the associated data.
351* `mbedtls_gcm_update()` now takes an extra parameter to indicate the actual output length. In Mbed TLS 2.x, applications had to pass inputs consisting of whole 16-byte blocks except for the last block (this limitation has been lifted). In this case:
352 * As long as the input remains block-aligned, the output length is exactly the input length, as before.
353 * If the length of the last input is not a multiple of 16, alternative implementations may return the last partial block in the call to `mbedtls_gcm_finish()` instead of returning it in the last call to `mbedtls_gcm_update()`.
354* `mbedtls_gcm_finish()` now takes an extra output buffer for the last partial block. This is needed for alternative implementations that can only process a whole block at a time.
Dave Rodgman759c0102021-06-29 15:55:08 +0100355
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100356SSL key export interface change
357-------------------------------
358
359This affects users of the SSL key export APIs:
360```
361 mbedtls_ssl_conf_export_keys_cb()
362 mbedtls_ssl_conf_export_keys_ext_cb()
363```
364
365Those APIs have been removed and replaced by the new API
366`mbedtls_ssl_set_export_keys_cb()`. This API differs from
367the previous key export API in the following ways:
368
369- It is no longer bound to an SSL configuration, but to an
370 SSL context. This allows users to more easily identify the
371 connection an exported key belongs to.
372- It no longer exports raw keys and IV.
373- A secret type parameter has been added to identify which key
374 is being exported. For TLS 1.2, only the master secret is
375 exported, but upcoming TLS 1.3 support will add other kinds of keys.
376- The callback now specifies a void return type, rather than
377 returning an error code. It is the responsibility of the application
378 to handle failures in the key export callback, for example by
379 shutting down the TLS connection.
380
381For users which do not rely on raw keys and IV, adjusting to the new
382callback type should be straightforward - see the example programs
383programs/ssl/ssl_client2 and programs/ssl/ssl_server2 for callbacks
384for NSSKeylog, EAP-TLS and DTLS-SRTP.
385
386Users which require access to the raw keys used to secure application
387traffic may derive those by hand based on the master secret and the
388handshake transcript hashes which can be obtained from the raw data
389on the wire. Such users are also encouraged to reach out to the
390Mbed TLS team on the mailing list, to let the team know about their
391use case.
Dave Rodgman759c0102021-06-29 15:55:08 +0100392
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100393The RNG parameter is now mandatory for all functions that accept one
394--------------------------------------------------------------------
395
396This change affects all users who called a function accepting a `f_rng`
397parameter with `NULL` as the value of this argument; this is no longer
398supported.
399
400The changed functions are: the X.509 CRT and CSR writing functions; the PK and
401RSA sign and decrypt functions; `mbedtls_rsa_private()`; the functions in DHM
402and ECDH that compute the shared secret; the scalar multiplication functions in
403ECP.
404
405You now need to pass a properly seeded, cryptographically secure RNG to all
406functions that accept a `f_rng` parameter. It is of course still possible to
407pass `NULL` as the context pointer `p_rng` if your RNG function doesn't need a
408context.
409
410Alternative implementations of a module (enabled with the `MBEDTLS_module_ALT`
411configuration options) may have their own internal and are free to ignore the
412`f_rng` argument but must allow users to pass one anyway.
413
414Some functions gained an RNG parameter
415--------------------------------------
416
417This affects users of the following functions: `mbedtls_ecp_check_pub_priv()`,
418`mbedtls_pk_check_pair()`, `mbedtls_pk_parse_key()`, and
419`mbedtls_pk_parse_keyfile()`.
420
421You now need to pass a properly seeded, cryptographically secure RNG when
422calling these functions. It is used for blinding, a counter-measure against
423side-channel attacks.
424
425The configuration option `MBEDTLS_ECP_NO_INTERNAL_RNG` was removed
426------------------------------------------------------------------
427
428This doesn't affect users of the default configuration; it only affects people
429who were explicitly setting this option.
430
431This was a trade-off between code size and counter-measures; it is no longer
432relevant as the counter-measure is now always on at no cost in code size.
Dave Rodgman759c0102021-06-29 15:55:08 +0100433
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100434Remove MaximumFragmentLength (MFL) query API
435-----------------------------------------------------------------
436
437This affects users which use the MFL query APIs
438`mbedtls_ssl_get_{input,output}_max_frag_len()` to
439infer upper bounds on the plaintext size of incoming and
440outgoing record.
441
442Users should switch to `mbedtls_ssl_get_max_{in,out}_record_payload()`
443instead, which also provides such upper bounds but takes more factors
444than just the MFL configuration into account.
Dave Rodgman759c0102021-06-29 15:55:08 +0100445
446Change MBEDTLS_ECP_FIXED_POINT_OPTIM behavior
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100447------------------------------------------------------
448
449The option `MBEDTLS_ECP_FIXED_POINT_OPTIM` now increase code size and it does
450not increase peak RAM usage anymore.
451
452If you are limited by code size, you can define `MBEDTLS_ECP_FIXED_POINT_OPTIM`
453to `0` in your config file. The impact depends on the number and size of
454enabled curves. For example, for P-256 the difference is 1KB; see the documentation
455of this option for details.
456
457Replaced MBEDTLS_SHA512_NO_SHA384 with MBEDTLS_SHA384_C
458------------------------------------------------------
459
460This does not affect users who use the default `mbedtls_config.h`.
461MBEDTLS_SHA512_NO_SHA384 was disabled by default, now MBEDTLS_SHA384_C is
462enabled by default.
463
464If you were using a config file with both MBEDTLS_SHA512_C and
465MBEDTLS_SHA512_NO_SHA384, then just remove the MBEDTLS_SHA512_NO_SHA384.
466If you were using a config file with MBEDTLS_SHA512_C and without
467MBEDTLS_SHA512_NO_SHA384 and you need the SHA-384 algorithm, then add
468`#define MBEDTLS_SHA384_C` to your config file.
Dave Rodgman759c0102021-06-29 15:55:08 +0100469
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100470Move part of timing module out of the library
471--
472
473The change affects users who use any of the following functions:
474`mbedtls_timing_self_test()`, `mbedtls_hardclock_poll()`,
475`mbedtls_timing_hardclock()` and `mbedtls_set_alarm()`.
476
477If you were relying on these functions, you'll now need to change to using your
478platform's corresponding functions directly.
Dave Rodgman759c0102021-06-29 15:55:08 +0100479
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100480Extra parameter for the output buffer size
481------------------------------------------
482
483The following functions now take an extra parameter indicating the size of the output buffer:
484
485* `mbedtls_ecdsa_write_signature()`, `mbedtls_ecdsa_write_signature_restartable()`
486* `mbedtls_pk_sign()`, `mbedtls_pk_sign_restartable()`
487
488The requirements for the output buffer have not changed, but passing a buffer that is too small now reliably causes the functions to return an error, rather than overflowing the buffer.
Dave Rodgman759c0102021-06-29 15:55:08 +0100489
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100490Relaxed semantics for PSK configuration
491-----------------------------------------------------------------
492
493This affects users which call the PSK configuration APIs
494`mbedtlsl_ssl_conf_psk()` and `mbedtls_ssl_conf_psk_opaque()`
495multiple times on the same SSL configuration.
496
497In Mbed TLS 2.x, users would observe later calls overwriting
498the effect of earlier calls, with the prevailing PSK being
499the one that has been configured last. In Mbed TLS 3.0,
500calling `mbedtls_ssl_conf_[opaque_]psk()` multiple times
501will return an error, leaving the first PSK intact.
502
503To achieve equivalent functionality when migrating to Mbed TLS 3.0,
504users calling `mbedtls_ssl_conf_[opaque_]psk()` multiple times should
505remove all but the last call, so that only one call to _either_
506`mbedtls_ssl_conf_psk()` _or_ `mbedtls_ssl_conf_psk_opaque()`
507remains.
Dave Rodgman759c0102021-06-29 15:55:08 +0100508
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100509Remove the configuration to enable weak ciphersuites in SSL / TLS
510-----------------------------------------------------------------
511
512This does not affect users who use the default `mbedtls_config.h`, as this option was
513already off by default.
514
515If you were using a weak cipher, please switch to any of the modern,
516recommended ciphersuites (based on AES-GCM, AES-CCM or ChachaPoly for example)
517and if your peer doesn't support any, encourage them to upgrade their software.
518
519If you were using a ciphersuite without encryption, you just have to
520enable MBEDTLS_CIPHER_NULL_CIPHER now.
Dave Rodgman759c0102021-06-29 15:55:08 +0100521
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100522Remove the `MBEDTLS_SSL_MAX_CONTENT_LEN` configuration option
523-------------------------------------------------------------
524
525This affects users who use the `MBEDTLS_SSL_MAX_CONTENT_LEN` option to
526set the maximum length of incoming and outgoing plaintext fragments,
527which can save memory by reducing the size of the TLS I/O buffers.
528
529This option is replaced by the more fine-grained options
530`MBEDTLS_SSL_IN_CONTENT_LEN` and `MBEDTLS_SSL_OUT_CONTENT_LEN` that set
531the maximum incoming and outgoing plaintext fragment lengths, respectively.
Dave Rodgman759c0102021-06-29 15:55:08 +0100532
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100533Remove the option to build the library without any entropy sources
534------------------------------------------------------------------
535
536This does not affect users who use the default `mbedtls_config.h`, as this option was
537already off by default.
538
539If you were using the `MBEDTLS_TEST_NULL_ENTROPY` option and your platform
540doesn't have any entropy source, you should use `MBEDTLS_ENTROPY_NV_SEED`
541and make sure your device is provisioned with a strong random seed.
542Alternatively, for testing purposes only, you can create and register a fake
543entropy function.
Dave Rodgman759c0102021-06-29 15:55:08 +0100544
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100545Remove the mode parameter from RSA functions
546--------------------------------------------
547
548This affects all users who use the RSA encryption, decryption, sign and
549verify APIs.
550
551The RSA module no longer supports private-key operations with the public key or
552vice versa. As a consequence, RSA operation functions no longer have a mode
553parameter. If you were calling RSA operations with the normal mode (public key
554for verification or encryption, private key for signature or decryption), remove
555the `MBEDTLS_MODE_PUBLIC` or `MBEDTLS_MODE_PRIVATE` argument. If you were calling
556RSA operations with the wrong mode, which rarely makes sense from a security
557perspective, this is no longer supported.
558
559Remove the RNG parameter from RSA verify functions
560--------------------------------------------------
561
562RSA verification functions also no longer take random generator arguments (this
563was only needed when using a private key). This affects all applications using
564the RSA verify functions.
565
566Remove the SSL API mbedtls_ssl_get_session_pointer()
567-----------------------------------------------------------------
568
569This affects two classes of users:
570
5711. Users who manually inspect parts of the current session through
572 direct structure field access.
573
5742. Users of session resumption who query the current session
575 via `mbedtls_ssl_get_session_pointer()` prior to saving or exporting
576 it via `mbedtls_ssl_session_copy()` or `mbedtls_ssl_session_save()`,
577 respectively.
578
579Migration paths:
580
Dave Rodgman759c0102021-06-29 15:55:08 +01005811. Mbed TLS 3.0 does not offer a migration path for the use case 1: Like many
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100582 other Mbed TLS structures, the structure of `mbedtls_ssl_session` is no
583 longer part of the public API in Mbed TLS 3.0, and direct structure field
584 access is no longer supported. Please see the corresponding migration guide.
585
5862. Users should replace calls to `mbedtls_ssl_get_session_pointer()` by
587 calls to `mbedtls_ssl_get_session()` as demonstrated in the example
588 program `programs/ssl/ssl_client2.c`.
Dave Rodgman759c0102021-06-29 15:55:08 +0100589
590Remove the config option MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100591--------------------------------------------------------------------------
592
Dave Rodgman759c0102021-06-29 15:55:08 +0100593This change does not affect users of the default configuration; it only affects
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100594users who enable this option.
595
596The X.509 standard says that implementations must reject critical extensions that
597they don't recognize, and this is what Mbed TLS does by default. This option
598allowed to continue parsing those certificates but didn't provide a convenient
599way to handle those extensions.
600
601The migration path from that option is to use the
602`mbedtls_x509_crt_parse_der_with_ext_cb()` function which is functionally
603equivalent to `mbedtls_x509_crt_parse_der()`, and/or
604`mbedtls_x509_crt_parse_der_nocopy()` but it calls the callback with every
605unsupported certificate extension and additionally the "certificate policies"
606extension if it contains any unsupported certificate policies.
Dave Rodgman759c0102021-06-29 15:55:08 +0100607
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100608Remove `MBEDTLS_X509_CHECK_*_KEY_USAGE` options from `mbedtls_config.h`
609-------------------------------------------------------------------
610
611This change affects users who have chosen the configuration options to disable the
612library's verification of the `keyUsage` and `extendedKeyUsage` fields of x509
613certificates.
614
615The `MBEDTLS_X509_CHECK_KEY_USAGE` and `MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE`
616configuration options are removed and the X509 code now behaves as if they were
617always enabled. It is consequently not possible anymore to disable at compile
618time the verification of the `keyUsage` and `extendedKeyUsage` fields of X509
619certificates.
620
621The verification of the `keyUsage` and `extendedKeyUsage` fields is important,
622disabling it can cause security issues and it is thus not recommended. If the
623verification is for some reason undesirable, it can still be disabled by means
624of the verification callback function passed to `mbedtls_x509_crt_verify()` (see
625the documentation of this function for more information).
Dave Rodgman759c0102021-06-29 15:55:08 +0100626
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100627Remove MD2, MD4, RC4, Blowfish and XTEA algorithms
628--
629
630This change affects users of the MD2, MD4, RC4, Blowfish and XTEA algorithms.
631
632They are already niche or obsolete and most of them are weak or broken. For
633those reasons possible users should consider switching to modern and safe
634alternatives to be found in literature.
Dave Rodgman759c0102021-06-29 15:55:08 +0100635
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100636Remove MBEDTLS_SSL_DTLS_BADMAC_LIMIT option
637-------------------------------------------
638
639This change does not affect users who used the default `mbedtls_config.h`, as the option
640MBEDTLS_SSL_DTLS_BADMAC_LIMIT was already on by default.
641
642This option was a trade-off between functionality and code size: it allowed
643users who didn't need that feature to avoid paying the cost in code size, by
644disabling it.
645
646This option is no longer present, but its functionality is now always enabled.
Dave Rodgman759c0102021-06-29 15:55:08 +0100647
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100648Deprecated functions were removed from AES
649------------------------------------------
650
651The functions `mbedtls_aes_encrypt()` and `mbedtls_aes_decrypt()` were
652removed.
653
654If you're simply using the AES module, you should be calling the higher-level
655functions `mbedtls_aes_crypt_xxx()`.
656
657If you're providing an alternative implementation using
658`MBEDTLS_AES_ENCRYPT_ALT` or `MBEDTLS_AES_DECRYPT_ALT`, you should be
659replacing the removed functions with `mbedtls_internal_aes_encrypt()` and
660`mbedtls_internal_aes_decrypt()` respectively.
661
662Deprecated functions were removed from bignum
663---------------------------------------------
664
665The function `mbedtls_mpi_is_prime()` was removed. Please use
666`mbedtls_mpi_is_prime_ext()` instead which additionally allows specifying the
667number of Miller-Rabin rounds.
668
669Deprecated functions were removed from cipher
670---------------------------------------------
671
672The functions `mbedtls_cipher_auth_encrypt()` and
673`mbedtls_cipher_auth_decrypt()` were removed. They were superseded by
674`mbedtls_cipher_auth_encrypt_ext()` and `mbedtls_cipher_auth_decrypt_ext()`
675respectively which additionally support key wrapping algorithms such as
676NIST_KW.
677
678Deprecated functions were removed from DRBGs
679--------------------------------------------
680
681The functions `mbedtls_ctr_drbg_update()` and `mbedtls_hmac_drbg_update()`
682were removed. They were superseded by `mbedtls_ctr_drbg_update_ret()` and
683`mbedtls_hmac_drbg_update_ret()` respectively.
684
685Deprecated functions were removed from ECDSA
686--------------------------------------------
687
688The functions `mbedtls_ecdsa_write_signature_det()` and
689`mbedtls_ecdsa_sign_det()` were removed. They were superseded by
690`mbedtls_ecdsa_write_signature()` and `mbedtls_ecdsa_sign_det_ext()`
691respectively.
692
693Deprecated functions were removed from SSL
694------------------------------------------
695
696The function `mbedtls_ssl_conf_dh_param()` was removed. Please use
697`mbedtls_ssl_conf_dh_param_bin()` or `mbedtls_ssl_conf_dh_param_ctx()` instead.
698
699The function `mbedtls_ssl_get_max_frag_len()` was removed. Please use
700`mbedtls_ssl_get_max_out_record_payload()` and
701`mbedtls_ssl_get_max_in_record_payload()`
702instead.
703
704Deprecated hex-encoded primes were removed from DHM
705---------------------------------------------------
706
707The macros `MBEDTLS_DHM_RFC5114_MODP_2048_P`, `MBEDTLS_DHM_RFC5114_MODP_2048_G`,
708`MBEDTLS_DHM_RFC3526_MODP_2048_P`, `MBEDTLS_DHM_RFC3526_MODP_2048_G`,
709`MBEDTLS_DHM_RFC3526_MODP_3072_P`, `MBEDTLS_DHM_RFC3526_MODP_3072_G`,
710`MBEDTLS_DHM_RFC3526_MODP_4096_P `and `MBEDTLS_DHM_RFC3526_MODP_4096_G` were
711removed. The primes from RFC 5114 are deprecated because their derivation is not
712documented and therefore their usage constitutes a security risk; they are fully
713removed from the library. Please use parameters from RFC3526 (still in the
714library, only in binary form) or RFC 7919 (also available in the library) or
715other trusted sources instead.
716
717Deprecated net.h file was removed
718---------------------------------
719
720The file `include/mbedtls/net.h` was removed because its only function was to
721include `mbedtls/net_sockets.h` which now should be included directly.
Dave Rodgman759c0102021-06-29 15:55:08 +0100722
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100723Remove MBEDTLS_CHECK_PARAMS option
724----------------------------------
725
726This change does not affect users who use the default configuration; it only
727affects users who enabled that option.
728
729The option `MBEDTLS_CHECK_PARAMS` (disabled by default) enabled certain kinds
730of parameter validation”. It covered two kinds of validations:
731
732- In some functions that require a valid pointer, parameter validation checks
733that the pointer is non-null. With the feature disabled, a null pointer is not
734treated differently from any other invalid pointer, and typically leads to a
735runtime crash. 90% of the uses of the feature are of this kind.
736- In some functions that take an enum-like argument, parameter validation
737checks that the value is a valid one. With the feature disabled, an invalid
738value causes a silent default to one of the valid values.
739
740The default reaction to a failed check was to call a function
741`mbedtls_param_failed()` which the application had to provide. If this function
742returned, its caller returned an error `MBEDTLS_ERR_xxx_BAD_INPUT_DATA`.
743
744This feature was only used in some classic (non-PSA) cryptography modules. It was
745not used in X.509, TLS or in PSA crypto, and it was not implemented in all
746classic crypto modules.
747
748This feature has been removed. The library no longer checks for NULL pointers;
749checks for enum-like arguments will be kept or re-introduced on a case-by-case
750basis, but their presence will no longer be dependent on a compile-time option.
751
752Validation of enum-like values is somewhat useful, but not extremely important,
753because the parameters concerned are usually constants in applications.
754
755For more information see issue #4313.
Dave Rodgman759c0102021-06-29 15:55:08 +0100756
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100757Remove MBEDTLS_SSL_RECORD_CHECKING option and enable its action by default
758--------------------------------------------------------------------------
759
760This change does not affect users who use the default mbedtls_config.h, as the
761option MBEDTLS_SSL_RECORD_CHECKING was already on by default.
762
763This option was added only to control compilation of one function,
764mbedtls_ssl_check_record(), which is only useful in some specific cases, so it
765was made optional to allow users who don't need it to save some code space.
766However, the same effect can be achieve by using link-time garbage collection.
767
768Users who changed the default setting of the option need to change the config/
769build system to remove that change.
Dave Rodgman759c0102021-06-29 15:55:08 +0100770
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100771Remove the `MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3` option
772--
773
774This change does not affect users who were using the default configuration, as
775this option was already disabled by default. Also, it does not affect users who
776are working with current V3 X.509 certificates.
777
778Extensions were added in V3 of the X.509 specification, so pre-V3 certificates
779containing extensions were never compliant. Mbed TLS now rejects them with a
780parsing error in all configurations, as it did previously in the default
781configuration.
782
783If you are working with the pre-V3 certificates you need to switch to the
784current ones.
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100785
786Rename mbedtls_*_ret() cryptography functions whose deprecated variants have been removed
787-----------------
788
789This change affects users who were using the `mbedtls_*_ret()` cryptography
790functions.
791
792Those functions were created based on now-deprecated functions according to a
793requirement that a function needs to return a value. This change brings back the
794original names of those functions. The renamed functions are:
795
796| name before this change | after the change |
797|------------------------------|--------------------------|
798| mbedtls_ctr_drbg_update_ret | mbedtls_ctr_drbg_update |
799| mbedtls_hmac_drbg_update_ret | mbedtls_hmac_drbg_update |
800| mbedtls_md5_starts_ret | mbedtls_md5_starts |
801| mbedtls_md5_update_ret | mbedtls_md5_update |
802| mbedtls_md5_finish_ret | mbedtls_md5_finish |
803| mbedtls_md5_ret | mbedtls_md5 |
804| mbedtls_ripemd160_starts_ret | mbedtls_ripemd160_starts |
805| mbedtls_ripemd160_update_ret | mbedtls_ripemd160_update |
806| mbedtls_ripemd160_finish_ret | mbedtls_ripemd160_finish |
807| mbedtls_ripemd160_ret | mbedtls_ripemd160 |
808| mbedtls_sha1_starts_ret | mbedtls_sha1_starts |
809| mbedtls_sha1_update_ret | mbedtls_sha1_update |
810| mbedtls_sha1_finish_ret | mbedtls_sha1_finish |
811| mbedtls_sha1_ret | mbedtls_sha1 |
812| mbedtls_sha256_starts_ret | mbedtls_sha256_starts |
813| mbedtls_sha256_update_ret | mbedtls_sha256_update |
814| mbedtls_sha256_finish_ret | mbedtls_sha256_finish |
815| mbedtls_sha256_ret | mbedtls_sha256 |
816| mbedtls_sha512_starts_ret | mbedtls_sha512_starts |
817| mbedtls_sha512_update_ret | mbedtls_sha512_update |
818| mbedtls_sha512_finish_ret | mbedtls_sha512_finish |
819| mbedtls_sha512_ret | mbedtls_sha512 |
820
821To migrate to the this change the user can keep the `*_ret` names in their code
822and include the `compat_2.x.h` header file which holds macros with proper
823renaming or to rename those function in their code according to the list from
824mentioned header file.
825
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100826Signature functions now require the hash length to match the expected value
827---------------------------------------------------------------------------
828
829This affects users of the PK API as well as users of the low-level API in the RSA module. Users of the PSA API or of the ECDSA module are unaffected.
830
831All the functions in the RSA module that accept a `hashlen` parameter used to
832ignore it unless the `md_alg` parameter was `MBEDTLS_MD_NONE`, indicating raw
833data was signed. The `hashlen` parameter is now always the size that is read
834from the `hash` input buffer. This length must be equal to the output size of
835the hash algorithm used when signing a hash. (The requirements when signing
836raw data are unchanged.) This affects the following functions:
837
838* `mbedtls_rsa_pkcs1_sign`, `mbedtls_rsa_pkcs1_verify`
839* `mbedtls_rsa_rsassa_pkcs1_v15_sign`, `mbedtls_rsa_rsassa_pkcs1_v15_verify`
840* `mbedtls_rsa_rsassa_pss_sign`, `mbedtls_rsa_rsassa_pss_verify`
841* `mbedtls_rsa_rsassa_pss_sign_ext`, `mbedtls_rsa_rsassa_pss_verify_ext`
842
843The signature functions in the PK module no longer accept 0 as the `hash_len` parameter. The `hash_len` parameter is now always the size that is read from the `hash` input buffer. This affects the following functions:
844
845* `mbedtls_pk_sign`, `mbedtls_pk_verify`
846* `mbedtls_pk_sign_restartable`, `mbedtls_pk_verify_restartable`
847* `mbedtls_pk_verify_ext`
848
849The migration path is to pass the correct value to those functions.
Dave Rodgman759c0102021-06-29 15:55:08 +0100850
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100851Remove the padding parameters from mbedtls_rsa_init()
852-----------------------------------------------------
853
854This affects all users who use the RSA encryption, decryption, sign and
855verify APIs.
856
857The function mbedtls_rsa_init() no longer supports selecting the PKCS#1 v2.1
858encoding and its hash. It just selects the PKCS#1 v1.5 encoding by default. If
859you were using the PKCS#1 v2.1 encoding you now need, subsequently to the call
860to mbedtls_rsa_init(), to call mbedtls_rsa_set_padding() to set it.
861
862To choose the padding type when initializing a context, instead of
863```C
864 mbedtls_rsa_init(ctx, padding, hash_id);
865```
866, use
867```C
868 mbedtls_rsa_init(ctx);
869 mbedtls_rsa_set_padding(ctx, padding, hash_id);
870```
871
872To use PKCS#1 v1.5 padding, instead of
873```C
874 mbedtls_rsa_init(ctx, MBEDTLS_RSA_PKCS_V15, <ignored>);
875```
876, just use
877```C
878 mbedtls_rsa_init(ctx);
879```
Dave Rodgman759c0102021-06-29 15:55:08 +0100880
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100881Separated MBEDTLS_SHA224_C and MBEDTLS_SHA256_C
882-----------------------------------------------------------------
883
884This does not affect users who use the default `mbedtls_config.h`. MBEDTLS_SHA256_C
885was enabled by default. Now both MBEDTLS_SHA256_C and MBEDTLS_SHA224_C are
886enabled.
887
888If you were using custom config file with MBEDTLS_SHA256_C enabled, then
889you will need to add `#define MBEDTLS_SHA224_C` option your config.
890Current version of the library does not support enabling MBEDTLS_SHA256_C
891without MBEDTLS_SHA224_C.
Dave Rodgman759c0102021-06-29 15:55:08 +0100892
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100893Session Cache API Change
894-----------------------------------------------------------------
895
896This affects users who use `mbedtls_ssl_conf_session_cache()`
897to configure a custom session cache implementation different
898from the one Mbed TLS implements in `library/ssl_cache.c`.
899
900Those users will need to modify the API of their session cache
901implementation to that of a key-value store with keys being
902session IDs and values being instances of `mbedtls_ssl_session`:
903
904```
905typedef int mbedtls_ssl_cache_get_t( void *data,
906 unsigned char const *session_id,
907 size_t session_id_len,
908 mbedtls_ssl_session *session );
909typedef int mbedtls_ssl_cache_set_t( void *data,
910 unsigned char const *session_id,
911 size_t session_id_len,
912 const mbedtls_ssl_session *session );
913```
914
915Since the structure of `mbedtls_ssl_session` is no longer public from 3.0
916onwards, portable session cache implementations must not access fields of
917`mbedtls_ssl_session`. See the corresponding migration guide. Users that
918find themselves unable to migrate their session cache functionality without
Dave Rodgman759c0102021-06-29 15:55:08 +0100919accessing fields of `mbedtls_ssl_session` should describe their use case
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100920on the Mbed TLS mailing list.
Dave Rodgman759c0102021-06-29 15:55:08 +0100921
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100922SHA-512 and SHA-256 output type change
923--------------------------
924
925The output parameter of `mbedtls_sha256_finish_ret()`, `mbedtls_sha256_ret()`, `mbedtls_sha512_finish_ret()`, `mbedtls_sha512_ret()` now has a pointer type rather than array type. This makes no difference in terms of C semantics, but removes spurious warnings in some compilers when outputting a SHA-384 hash into a 48-byte buffer or a SHA-224 hash into a 28-byte buffer.
926
927This makes no difference to a vast majority of applications. If your code takes a pointer to one of these functions, you may need to change the type of the pointer.
928
929Alternative implementations of the SHA256 and SHA512 modules must adjust their functions' prototype accordingly.
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100930
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100931Removal of some SSL error codes
932-----------------------------------------------------------------
933
934This affects users manually checking for the following error codes:
Dave Rodgman759c0102021-06-29 15:55:08 +0100935
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100936- `MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED`
937- `MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH`
938- `MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE`
939- `MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN`
940- `MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE`
941- `MBEDTLS_ERR_SSL_BAD_HS_XXX`
942
943Migration paths:
944- `MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED` and `MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH`
945 should never be returned from Mbed TLS, and there is no need to check for it.
Dave Rodgman759c0102021-06-29 15:55:08 +0100946
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100947 Users should simply remove manual checks for those codes, and let the Mbed TLS
948 team know if -- contrary to the team's understanding -- there is in fact a situation
949 where one of them was ever returned.
Dave Rodgman759c0102021-06-29 15:55:08 +0100950
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100951- `MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE` has been removed, and
952 `MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL` is returned instead if the user's own certificate
Dave Rodgman759c0102021-06-29 15:55:08 +0100953 is too large to fit into the output buffers.
954
955 Users should check for `MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL` instead, and potentially
956 compare the size of their own certificate against the configured size of the output buffer to
957 understand if the error is due to an overly large certificate.
958
959- `MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN` and `MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE` have been replaced by `MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE`
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100960
Dave Rodgman759c0102021-06-29 15:55:08 +0100961- all codes of the form `MBEDTLS_ERR_SSL_BAD_HS_XXX` have been replaced by various alternatives.
962
963Modified semantics of mbedtls_ssl_{get,set}_session()
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100964-----------------------------------------------------------------
965
966This affects users who call `mbedtls_ssl_get_session()` or
967`mbedtls_ssl_set_session()` multiple times on the same SSL context
968representing an established TLS 1.2 connection.
969Those users will now observe the second call to fail with
970`MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE`.
971
972Migration path:
973- Exporting the same TLS 1.2 connection multiple times via
974 `mbedtls_ssl_get_session()` leads to multiple copies of
975 the same session. This use of `mbedtls_ssl_get_session()`
976 is discouraged, and the following should be considered:
977 * If the various session copies are later loaded into
978 fresh SSL contexts via `mbedtls_ssl_set_session()`,
979 export via `mbedtls_ssl_get_session()` only once and
980 load the same session into different contexts via
981 `mbedtls_ssl_set_session()`. Since `mbedtls_ssl_set_session()`
982 makes a copy of the session that's being loaded, this
983 is functionally equivalent.
984 * If the various session copies are later serialized
985 via `mbedtls_ssl_session_save()`, export and serialize
986 the session only once via `mbedtls_ssl_get_session()` and
987 `mbedtls_ssl_session_save()` and make copies of the raw
988 data instead.
989- Calling `mbedtls_ssl_set_session()` multiple times in Mbed TLS 2.x
990 is not useful since subsequent calls overwrite the effect of previous
Dave Rodgman759c0102021-06-29 15:55:08 +0100991 calls. Applications achieve equivalent functional behavior by
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100992 issuing only the very last call to `mbedtls_ssl_set_session()`.
993
Dave Rodgman759c0102021-06-29 15:55:08 +0100994Turn MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE configuration option into a runtime option
Dave Rodgman8cccbe12021-06-29 13:15:50 +0100995 --
996
997This change affects users who were enabling MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
998option in the `mbedtls_config.h`
999
1000This option has been removed and a new function with similar functionality has
1001been introduced into the SSL API.
1002
1003This new function `mbedtls_ssl_conf_preference_order()` can be used to
1004change the preferred order of ciphersuites on the server to those used on the client,
1005e.g.: `mbedtls_ssl_conf_preference_order(ssl_config, MBEDTLS_SSL_SRV_CIPHERSUITE_ORDER_CLIENT)`
1006has the same effect as enabling the removed option. The default state is to use
1007the server order of suites.
Dave Rodgmane45e6402021-06-29 13:21:55 +01001008
1009Some function parameters were made const
1010----------------------------------------
1011
1012Various functions in the PK and ASN.1 modules had a `const` qualifier added to
1013some of their parameters.
1014
1015This normally doesn't affect your code, unless you use pointers to reference
1016those functions. In this case, you'll need to update the type of your pointers
1017in order to match the new signature.