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-08 07:55:27 -04:00
parent cb33bc5d0b
commit 28f883eba5

View file

@ -5594,7 +5594,7 @@ void cid_sanity( )
}
/* 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 };
@ -5602,18 +5602,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
uint16_t iana_tls_group_list[] = { MBEDTLS_SSL_IANA_TLS_GROUP_SECP256R1,
MBEDTLS_SSL_IANA_TLS_GROUP_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
@ -5621,25 +5611,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, iana_tls_group_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, iana_tls_group_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),
@ -5670,8 +5648,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 );