case MBEDTLS_ECP_DP_SECP256R1:
NIST_MODP( p256 );
return( LOAD_GROUP( secp256r1 ) );
case MBEDTLS_ECP_DP_SM256:
//NIST_MODP( p256 );
return( LOAD_GROUP_A( sm256 ) );
Then I call the functional interface mbedtls_ecp_mul
to perform the multiplication operation, but the heap memory keeps increasing .
void test()
{
int ret;
mbedtls_mpi Ud;
mbedtls_ecp_group grp;
mbedtls_ecp_point T_Q;
mbedtls_mpi_init(&Ud);
mbedtls_ecp_group_init( &grp );
mbedtls_ecp_point_init( &T_Q );
ret = mbedtls_mpi_read_binary(&Ud, arrUd, sizeof(arr_U_d));
// ret = mbedtls_ecp_group_load(&grp,MBEDTLS_ECP_DP_SECP256R1);
ret = mbedtls_ecp_group_load(&grp,MBEDTLS_ECP_DP_SM256);
ret = mbedtls_ecp_mul(&grp, &T_Q, &Ud, &(grp.G), NULL, NULL) ;
printf("%x\n", -ret);
mbedtls_mpi_free(&Ud);
mbedtls_ecp_group_free( &grp );
mbedtls_ecp_point_free( &T_Q );
}
int main()
{
for(int i = 0; i < 10; i++)
test();
return 0;
}
The heap memory is mesaured by massif( valgring tools),
Can someone tell me what this is because of and how to fix this problem ?
Best Regards.
Shudong Zhang