Hanno Becker | 699d4d7 | 2021-05-14 16:21:36 +0100 | [diff] [blame] | 1 | Modified semantics of mbedtls_ssl_{get,set}_session() |
| 2 | ----------------------------------------------------------------- |
| 3 | |
| 4 | This affects users who call `mbedtls_ssl_get_session()` or |
Hanno Becker | 3bbf4c0 | 2021-05-23 06:20:23 +0100 | [diff] [blame] | 5 | `mbedtls_ssl_set_session()` multiple times on the same SSL context |
Hanno Becker | 699d4d7 | 2021-05-14 16:21:36 +0100 | [diff] [blame] | 6 | representing an established TLS 1.2 connection. |
| 7 | Those users will now observe the second call to fail with |
| 8 | `MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE`. |
| 9 | |
| 10 | Migration 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()`. |