mbedtls/library
Hanno Becker fadbdbb576 Store TLS version in SSL session structure
Instances of `mbedtls_ssl_session` represent data enabling session resumption.

With the introduction of TLS 1.3, the format of this data changes. We therefore
need TLS-version field as part of `mbedtlsl_ssl_session` which allows distinguish
1.2 and 1.3 sessions.

This commit introduces such a TLS-version field to mbedtls_ssl_session.

The change has a few ramifications:

- Session serialization/deserialization routines need to be adjusted.

  This is achieved by adding the TLS-version after the header of
  Mbed TLS version+config, and by having the subsequent structure
  of the serialized data depend on the value of this field.

  The details are described in terms of the RFC 8446 presentation language.

  The 1.2 session (de)serialization are moved into static helper functions,
  while the top-level session (de)serialization only parses the Mbed TLS
  version+config header and the TLS-version field, and dispatches according
  to the found version.

  This way, it will be easy to add support for TLS 1.3 sessions in the future.

- Tests for session serialization need to be adjusted

- Once we add support for TLS 1.3, with runtime negotiation of 1.2 vs. 1.3,
  we will need to have some logic comparing the TLS version of the proposed session
  to the negotiated TLS version. For now, however, we only support TLS 1.2,
  and no such logic is needed. Instead, we just store the TLS version in the
  session structure at the same point when we populate mbedtls_ssl_context.minor_ver.

