1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-10 05:03:02 +03:00

Add auxiliary ECP comparison function

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
Werner Lewis
2022-08-15 12:56:12 +01:00
parent a77287f8fa
commit 938dc19ef2

View File

@@ -16,6 +16,44 @@
mbedtls_ecp_point_free( x ); \
mbedtls_ecp_point_init( x );
/* Auxiliary function to compare two mbedtls_ecp_group objects. */
inline static int mbedtls_ecp_group_cmp( mbedtls_ecp_group *grp1,
mbedtls_ecp_group *grp2 )
{
if( mbedtls_mpi_cmp_mpi( &grp1->P, &grp2->P ) != 0 )
return 1;
if( mbedtls_mpi_cmp_mpi( &grp1->A, &grp2->A ) != 0 )
return 1;
if( mbedtls_mpi_cmp_mpi( &grp1->B, &grp2->B ) != 0 )
return 1;
if( mbedtls_mpi_cmp_mpi( &grp1->N, &grp2->N ) != 0 )
return 1;
if( mbedtls_ecp_point_cmp( &grp1->G, &grp2->G ) != 0 )
return 1;
if( grp1->id != grp2->id )
return 1;
if( grp1->pbits != grp2->pbits )
return 1;
if( grp1->nbits != grp2->nbits )
return 1;
if( grp1->h != grp2->h )
return 1;
if( grp1->modp != grp2->modp )
return 1;
if( grp1->t_pre != grp2->t_pre )
return 1;
if( grp1->t_post != grp2->t_post )
return 1;
if( grp1->t_data != grp2->t_data )
return 1;
if( grp1->T_size != grp2->T_size )
return 1;
if( grp1->T != grp2->T )
return 1;
return 0;
}
/* END_HEADER */
/* BEGIN_DEPENDENCIES