Merge remote-tracking branch 'origin/pr/598' into baremetal

This commit is contained in:
Simon Butcher
2019-06-18 15:00:02 +01:00
22 changed files with 132 additions and 67 deletions

View File

@@ -565,8 +565,14 @@
#error "MBEDTLS_SSL_TLS_C defined, but no protocol version is active"
#endif
/* PROTO_TLS is not a documented option so far, but still check for conflicts
* involving it, in preparation for making it the documented option later */
#if defined(MBEDTLS_SSL_PROTO_TLS) && defined(MBEDTLS_SSL_PROTO_NO_TLS)
#error "MBEDTLS_SSL_PROTO_TLS and MBEDTLS_SSL_PROTO_NO_TLS both defined"
#endif
#if defined(MBEDTLS_SSL_TLS_C) && \
( !defined(MBEDTLS_SSL_PROTO_TLS) && !defined(MBEDTLS_SSL_PROTO_DTLS) )
( defined(MBEDTLS_SSL_PROTO_NO_TLS) && !defined(MBEDTLS_SSL_PROTO_DTLS) )
#error "MBEDTLS_SSL_TLS_C defined, but neither TLS or DTLS is active"
#endif

View File

@@ -1535,7 +1535,7 @@
* Enable this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2,
* and/or this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0.
*
* \see MBEDTLS_SSL_PROTO_TLS
* \see MBEDTLS_SSL_PROTO_NO_TLS
*
* Requires: MBEDTLS_SSL_PROTO_TLS1_1
* or MBEDTLS_SSL_PROTO_TLS1_2
@@ -1545,25 +1545,23 @@
#define MBEDTLS_SSL_PROTO_DTLS
/**
* \def MBEDTLS_SSL_PROTO_TLS
* \def MBEDTLS_SSL_PROTO_NO_TLS
*
* Enable support for SSL/TLS (all available versions).
* Disable support for SSL/TLS (all available versions) - this doesn't affect
* support for DTLS which is controlled by #MBEDTLS_SSL_PROTO_DTLS. This is
* useful to reduce code size in configurations where only DTLS is used.
*
* Enable this and MBEDTLS_SSL_PROTO_TLS1_2 to enable TLS 1.2;
* enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable TLS 1.1;
* enable this and MBEDTLS_SSL_PROTO_TLS1 to enable TLS 1.0;
* and/or this and MBEDTLS_SSL_PROTO_SSL3 to enable SSL 3.0 (deprecated).
* Disable this and enable MBEDTLS_SSL_PROTO_TLS1_2 to enable TLS 1.2;
* disable this and enable MBEDTLS_SSL_PROTO_TLS1_1 to enable TLS 1.1;
* disable this and enable MBEDTLS_SSL_PROTO_TLS1 to enable TLS 1.0;
* disable this and enable MBEDTLS_SSL_PROTO_SSL3 to enable SSL 3.0.
*
* \see MBEDTLS_SSL_PROTO_DTLS
* Requirements: if this macro is disabled, at least one of the above
* TLS versions needs to be enabled.
*
* Requires: MBEDTLS_SSL_PROTO_TLS1_2
* or MBEDTLS_SSL_PROTO_TLS1_1
* or MBEDTLS_SSL_PROTO_TLS1
* or MBEDTLS_SSL_PROTO_SSL3 (deprecated)
*
* Comment this macro to disable support for TLS
* Uncomment this macro to disable support for TLS.
*/
#define MBEDTLS_SSL_PROTO_TLS
//#define MBEDTLS_SSL_PROTO_NO_TLS
/**
* \def MBEDTLS_SSL_ALPN

View File

@@ -1343,8 +1343,8 @@ void mbedtls_ssl_conf_endpoint( mbedtls_ssl_config *conf, int endpoint );
/**
* \brief Set the transport type (TLS or DTLS).
* Default: TLS if #MBEDTLS_SSL_PROTO_TLS is defined, else
* DTLS.
* Default: TLS unless #MBEDTLS_SSL_PROTO_NO_TLS is defined,
* else DTLS.
*
* \note For DTLS, you must either provide a recv callback that
* doesn't block, or one that handles timeouts, see

View File

@@ -58,6 +58,12 @@
#define inline __inline
#endif
/* The public option is negative for backwards compatibility,
* but internally a poisitive option is more convenient. */
#if !defined(MBEDTLS_SSL_PROTO_NO_TLS)
#define MBEDTLS_SSL_PROTO_TLS
#endif
/* Determine minimum supported version */
#define MBEDTLS_SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3
@@ -963,8 +969,11 @@ static inline size_t mbedtls_ssl_hs_hdr_len( const mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_DTLS)
if( MBEDTLS_SSL_TRANSPORT_IS_DTLS( ssl->conf->transport ) )
return( 12 );
MBEDTLS_SSL_TRANSPORT_ELSE
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS)
return( 4 );
#endif
return( 4 );
}
#if defined(MBEDTLS_SSL_PROTO_DTLS)