The change introduces some overlap between `mbedtls_ssl_session.minor_ver` and
`mbedtls_ssl_context.minor_ver`, which should be studied and potentially resolved.
However, with both fields being private and explicitly marked so, this can happen
in a later change.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
2021-07-23 06:25:48 +01:00
..
.gitignore Ignore generated source files that are no longer checked in 2021-05-20 10:37:22 +02:00
aes.c Merge pull request #4469 from xiaoxiang781216/padlock 2021-05-28 11:06:40 +02:00
aesni.c Move aesni.h to library 2021-03-10 12:52:37 +00:00
aesni.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
aria.c ARIA: add missing context init/free 2021-05-25 09:23:10 +02:00
asn1parse.c Add missing const attribute to asn1 api 2021-01-26 13:57:46 +01:00
asn1write.c Add missing const attribute to asn1write api 2021-01-27 15:37:12 +01:00
base64.c Code style fixups 2021-03-04 14:34:50 +00:00
bignum.c Merge remote-tracking branch 'restricted/development-restricted' into mbedtls-3.0.0rc0-pr 2021-06-30 22:51:02 +01:00
bn_mul.h Merge remote-tracking branch 'restricted/development-restricted' into mbedtls-3.0.0rc0-pr 2021-06-30 22:51:02 +01:00
camellia.c CAMELLIA: add missing context init/free 2021-05-25 09:23:10 +02:00
ccm.c Fix additional data length field check for CCM 2020-10-08 12:09:44 +02:00
chacha20.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
chachapoly.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
check_crypto_config.h psa: config: Add CAMELLIA to the list of possible CMAC ciphers 2021-03-25 14:25:46 +01:00
cipher.c Add output_length parameter to mbedtls_gcm_finish 2021-06-23 21:51:32 +02:00
cipher_wrap.c Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
cipher_wrap.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
cmac.c Allow skipping 3DES in CMAC self-test when ALT implemented 2021-03-02 10:18:08 +01:00
CMakeLists.txt Bump .so version numbers to stay ahead of 2.x 2021-07-02 15:19:38 +01:00
common.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ctr_drbg.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
debug.c Add missing parentheses 2021-06-17 21:46:29 +02:00
des.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
dhm.c Make RNG parameters mandatory in DHM functions 2021-06-17 09:38:38 +02:00
ecdh.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
ecdsa.c Add output size parameter to signature functions 2021-06-25 00:46:22 +02:00
ecjpake.c Make RNG parameters mandatory in ECP functions 2021-06-17 09:38:38 +02:00
ecp.c Fix unused parameter warning 2021-06-25 15:29:56 +01:00
ecp_curves.c Add prefix to BYTES_TO_T_UINT_* 2021-06-25 12:46:40 +01:00
ecp_internal_alt.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ecp_invasive.h Move mbedtls_mpi_random to the bignum module 2021-06-03 18:10:04 +02:00
entropy.c Merge pull request #4640 from TRodziewicz/move_part_of_timing_module_out_of_the_library_and_to_test 2021-06-18 16:35:58 +01:00
entropy_poll.c Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
entropy_poll.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
gcm.c Add output_length parameter to mbedtls_gcm_finish 2021-06-23 21:51:32 +02:00
hkdf.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
hmac_drbg.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
Makefile Bump .so version numbers to stay ahead of 2.x 2021-07-02 15:19:38 +01:00
md.c Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
md5.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
md_wrap.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
memory_buffer_alloc.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
mps_common.h Capitalise MPS trace macros 2021-04-07 12:45:35 +01:00
mps_error.h Fix Doxygen headers for MPS files 2021-03-29 14:20:18 +01:00
mps_reader.c Capitalise MPS trace macros 2021-04-07 12:45:35 +01:00
mps_reader.h Fix Doxygen headers for MPS files 2021-03-29 14:20:18 +01:00
mps_trace.c Capitalise MPS trace macros 2021-04-07 12:45:35 +01:00
mps_trace.h Capitalise MPS trace macros 2021-04-07 12:45:35 +01:00
net_sockets.c Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
nist_kw.c Fix null pointer arithmetic in error case 2021-06-01 11:22:56 +02:00
oid.c Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
padlock.c Move padlock.h to library 2021-03-10 12:52:37 +00:00
padlock.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
pem.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
pk.c Add output size parameter to signature functions 2021-06-25 00:46:22 +02:00
pk_wrap.c Fix the build with MBEDTLS_ECP_RESTARTABLE enabled 2021-06-25 00:46:22 +02:00
pk_wrap.h Merge pull request #4694 from gilles-peskine-arm/out_size-3.0 2021-06-29 09:43:17 +02:00
pkcs5.c Apply MBEDTLS_ERROR_ADD to library 2021-04-15 11:19:47 +01:00
pkcs12.c Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
pkparse.c Merge pull request #4588 from TRodziewicz/remove_MD2_MD4_RC4_Blowfish_and_XTEA 2021-06-22 09:27:41 +02:00
pkwrite.c Merge branch 'development_3.0' into remove_depr_error_codes 2021-04-21 12:31:43 +02:00
platform.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
platform_util.c Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
poly1305.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
psa_crypto.c Remove invalid buffer overflow check 2021-06-29 19:55:24 +02:00
psa_crypto_aead.c Update all uses of old AEAD output size macros 2021-04-15 17:32:06 +02:00
psa_crypto_aead.h psa: aead: Move AEAD driver entry points to psa_crypto_aead.c 2021-04-07 16:03:31 +02:00
psa_crypto_cipher.c Remove obsolete comment 2021-06-30 10:46:00 +02:00
psa_crypto_cipher.h Remove invalid buffer overflow check 2021-06-29 19:55:24 +02:00
psa_crypto_client.c Move the inclusion of crypto_spe.h to psa/crypto_platform.h 2021-06-17 11:43:58 +02:00
psa_crypto_core.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
psa_crypto_driver_wrappers.c Fix possible unreachable code 2021-06-29 19:49:01 +02:00
psa_crypto_driver_wrappers.h Dispatch cipher functions through the driver interface 2021-06-29 19:48:59 +02:00
psa_crypto_ecp.c Move mbedtls_md_info_from_psa into the mbedtls hash driver 2021-03-15 12:14:40 +01:00
psa_crypto_ecp.h psa: Rework ECDSA sign/verify support in the transparent test driver 2021-02-18 15:45:12 +01:00
psa_crypto_hash.c Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
psa_crypto_hash.h Merge branch 'development' into development_3.0 2021-04-19 10:51:59 +02:00
psa_crypto_invasive.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
psa_crypto_its.h Update documentation 2020-11-25 13:10:50 +01:00
psa_crypto_mac.c Merge pull request #4316 from gabor-mezei-arm/3258_implement_one-shot_MAC 2021-06-22 12:18:25 +02:00
psa_crypto_mac.h Move is_sign and mac_size checking back to PSA core scope 2021-05-10 11:29:13 +02:00
psa_crypto_random_impl.h Work around MSVC bug with duplicate static declarations 2021-02-16 18:55:05 +01:00
psa_crypto_rsa.c Merge pull request #4665 from yanesca/issue-3990-fix_psa_verify_with_alt 2021-06-23 11:47:38 +02:00
psa_crypto_rsa.h psa: Add RSA sign/verify hash support to the transparent test driver 2021-02-18 15:45:06 +01:00
psa_crypto_se.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
psa_crypto_se.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
psa_crypto_slot_management.c Fix comment 2021-06-29 17:06:33 +02:00
psa_crypto_slot_management.h psa: Fix error code when creating/registering a key with invalid id 2021-04-01 14:05:41 +02:00
psa_crypto_storage.c Merge pull request #4673 from gilles-peskine-arm/psa_crypto_spm-from_platform_h 2021-06-25 09:01:08 +02:00
psa_crypto_storage.h Rename PSA_KEY_SLOT_COUNT to MBEDTLS_PSA_KEY_SLOT_COUNT 2021-02-15 14:26:44 +01:00
psa_its_file.c Add missing common.h include. 2021-05-27 14:40:40 +02:00
ripemd160.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
rsa.c Remove redundant hash len check 2021-07-08 12:46:26 +01:00
rsa_alt_helpers.c Rename rsa_internal.* to rsa_alt_helpers.* 2021-03-10 12:52:37 +00:00
rsa_alt_helpers.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
sha1.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
sha256.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
sha512.c Rename the _ret() functions 2021-06-08 16:45:41 +02:00
ssl_cache.c Fix search for outdated entries in SSL session cache 2021-05-14 14:55:15 +01:00
ssl_ciphersuites.c Code review fixes 2021-06-18 12:59:38 +02:00
ssl_cli.c Store TLS version in SSL session structure 2021-07-23 06:25:48 +01:00
ssl_cookie.c Remove the TLS 1.0 and 1.1 support 2021-05-24 12:45:20 +02:00
ssl_invasive.h Merge pull request #736 from mpg/cf-varpos-copy-dev-restricted 2020-08-25 14:35:55 +01:00
ssl_misc.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ssl_msg.c Remove MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO 2021-06-28 12:35:08 +01:00
ssl_srv.c Store TLS version in SSL session structure 2021-07-23 06:25:48 +01:00
ssl_ticket.c Rename ssl_internal.h to ssl_misc.h 2021-03-10 12:52:37 +00:00
ssl_tls.c Store TLS version in SSL session structure 2021-07-23 06:25:48 +01:00
ssl_tls13_keys.c Remove misleading comment in TLS 1.3 key schedule code 2021-05-31 19:40:45 +01:00
ssl_tls13_keys.h Fix Doxygen for TLS 1.3 PSK binder helper 2021-05-26 04:47:29 +01:00
threading.c Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
timing.c Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
version.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
x509.c Merge pull request #3777 from hanno-arm/x509-info-optimization_rebased 2021-04-28 17:31:55 +01:00
x509_create.c Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
x509_crl.c Merge pull request #3777 from hanno-arm/x509-info-optimization_rebased 2021-04-28 17:31:55 +01:00
x509_crt.c Merge pull request #4671 from mpg/x509-crt-profile-public 2021-06-23 16:06:12 +01:00
x509_csr.c Merge pull request #3777 from hanno-arm/x509-info-optimization_rebased 2021-04-28 17:31:55 +01:00
x509write_crt.c Add output size parameter to signature functions 2021-06-25 00:46:22 +02:00
x509write_csr.c Add output size parameter to signature functions 2021-06-25 00:46:22 +02:00