mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-03 21:25:31 +01:00
Remove ecp_sub()
This commit is contained in:
parent
aff37e5aa1
commit
6dde596a03
3 changed files with 1 additions and 45 deletions
|
|
@ -1066,34 +1066,6 @@ cleanup:
|
|||
return( ret );
|
||||
}
|
||||
|
||||
/*
|
||||
* Subtraction: R = P - Q, result's coordinates normalized
|
||||
*/
|
||||
int mbedtls_ecp_sub( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
|
||||
const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q )
|
||||
{
|
||||
int ret;
|
||||
mbedtls_ecp_point mQ;
|
||||
|
||||
mbedtls_ecp_point_init( &mQ );
|
||||
|
||||
if( ecp_get_type( grp ) != ECP_TYPE_SHORT_WEIERSTRASS )
|
||||
return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE );
|
||||
|
||||
/* mQ = - Q */
|
||||
MBEDTLS_MPI_CHK( mbedtls_ecp_copy( &mQ, Q ) );
|
||||
if( mbedtls_mpi_cmp_int( &mQ.Y, 0 ) != 0 )
|
||||
MBEDTLS_MPI_CHK( mbedtls_mpi_sub_mpi( &mQ.Y, &grp->P, &mQ.Y ) );
|
||||
|
||||
MBEDTLS_MPI_CHK( ecp_add_mixed( grp, R, P, &mQ ) );
|
||||
MBEDTLS_MPI_CHK( ecp_normalize_jac( grp, R ) );
|
||||
|
||||
cleanup:
|
||||
mbedtls_ecp_point_free( &mQ );
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
||||
/*
|
||||
* Randomize jacobian coordinates:
|
||||
* (X, Y, Z) -> (l^2 X, l^3 Y, l Z) for random l
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue