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

Remove ecp_sub()

This commit is contained in:
Manuel Pégourié-Gonnard
2015-05-11 18:18:32 +02:00
parent aff37e5aa1
commit 6dde596a03
3 changed files with 1 additions and 45 deletions

View File

@ -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