Add explicit mbedtls_ecp_tls_read_group_id call

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis 2022-09-20 10:00:07 +01:00
parent 7403d93f8a
commit ccae25b4bf

View File

@ -798,6 +798,7 @@ void mbedtls_ecp_group_metadata( int id, int bit_size, int crv_type,
{
mbedtls_ecp_group grp, grp_read, grp_cpy;
const mbedtls_ecp_group_id *g_id;
mbedtls_ecp_group_id read_g_id;
const mbedtls_ecp_curve_info *crv, *crv_tls_id, *crv_name;
mbedtls_mpi exp_P, exp_A, exp_B, exp_G_x, exp_G_y, exp_N;
@ -860,13 +861,18 @@ void mbedtls_ecp_group_metadata( int id, int bit_size, int crv_type,
TEST_EQUAL( crv_tls_id->grp_id, id );
TEST_EQUAL( crv_name->grp_id, id );
// Validate write_group against test data, read result
// Validate write_group against test data
TEST_EQUAL( mbedtls_ecp_tls_write_group( &grp, &olen,
buf, sizeof( buf ) ),
0 );
TEST_EQUAL( mbedtls_test_hexcmp( buf, ecparameters, olen,
sizeof( ecparameters ) ),
0 );
// Read group from buffer and compare with expected ID
TEST_EQUAL( mbedtls_ecp_tls_read_group_id( &read_g_id, &vbuf, olen ),
0 );
TEST_EQUAL( read_g_id, id );
TEST_EQUAL( mbedtls_ecp_tls_read_group( &grp_read, &vbuf, olen ),
0 );
TEST_EQUAL( grp_read.id, id );