From 6dde596a03e4a8288d9d6134cd4656eae81826e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 11 May 2015 18:18:32 +0200 Subject: [PATCH] Remove ecp_sub() --- ChangeLog | 1 + include/mbedtls/ecp.h | 17 ----------------- library/ecp.c | 28 ---------------------------- 3 files changed, 1 insertion(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3c46053b..28a3ef24a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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). diff --git a/include/mbedtls/ecp.h b/include/mbedtls/ecp.h index 2d33c3853..901c23ed5 100644 --- a/include/mbedtls/ecp.h +++ b/include/mbedtls/ecp.h @@ -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) diff --git a/library/ecp.c b/library/ecp.c index e064c500a..f0fcc1f46 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -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