blob: 23c53d671d29c3f311cb7d158a90e2de1eabb798 [file] [log] [blame] [view]
Hanno Becker699d4d72021-05-14 16:21:36 +01001Modified semantics of mbedtls_ssl_{get,set}_session()
2-----------------------------------------------------------------
3
4This affects users who call `mbedtls_ssl_get_session()` or
Hanno Becker3bbf4c02021-05-23 06:20:23 +01005`mbedtls_ssl_set_session()` multiple times on the same SSL context
Hanno Becker699d4d72021-05-14 16:21:36 +01006representing an established TLS 1.2 connection.
7Those users will now observe the second call to fail with
8`MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE`.
9
10Migration path:
11- Exporting the same TLS 1.2 connection multiple times via
12 `mbedtls_ssl_get_session()` leads to multiple copies of
13 the same session. This use of `mbedtls_ssl_get_session()`
14 is discouraged, and the following should be considered:
15 * If the various session copies are later loaded into
16 fresh SSL contexts via `mbedtls_ssl_set_session()`,
17 export via `mbedtls_ssl_get_session()` only once and
18 load the same session into different contexts via
19 `mbedtls_ssl_set_session()`. Since `mbedtls_ssl_set_session()`
20 makes a copy of the session that's being loaded, this
21 is functionally equivalent.
22 * If the various session copies are later serialized
23 via `mbedtls_ssl_session_save()`, export and serialize
24 the session only once via `mbedtls_ssl_get_session()` and
25 `mbedtls_ssl_session_save()` and make copies of the raw
26 data instead.
27- Calling `mbedtls_ssl_set_session()` multiple times in Mbed TLS 2.x
28 is not useful since subsequent calls overwrite the effect of previous
29 calls. Applications achieve equivalent functional behaviour by
30 issuing only the very last call to `mbedtls_ssl_set_session()`.