mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-06-24 01:41:35 +03:00
Change the bit to flip to guarantee failure
For weistrass curves the pair is encoded as 0x04 || x || y. Flipping one of the bits in the first byte should be a sure failure. Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
committed by
Andrzej Kurek
parent
39d88d4918
commit
cb33bc5d0b
@ -5654,10 +5654,10 @@ void raw_key_agreement_fail( )
|
|||||||
/* Save the number of slots in use up to this point.
|
/* Save the number of slots in use up to this point.
|
||||||
* With PSA, one can be used for the ECDH private key. */
|
* With PSA, one can be used for the ECDH private key. */
|
||||||
free_slots_before = stats.empty_slots;
|
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[0] ^= 0x02;
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_move_handshake_to_state( &(client.ssl),
|
TEST_ASSERT( mbedtls_move_handshake_to_state( &(client.ssl),
|
||||||
&(server.ssl),
|
&(server.ssl),
|
||||||
@ -5672,10 +5672,10 @@ void raw_key_agreement_fail( )
|
|||||||
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 );
|
mbedtls_psa_get_stats( &stats );
|
||||||
TEST_ASSERT( stats.empty_slots == MBEDTLS_PSA_KEY_SLOT_COUNT );
|
TEST_ASSERT( stats.empty_slots == MBEDTLS_PSA_KEY_SLOT_COUNT );
|
||||||
|
|
||||||
USE_PSA_DONE( );
|
USE_PSA_DONE( );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
Reference in New Issue
Block a user