Make conf const inside ssl_context (finally)

This commit is contained in:
Manuel Pégourié-Gonnard 2015-05-10 23:27:38 +02:00
parent 17a40cd255
commit 1897af9e93
3 changed files with 7 additions and 6 deletions

View File

@ -945,7 +945,7 @@ mbedtls_ssl_config;
struct mbedtls_ssl_context struct mbedtls_ssl_context
{ {
mbedtls_ssl_config *conf; /*!< configuration information */ const mbedtls_ssl_config *conf; /*!< configuration information */
/* /*
* Miscellaneous * Miscellaneous
@ -1157,7 +1157,7 @@ void mbedtls_ssl_init( mbedtls_ssl_context *ssl );
* memory allocation failed * memory allocation failed
*/ */
int mbedtls_ssl_setup( mbedtls_ssl_context *ssl, int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
mbedtls_ssl_config *conf ); const mbedtls_ssl_config *conf );
/** /**
* \brief Reset an already initialized SSL context for re-use * \brief Reset an already initialized SSL context for re-use

View File

@ -572,10 +572,11 @@ static int ssl_write_client_hello( mbedtls_ssl_context *ssl )
ssl->minor_ver = ssl->conf->min_minor_ver; ssl->minor_ver = ssl->conf->min_minor_ver;
} }
if( ssl->conf->max_major_ver == 0 && ssl->conf->max_minor_ver == 0 ) if( ssl->conf->max_major_ver == 0 )
{ {
ssl->conf->max_major_ver = MBEDTLS_SSL_MAX_MAJOR_VERSION; MBEDTLS_SSL_DEBUG_MSG( 1, ( "configured max major version is invalid, "
ssl->conf->max_minor_ver = MBEDTLS_SSL_MAX_MINOR_VERSION; "consider using mbedtls_ssl_config_defaults()" ) );
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
} }
/* /*

View File

@ -4959,7 +4959,7 @@ void mbedtls_ssl_init( mbedtls_ssl_context *ssl )
* Setup an SSL context * Setup an SSL context
*/ */
int mbedtls_ssl_setup( mbedtls_ssl_context *ssl, int mbedtls_ssl_setup( mbedtls_ssl_context *ssl,
mbedtls_ssl_config *conf ) const mbedtls_ssl_config *conf )
{ {
int ret; int ret;
const size_t len = MBEDTLS_SSL_BUFFER_LEN; const size_t len = MBEDTLS_SSL_BUFFER_LEN;