Add a group_list argument to mocked ssl tests
This will be used to force a group list in certain tests Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
1c7c5969ea
commit
74394a5c39
1 changed files with 14 additions and 9 deletions
|
@ -892,7 +892,8 @@ exit:
|
||||||
int mbedtls_endpoint_init( mbedtls_endpoint *ep, int endpoint_type, int pk_alg,
|
int mbedtls_endpoint_init( mbedtls_endpoint *ep, int endpoint_type, int pk_alg,
|
||||||
mbedtls_test_message_socket_context *dtls_context,
|
mbedtls_test_message_socket_context *dtls_context,
|
||||||
mbedtls_test_message_queue *input_queue,
|
mbedtls_test_message_queue *input_queue,
|
||||||
mbedtls_test_message_queue *output_queue )
|
mbedtls_test_message_queue *output_queue,
|
||||||
|
uint16_t* group_list )
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
uintptr_t user_data_n;
|
uintptr_t user_data_n;
|
||||||
|
@ -965,6 +966,9 @@ int mbedtls_endpoint_init( mbedtls_endpoint *ep, int endpoint_type, int pk_alg,
|
||||||
MBEDTLS_SSL_PRESET_DEFAULT );
|
MBEDTLS_SSL_PRESET_DEFAULT );
|
||||||
TEST_ASSERT( ret == 0 );
|
TEST_ASSERT( ret == 0 );
|
||||||
|
|
||||||
|
if( group_list != NULL )
|
||||||
|
mbedtls_ssl_conf_groups( &(ep->conf), group_list );
|
||||||
|
|
||||||
ret = mbedtls_ssl_setup( &( ep->ssl ), &( ep->conf ) );
|
ret = mbedtls_ssl_setup( &( ep->ssl ), &( ep->conf ) );
|
||||||
TEST_ASSERT( ret == 0 );
|
TEST_ASSERT( ret == 0 );
|
||||||
|
|
||||||
|
@ -1936,7 +1940,7 @@ void perform_handshake( handshake_test_options* options )
|
||||||
TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
|
TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
|
||||||
options->pk_alg, &client_context,
|
options->pk_alg, &client_context,
|
||||||
&client_queue,
|
&client_queue,
|
||||||
&server_queue ) == 0 );
|
&server_queue, NULL ) == 0 );
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
mbedtls_ssl_set_timer_cb( &client.ssl, &timer_client,
|
mbedtls_ssl_set_timer_cb( &client.ssl, &timer_client,
|
||||||
mbedtls_timing_set_delay,
|
mbedtls_timing_set_delay,
|
||||||
|
@ -1947,7 +1951,7 @@ void perform_handshake( handshake_test_options* options )
|
||||||
{
|
{
|
||||||
TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
|
TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
|
||||||
options->pk_alg, NULL, NULL,
|
options->pk_alg, NULL, NULL,
|
||||||
NULL ) == 0 );
|
NULL, NULL ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( options->client_min_version != TEST_SSL_MINOR_VERSION_NONE )
|
if( options->client_min_version != TEST_SSL_MINOR_VERSION_NONE )
|
||||||
|
@ -1982,7 +1986,7 @@ void perform_handshake( handshake_test_options* options )
|
||||||
TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
|
TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
|
||||||
options->pk_alg, &server_context,
|
options->pk_alg, &server_context,
|
||||||
&server_queue,
|
&server_queue,
|
||||||
&client_queue) == 0 );
|
&client_queue, NULL ) == 0 );
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
mbedtls_ssl_set_timer_cb( &server.ssl, &timer_server,
|
mbedtls_ssl_set_timer_cb( &server.ssl, &timer_server,
|
||||||
mbedtls_timing_set_delay,
|
mbedtls_timing_set_delay,
|
||||||
|
@ -1992,7 +1996,8 @@ void perform_handshake( handshake_test_options* options )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
|
TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
|
||||||
options->pk_alg, NULL, NULL, NULL ) == 0 );
|
options->pk_alg, NULL, NULL,
|
||||||
|
NULL, NULL ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_ssl_conf_authmode( &server.conf, options->srv_auth_mode );
|
mbedtls_ssl_conf_authmode( &server.conf, options->srv_auth_mode );
|
||||||
|
@ -4847,14 +4852,14 @@ void mbedtls_endpoint_sanity( int endpoint_type )
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
ret = mbedtls_endpoint_init( NULL, endpoint_type, MBEDTLS_PK_RSA,
|
ret = mbedtls_endpoint_init( NULL, endpoint_type, MBEDTLS_PK_RSA,
|
||||||
NULL, NULL, NULL );
|
NULL, NULL, NULL, NULL );
|
||||||
TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
|
TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
|
||||||
|
|
||||||
ret = mbedtls_endpoint_certificate_init( NULL, MBEDTLS_PK_RSA );
|
ret = mbedtls_endpoint_certificate_init( NULL, MBEDTLS_PK_RSA );
|
||||||
TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
|
TEST_ASSERT( MBEDTLS_ERR_SSL_BAD_INPUT_DATA == ret );
|
||||||
|
|
||||||
ret = mbedtls_endpoint_init( &ep, endpoint_type, MBEDTLS_PK_RSA,
|
ret = mbedtls_endpoint_init( &ep, endpoint_type, MBEDTLS_PK_RSA,
|
||||||
NULL, NULL, NULL );
|
NULL, NULL, NULL, NULL );
|
||||||
TEST_ASSERT( ret == 0 );
|
TEST_ASSERT( ret == 0 );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@ -4870,13 +4875,13 @@ void move_handshake_to_state(int endpoint_type, int state, int need_pass)
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
ret = mbedtls_endpoint_init( &base_ep, endpoint_type, MBEDTLS_PK_RSA,
|
ret = mbedtls_endpoint_init( &base_ep, endpoint_type, MBEDTLS_PK_RSA,
|
||||||
NULL, NULL, NULL );
|
NULL, NULL, NULL, NULL );
|
||||||
TEST_ASSERT( ret == 0 );
|
TEST_ASSERT( ret == 0 );
|
||||||
|
|
||||||
ret = mbedtls_endpoint_init( &second_ep,
|
ret = mbedtls_endpoint_init( &second_ep,
|
||||||
( endpoint_type == MBEDTLS_SSL_IS_SERVER ) ?
|
( endpoint_type == MBEDTLS_SSL_IS_SERVER ) ?
|
||||||
MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER,
|
MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER,
|
||||||
MBEDTLS_PK_RSA, NULL, NULL, NULL );
|
MBEDTLS_PK_RSA, NULL, NULL, NULL, NULL );
|
||||||
TEST_ASSERT( ret == 0 );
|
TEST_ASSERT( ret == 0 );
|
||||||
|
|
||||||
ret = mbedtls_mock_socket_connect( &(base_ep.socket),
|
ret = mbedtls_mock_socket_connect( &(base_ep.socket),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue