Merge pull request #6255 from mprse/md_tls13
Driver-only hashes: TLS 1.3
This commit is contained in:
commit
409a620dea
7 changed files with 65 additions and 44 deletions
|
@ -77,7 +77,11 @@
|
|||
#if defined(MBEDTLS_PK_C) && defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#define MBEDTLS_PK_WRITE_C
|
||||
#endif
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
|
||||
|
||||
/* Make sure all configuration symbols are set before including check_config.h,
|
||||
* even the ones that are calculated programmatically. */
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG) /* PSA_WANT_xxx influences MBEDTLS_xxx */ || \
|
||||
defined(MBEDTLS_PSA_CRYPTO_C) /* MBEDTLS_xxx influences PSA_WANT_xxx */
|
||||
#include "mbedtls/config_psa.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -750,18 +750,29 @@
|
|||
#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* HKDF is mandatory for TLS 1.3.
|
||||
* Otherwise support for at least one ciphersuite mandates either SHA_256 or
|
||||
* SHA_384.
|
||||
*/
|
||||
/* TLS 1.3 requires separate HKDF parts from PSA */
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && \
|
||||
( ( !defined(MBEDTLS_HKDF_C) ) || \
|
||||
( !defined(MBEDTLS_SHA256_C) && !defined(MBEDTLS_SHA384_C) ) || \
|
||||
( !defined(MBEDTLS_PSA_CRYPTO_C) ) )
|
||||
!( defined(MBEDTLS_PSA_CRYPTO_C) && defined(PSA_WANT_ALG_HKDF_EXTRACT) && defined(PSA_WANT_ALG_HKDF_EXPAND) )
|
||||
#error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
/* TLS 1.3 requires at least one ciphersuite, so at least SHA-256 or SHA-384 */
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
/* We always need at least one of the hashes via PSA (for use with HKDF) */
|
||||
#if !( defined(PSA_WANT_ALG_SHA_256) || defined(PSA_WANT_ALG_SHA_384) )
|
||||
#error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites"
|
||||
#endif /* !(PSA_WANT_ALG_SHA_256 || PSA_WANT_ALG_SHA_384) */
|
||||
#if !defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
/* When USE_PSA_CRYPTO is not defined, we also need SHA-256 or SHA-384 via the
|
||||
* legacy interface, including via the MD layer, for the parts of the code
|
||||
* that are shared with TLS 1.2 (running handshake hash). */
|
||||
#if !defined(MBEDTLS_MD_C) || \
|
||||
!( defined(MBEDTLS_SHA256_C) || defined(MBEDTLS_SHA384_C) )
|
||||
#error "MBEDTLS_SSL_PROTO_TLS1_3 defined, but not all prerequisites"
|
||||
#endif /* !MBEDTLS_MD_C || !(MBEDTLS_SHA256_C || MBEDTLS_SHA384_C) */
|
||||
#endif /* !MBEDTLS_USE_PSA_CRYPTO */
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||
|
||||
/*
|
||||
* The current implementation of TLS 1.3 requires MBEDTLS_SSL_KEEP_PEER_CERTIFICATE.
|
||||
*/
|
||||
|
|
|
@ -338,11 +338,11 @@
|
|||
#define MBEDTLS_SSL_SRV_CIPHERSUITE_ORDER_SERVER 0
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
#if defined(MBEDTLS_SHA384_C)
|
||||
#if defined(PSA_WANT_ALG_SHA_384)
|
||||
#define MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN 48
|
||||
#elif defined(MBEDTLS_SHA256_C)
|
||||
#elif defined(PSA_WANT_ALG_SHA_256)
|
||||
#define MBEDTLS_SSL_TLS1_3_TICKET_RESUMPTION_KEY_LEN 32
|
||||
#endif /* MBEDTLS_SHA256_C */
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 && MBEDTLS_SSL_SESSION_TICKETS */
|
||||
/*
|
||||
* Default range for DTLS retransmission timer value, in milliseconds.
|
||||
|
@ -629,7 +629,12 @@ union mbedtls_ssl_premaster_secret
|
|||
|
||||
#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
#define MBEDTLS_TLS1_3_MD_MAX_SIZE PSA_HASH_MAX_SIZE
|
||||
#else
|
||||
#define MBEDTLS_TLS1_3_MD_MAX_SIZE MBEDTLS_MD_MAX_SIZE
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
|
||||
/* Length in number of bytes of the TLS sequence number */
|
||||
#define MBEDTLS_SSL_SEQUENCE_NUMBER_LEN 8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue