mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 02:35:38 +01:00
Add getter function for handshake->resume
This makes the code more readable by having fewer #ifdefs all over the place.
This commit is contained in:
parent
44b10761cc
commit
3652e99100
@ -1111,4 +1111,20 @@ static inline unsigned int mbedtls_ssl_conf_get_ems_enforced(
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_EXTENDED_MASTER_SECRET */
|
||||
|
||||
|
||||
/*
|
||||
* Accessor functions for optional fields of various structures
|
||||
*/
|
||||
|
||||
static inline int mbedtls_ssl_handshake_get_resume(
|
||||
const mbedtls_ssl_handshake_params *handshake )
|
||||
{
|
||||
#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION)
|
||||
return( handshake->resume );
|
||||
#else
|
||||
(void) handshake;
|
||||
return( 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* ssl_internal.h */
|
||||
|
@ -888,11 +888,7 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
ssl->renego_status != MBEDTLS_SSL_INITIAL_HANDSHAKE ||
|
||||
#endif
|
||||
#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION)
|
||||
ssl->handshake->resume == 0 )
|
||||
#else /* !MBEDTLS_SSL_NO_SESSION_RESUMPTION */
|
||||
0 )
|
||||
#endif
|
||||
mbedtls_ssl_handshake_get_resume( ssl->handshake ) == 0 )
|
||||
{
|
||||
n = 0;
|
||||
}
|
||||
@ -1839,10 +1835,8 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
||||
memcpy( ssl->session_negotiate->id, buf + 35, n );
|
||||
}
|
||||
|
||||
#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION)
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "%s session has been resumed",
|
||||
ssl->handshake->resume ? "a" : "no" ) );
|
||||
#endif /* !MBEDTLS_SSL_NO_SESSION_RESUMPTION */
|
||||
mbedtls_ssl_handshake_get_resume( ssl->handshake ) ? "a" : "no" ) );
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %04x", i ) );
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: %d", buf[37 + n] ) );
|
||||
|
@ -2643,7 +2643,7 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
* It may be already set to 1 by ssl_parse_session_ticket_ext().
|
||||
* If not, try looking up session ID in our cache.
|
||||
*/
|
||||
if( ssl->handshake->resume == 0 &&
|
||||
if( mbedtls_ssl_handshake_get_resume( ssl->handshake ) == 0 &&
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE &&
|
||||
#endif
|
||||
@ -2657,7 +2657,7 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
#endif /* !MBEDTLS_SSL_NO_SESSION_CACHE */
|
||||
|
||||
#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION)
|
||||
if( ssl->handshake->resume == 1 )
|
||||
if( mbedtls_ssl_handshake_get_resume( ssl->handshake ) == 1 )
|
||||
{
|
||||
/*
|
||||
* Resuming a session
|
||||
@ -2714,10 +2714,8 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, session id len.: %d", n ) );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, session id", buf + 39, n );
|
||||
#if !defined(MBEDTLS_SSL_NO_SESSION_RESUMPTION)
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "%s session has been resumed",
|
||||
ssl->handshake->resume ? "a" : "no" ) );
|
||||
#endif /* !MBEDTLS_SSL_NO_SESSION_RESUMPTION */
|
||||
mbedtls_ssl_handshake_get_resume( ssl->handshake ) ? "a" : "no" ) );
|
||||
|
||||
*p++ = (unsigned char)( ssl->session_negotiate->ciphersuite >> 8 );
|
||||
*p++ = (unsigned char)( ssl->session_negotiate->ciphersuite );
|
||||
|
Loading…
Reference in New Issue
Block a user