mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:15:43 +01:00
Rename ssl_session.length to id_len
This commit is contained in:
parent
797f48ace6
commit
12ad798c87
@ -445,7 +445,7 @@ struct mbedtls_ssl_session
|
||||
#endif
|
||||
int ciphersuite; /*!< chosen ciphersuite */
|
||||
int compression; /*!< chosen compression */
|
||||
size_t length; /*!< session id length */
|
||||
size_t id_len; /*!< session id length */
|
||||
unsigned char id[32]; /*!< session identifier */
|
||||
unsigned char master[48]; /*!< the master secret */
|
||||
|
||||
|
@ -86,11 +86,11 @@ int mbedtls_ssl_cache_get( void *data, mbedtls_ssl_session *session )
|
||||
|
||||
if( session->ciphersuite != entry->session.ciphersuite ||
|
||||
session->compression != entry->session.compression ||
|
||||
session->length != entry->session.length )
|
||||
session->id_len != entry->session.id_len )
|
||||
continue;
|
||||
|
||||
if( memcmp( session->id, entry->session.id,
|
||||
entry->session.length ) != 0 )
|
||||
entry->session.id_len ) != 0 )
|
||||
continue;
|
||||
|
||||
memcpy( session->master, entry->session.master, 48 );
|
||||
@ -167,7 +167,7 @@ int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session )
|
||||
}
|
||||
#endif
|
||||
|
||||
if( memcmp( session->id, cur->session.id, cur->session.length ) == 0 )
|
||||
if( memcmp( session->id, cur->session.id, cur->session.id_len ) == 0 )
|
||||
break; /* client reconnected, keep timestamp for session id */
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
|
@ -587,7 +587,7 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
||||
* .. . .. extensions length (2 bytes)
|
||||
* .. . .. extensions
|
||||
*/
|
||||
n = ssl->session_negotiate->length;
|
||||
n = ssl->session_negotiate->id_len;
|
||||
|
||||
if( n < 16 || n > 32 ||
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
@ -615,7 +615,7 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
ssl->session_negotiate->length = n = 32;
|
||||
ssl->session_negotiate->id_len = n = 32;
|
||||
}
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
@ -1345,7 +1345,7 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
||||
#endif
|
||||
ssl->session_negotiate->ciphersuite != i ||
|
||||
ssl->session_negotiate->compression != comp ||
|
||||
ssl->session_negotiate->length != n ||
|
||||
ssl->session_negotiate->id_len != n ||
|
||||
memcmp( ssl->session_negotiate->id, buf + 35, n ) != 0 )
|
||||
{
|
||||
ssl->state++;
|
||||
@ -1355,7 +1355,7 @@ static int ssl_parse_server_hello( mbedtls_ssl_context *ssl )
|
||||
#endif
|
||||
ssl->session_negotiate->ciphersuite = i;
|
||||
ssl->session_negotiate->compression = comp;
|
||||
ssl->session_negotiate->length = n;
|
||||
ssl->session_negotiate->id_len = n;
|
||||
memcpy( ssl->session_negotiate->id, buf + 35, n );
|
||||
}
|
||||
else
|
||||
@ -2902,7 +2902,7 @@ static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl )
|
||||
* discards any Session ID that was sent in the ServerHello."
|
||||
*/
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ticket in use, discarding session id" ) );
|
||||
ssl->session_negotiate->length = 0;
|
||||
ssl->session_negotiate->id_len = 0;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= parse new session ticket" ) );
|
||||
|
||||
|
@ -454,8 +454,8 @@ static int ssl_parse_session_ticket_ext( mbedtls_ssl_context *ssl,
|
||||
* Keep the session ID sent by the client, since we MUST send it back to
|
||||
* inform them we're accepting the ticket (RFC 5077 section 3.4)
|
||||
*/
|
||||
session.length = ssl->session_negotiate->length;
|
||||
memcpy( &session.id, ssl->session_negotiate->id, session.length );
|
||||
session.id_len = ssl->session_negotiate->id_len;
|
||||
memcpy( &session.id, ssl->session_negotiate->id, session.id_len );
|
||||
|
||||
mbedtls_ssl_session_free( ssl->session_negotiate );
|
||||
memcpy( ssl->session_negotiate, &session, sizeof( mbedtls_ssl_session ) );
|
||||
@ -888,10 +888,10 @@ static int ssl_parse_client_hello_v2( mbedtls_ssl_context *ssl )
|
||||
buf + 6 + ciph_len + sess_len, chal_len );
|
||||
|
||||
p = buf + 6 + ciph_len;
|
||||
ssl->session_negotiate->length = sess_len;
|
||||
ssl->session_negotiate->id_len = sess_len;
|
||||
memset( ssl->session_negotiate->id, 0,
|
||||
sizeof( ssl->session_negotiate->id ) );
|
||||
memcpy( ssl->session_negotiate->id, p, ssl->session_negotiate->length );
|
||||
memcpy( ssl->session_negotiate->id, p, ssl->session_negotiate->id_len );
|
||||
|
||||
p += sess_len;
|
||||
memset( ssl->handshake->randbytes, 0, 64 );
|
||||
@ -1338,11 +1338,11 @@ read_record_header:
|
||||
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, session id", buf + 35, sess_len );
|
||||
|
||||
ssl->session_negotiate->length = sess_len;
|
||||
ssl->session_negotiate->id_len = sess_len;
|
||||
memset( ssl->session_negotiate->id, 0,
|
||||
sizeof( ssl->session_negotiate->id ) );
|
||||
memcpy( ssl->session_negotiate->id, buf + 35,
|
||||
ssl->session_negotiate->length );
|
||||
ssl->session_negotiate->id_len );
|
||||
|
||||
/*
|
||||
* Check the cookie length and content
|
||||
@ -2180,7 +2180,7 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
#if defined(MBEDTLS_SSL_RENEGOTIATION)
|
||||
ssl->renego_status == MBEDTLS_SSL_INITIAL_HANDSHAKE &&
|
||||
#endif
|
||||
ssl->session_negotiate->length != 0 &&
|
||||
ssl->session_negotiate->id_len != 0 &&
|
||||
ssl->conf->f_get_cache != NULL &&
|
||||
ssl->conf->f_get_cache( ssl->conf->p_cache, ssl->session_negotiate ) == 0 )
|
||||
{
|
||||
@ -2203,13 +2203,13 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||
if( ssl->handshake->new_session_ticket != 0 )
|
||||
{
|
||||
ssl->session_negotiate->length = n = 0;
|
||||
ssl->session_negotiate->id_len = n = 0;
|
||||
memset( ssl->session_negotiate->id, 0, 32 );
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
{
|
||||
ssl->session_negotiate->length = n = 32;
|
||||
ssl->session_negotiate->id_len = n = 32;
|
||||
if( ( ret = ssl->conf->f_rng( ssl->conf->p_rng, ssl->session_negotiate->id,
|
||||
n ) ) != 0 )
|
||||
return( ret );
|
||||
@ -2220,7 +2220,7 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
/*
|
||||
* Resuming a session
|
||||
*/
|
||||
n = ssl->session_negotiate->length;
|
||||
n = ssl->session_negotiate->id_len;
|
||||
ssl->state = MBEDTLS_SSL_SERVER_CHANGE_CIPHER_SPEC;
|
||||
|
||||
if( ( ret = mbedtls_ssl_derive_keys( ssl ) ) != 0 )
|
||||
@ -2238,9 +2238,9 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
|
||||
* 42+n . 43+n extensions length
|
||||
* 44+n . 43+n+m extensions
|
||||
*/
|
||||
*p++ = (unsigned char) ssl->session_negotiate->length;
|
||||
memcpy( p, ssl->session_negotiate->id, ssl->session_negotiate->length );
|
||||
p += ssl->session_negotiate->length;
|
||||
*p++ = (unsigned char) ssl->session_negotiate->id_len;
|
||||
memcpy( p, ssl->session_negotiate->id, ssl->session_negotiate->id_len );
|
||||
p += ssl->session_negotiate->id_len;
|
||||
|
||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, session id len.: %d", n ) );
|
||||
MBEDTLS_SSL_DEBUG_BUF( 3, "server hello, session id", buf + 39, n );
|
||||
|
@ -4610,7 +4610,7 @@ void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl )
|
||||
* Add cache entry
|
||||
*/
|
||||
if( ssl->conf->f_set_cache != NULL &&
|
||||
ssl->session->length != 0 &&
|
||||
ssl->session->id_len != 0 &&
|
||||
resume == 0 )
|
||||
{
|
||||
if( ssl->conf->f_set_cache( ssl->conf->p_cache, ssl->session ) != 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user