Clarify a few more comments and documentation

This commit is contained in:
Manuel Pégourié-Gonnard 2019-06-11 10:04:57 +02:00
parent c6d9e3a28f
commit 8794a4290d
3 changed files with 7 additions and 6 deletions

View file

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

View file

@ -269,8 +269,8 @@
* *
* Goals for these helpers: * Goals for these helpers:
* - generate minimal code, eg don't test if mode is DTLS in a DTLS-only build * - generate minimal code, eg don't test if mode is DTLS in a DTLS-only build
* - make the flow clear to the compiler, ie that in dual-mode builds, * - make the flow clear to the compiler, so that in TLS and DTLS combined
* when there are two branchs, exactly one of them is taken * builds, when there are two branches, it knows exactly one of them is taken
* - preserve readability * - preserve readability
* *
* There are three macros: * There are three macros:
@ -299,7 +299,7 @@
* #endif * #endif
*/ */
#if defined(MBEDTLS_SSL_PROTO_DTLS) && defined(MBEDTLS_SSL_PROTO_TLS) /* both */ #if defined(MBEDTLS_SSL_PROTO_DTLS) && defined(MBEDTLS_SSL_PROTO_TLS) /* both */
#define MBEDTLS_SSL_TRANSPORT__BOTH /* shorcut for future tests */ #define MBEDTLS_SSL_TRANSPORT__BOTH /* shortcut for future tests */
#define MBEDTLS_SSL_TRANSPORT_IS_TLS( transport ) \ #define MBEDTLS_SSL_TRANSPORT_IS_TLS( transport ) \
( (transport) == MBEDTLS_SSL_TRANSPORT_STREAM ) ( (transport) == MBEDTLS_SSL_TRANSPORT_STREAM )
#define MBEDTLS_SSL_TRANSPORT_IS_DTLS( transport ) \ #define MBEDTLS_SSL_TRANSPORT_IS_DTLS( transport ) \

View file

@ -4925,7 +4925,7 @@ static int ssl_prepare_record_content( mbedtls_ssl_context *ssl )
if( ++ssl->in_ctr[i - 1] != 0 ) if( ++ssl->in_ctr[i - 1] != 0 )
break; break;
/* The loop goes to its end iff the counter is wrapping */ /* The loop goes to its end only if the counter is wrapping around */
if( i == 0 ) if( i == 0 )
{ {
MBEDTLS_SSL_DEBUG_MSG( 1, ( "incoming message counter would wrap" ) ); MBEDTLS_SSL_DEBUG_MSG( 1, ( "incoming message counter would wrap" ) );
@ -10841,7 +10841,7 @@ void mbedtls_ssl_read_version( int *major, int *minor, int transport,
++*minor; /* DTLS 1.0 stored as TLS 1.1 internally */ ++*minor; /* DTLS 1.0 stored as TLS 1.1 internally */
} }
MBEDTLS_SSL_TRANSPORT_ELSE MBEDTLS_SSL_TRANSPORT_ELSE
#endif #endif /* MBEDTLS_SSL_PROTO_DTLS */
#if defined(MBEDTLS_SSL_PROTO_TLS) #if defined(MBEDTLS_SSL_PROTO_TLS)
{ {
*major = ver[0]; *major = ver[0];