Commit 6dde596a authored by Manuel Pégourié-Gonnard's avatar Manuel Pégourié-Gonnard
Browse files

Remove ecp_sub()

parent aff37e5a
......@@ -61,6 +61,7 @@ API Changes
Removals
* Removed mbedtls_ecp_group_read_string(). Only named groups are supported.
* Removed mbedtls_ecp_sub().
* Removed individual mdX_hmac and shaX_hmac functions (use generic
md_hmac functions from md.h)
* Removed the PBKDF2 module (use PKCS5).
......
......@@ -498,23 +498,6 @@ int mbedtls_ecp_tls_write_group( const mbedtls_ecp_group *grp, size_t *olen,
int mbedtls_ecp_add( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q );
/**
* \brief Subtraction: R = P - Q
*
* \param grp ECP group
* \param R Destination point
* \param P Left-hand point
* \param Q Right-hand point
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_MALLOC_FAILED if memory allocation failed
*
* \note This function does not support Montgomery curves, such as
* Curve25519.
*/
int mbedtls_ecp_sub( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q );
/**
* \brief Multiplication by an integer: R = m * P
* (Not thread-safe to use same group in multiple threads)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment