mirror of
https://github.com/cuberite/polarssl.git
synced 2025-10-02 10:00:47 -04:00
Change the number of expected free key slots
TLS code now uses PSA to generate an ECDH private key. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
41b7e66e61
commit
39d88d4918
@ -5600,6 +5600,7 @@ void raw_key_agreement_fail( )
|
|||||||
enum { BUFFSIZE = 17000 };
|
enum { BUFFSIZE = 17000 };
|
||||||
mbedtls_endpoint client, server;
|
mbedtls_endpoint client, server;
|
||||||
mbedtls_psa_stats_t stats;
|
mbedtls_psa_stats_t stats;
|
||||||
|
size_t free_slots_before = -1;
|
||||||
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
mbedtls_timing_delay_context timer_client, timer_server;
|
mbedtls_timing_delay_context timer_client, timer_server;
|
||||||
@ -5649,6 +5650,11 @@ void raw_key_agreement_fail( )
|
|||||||
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE )
|
MBEDTLS_SSL_CLIENT_KEY_EXCHANGE )
|
||||||
== 0 );
|
== 0 );
|
||||||
|
|
||||||
|
mbedtls_psa_get_stats( &stats );
|
||||||
|
/* Save the number of slots in use up to this point.
|
||||||
|
* With PSA, one can be used for the ECDH private key. */
|
||||||
|
free_slots_before = stats.empty_slots;
|
||||||
|
|
||||||
/* Force a simulated bitflip in the server key. to make the
|
/* Force a simulated bitflip in the server key. to make the
|
||||||
* raw key agreement in ssl_write_client_key_exchange fail. */
|
* raw key agreement in ssl_write_client_key_exchange fail. */
|
||||||
(client.ssl).handshake->ecdh_psa_peerkey[5] ^= 0x02;
|
(client.ssl).handshake->ecdh_psa_peerkey[5] ^= 0x02;
|
||||||
@ -5661,11 +5667,15 @@ void raw_key_agreement_fail( )
|
|||||||
mbedtls_psa_get_stats( &stats );
|
mbedtls_psa_get_stats( &stats );
|
||||||
|
|
||||||
/* Make sure that the key slot is destroyed properly in case of failure. */
|
/* Make sure that the key slot is destroyed properly in case of failure. */
|
||||||
TEST_ASSERT( stats.empty_slots == MBEDTLS_PSA_KEY_SLOT_COUNT );
|
TEST_ASSERT( free_slots_before == stats.empty_slots );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_endpoint_free( &client, &client_context );
|
mbedtls_endpoint_free( &client, &client_context );
|
||||||
mbedtls_endpoint_free( &server, &server_context );
|
mbedtls_endpoint_free( &server, &server_context );
|
||||||
|
|
||||||
|
mbedtls_psa_get_stats( &stats );
|
||||||
|
TEST_ASSERT( stats.empty_slots == MBEDTLS_PSA_KEY_SLOT_COUNT );
|
||||||
|
|
||||||
USE_PSA_DONE( );
|
USE_PSA_DONE( );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user