Remove RSA & DTLS dependency in raw key agreement test

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2022-04-15 06:50:56 -04:00
parent 99f6778b60
commit 86029e04b4

View File

@ -4556,7 +4556,7 @@ exit:
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SSL_PROTO_DTLS:MBEDTLS_ENTROPY_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_CTR_DRBG_C:MBEDTLS_ECP_C */
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_USE_PSA_CRYPTO:MBEDTLS_PKCS1_V15:MBEDTLS_SSL_PROTO_TLS1_2:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ENTROPY_C:MBEDTLS_RSA_C:MBEDTLS_ECP_DP_SECP384R1_ENABLED:MBEDTLS_CTR_DRBG_C:MBEDTLS_ECP_C:MBEDTLS_ECDSA_C */
void raw_key_agreement_fail( )
{
enum { BUFFSIZE = 17000 };
@ -4564,18 +4564,8 @@ void raw_key_agreement_fail( )
mbedtls_psa_stats_t stats;
size_t free_slots_before = -1;
#if defined(MBEDTLS_TIMING_C)
mbedtls_timing_delay_context timer_client, timer_server;
#endif
mbedtls_ecp_group_id curve_list[] = { MBEDTLS_ECP_DP_SECP256R1,
MBEDTLS_ECP_DP_NONE };
mbedtls_test_message_queue server_queue, client_queue;
mbedtls_test_message_socket_context server_context, client_context;
mbedtls_message_socket_init( &server_context );
mbedtls_message_socket_init( &client_context );
USE_PSA_INIT( );
/* Client side, force SECP256R1 to make one key bitflip fail
@ -4583,25 +4573,13 @@ void raw_key_agreement_fail( )
* curve (as opposed to a Montgomery curve) has a high chance of
* making it invalid. */
TEST_ASSERT( mbedtls_endpoint_init( &client, MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_PK_RSA, &client_context,
&client_queue,
&server_queue, curve_list ) == 0 );
#if defined(MBEDTLS_TIMING_C)
mbedtls_ssl_set_timer_cb( &client.ssl, &timer_client,
mbedtls_timing_set_delay,
mbedtls_timing_get_delay );
#endif
MBEDTLS_PK_ECDSA, NULL, NULL,
NULL, curve_list ) == 0 );
/* Server side */
TEST_ASSERT( mbedtls_endpoint_init( &server, MBEDTLS_SSL_IS_SERVER,
MBEDTLS_PK_RSA, &server_context,
&server_queue,
&client_queue, NULL ) == 0 );
#if defined(MBEDTLS_TIMING_C)
mbedtls_ssl_set_timer_cb( &server.ssl, &timer_server,
mbedtls_timing_set_delay,
mbedtls_timing_get_delay );
#endif
MBEDTLS_PK_ECDSA, NULL, NULL,
NULL, NULL ) == 0 );
TEST_ASSERT( mbedtls_mock_socket_connect( &(client.socket),
&(server.socket),
@ -4632,8 +4610,8 @@ void raw_key_agreement_fail( )
TEST_ASSERT( free_slots_before == stats.empty_slots );
exit:
mbedtls_endpoint_free( &client, &client_context );
mbedtls_endpoint_free( &server, &server_context );
mbedtls_endpoint_free( &client, NULL );
mbedtls_endpoint_free( &server, NULL );
mbedtls_psa_get_stats( &stats );
TEST_ASSERT( stats.empty_slots == MBEDTLS_PSA_KEY_SLOT_COUNT );