mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-04 21:56:21 +01:00
Add ecp_check_pub_priv()
This commit is contained in:
parent
2f8d1f9fc3
commit
30668d688d
4 changed files with 107 additions and 0 deletions
|
|
@ -598,6 +598,32 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecp_check_pub_priv( int id_pub, char *Qx_pub, char *Qy_pub,
|
||||
int id, char *d, char *Qx, char *Qy, int ret )
|
||||
{
|
||||
ecp_keypair pub, prv;
|
||||
|
||||
ecp_keypair_init( &pub );
|
||||
ecp_keypair_init( &prv );
|
||||
|
||||
if( id_pub != POLARSSL_ECP_DP_NONE )
|
||||
TEST_ASSERT( ecp_use_known_dp( &pub.grp, id_pub ) == 0 );
|
||||
TEST_ASSERT( ecp_point_read_string( &pub.Q, 16, Qx_pub, Qy_pub ) == 0 );
|
||||
|
||||
if( id != POLARSSL_ECP_DP_NONE )
|
||||
TEST_ASSERT( ecp_use_known_dp( &prv.grp, id ) == 0 );
|
||||
TEST_ASSERT( ecp_point_read_string( &prv.Q, 16, Qx, Qy ) == 0 );
|
||||
TEST_ASSERT( mpi_read_string( &prv.d, 16, d ) == 0 );
|
||||
|
||||
TEST_ASSERT( ecp_check_pub_priv( &pub, &prv ) == ret );
|
||||
|
||||
exit:
|
||||
ecp_keypair_free( &pub );
|
||||
ecp_keypair_free( &prv );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ecp_gen_keypair( int id )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue