mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Allowed point at infinity, supressed ecp_double()
This commit is contained in:
committed by
Paul Bakker
parent
1e8c8ecd95
commit
5179e463d5
@@ -38,8 +38,9 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
mpi X; /*!< the point's X coordinate */
|
char is_zero; /*!< true if point at infinity */
|
||||||
mpi Y; /*!< the point's Y coordinate */
|
mpi X; /*!< the point's X coordinate */
|
||||||
|
mpi Y; /*!< the point's Y coordinate */
|
||||||
}
|
}
|
||||||
ecp_point;
|
ecp_point;
|
||||||
|
|
||||||
@@ -156,18 +157,6 @@ extern "C" {
|
|||||||
int ecp_add( const ecp_group *grp, ecp_point *R,
|
int ecp_add( const ecp_group *grp, ecp_point *R,
|
||||||
const ecp_point *P, const ecp_point *Q );
|
const ecp_point *P, const ecp_point *Q );
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Duplication: R = 2 P
|
|
||||||
*
|
|
||||||
* \param grp ECP group
|
|
||||||
* \param R Destination point
|
|
||||||
* \param P Point to double
|
|
||||||
*
|
|
||||||
* \return 0 if successful, or an POLARSSL_ERR_ECP_XXX error code
|
|
||||||
*/
|
|
||||||
int ecp_double( const ecp_group *grp, ecp_point *R,
|
|
||||||
const ecp_point *P );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Multiplication by an integer: R = m * P
|
* \brief Multiplication by an integer: R = m * P
|
||||||
*
|
*
|
||||||
@@ -178,8 +167,8 @@ int ecp_double( const ecp_group *grp, ecp_point *R,
|
|||||||
*
|
*
|
||||||
* \return 0 if successful, or an POLARSSL_ERR_ECP_XXX error code
|
* \return 0 if successful, or an POLARSSL_ERR_ECP_XXX error code
|
||||||
*/
|
*/
|
||||||
int ecp_multiply( const ecp_group *grp, ecp_point *R,
|
int ecp_mul( const ecp_group *grp, ecp_point *R,
|
||||||
const mpi *m, const ecp_point *P );
|
const mpi *m, const ecp_point *P );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Free the components of a point
|
* \brief Free the components of a point
|
||||||
|
@@ -44,6 +44,7 @@ void ecp_point_free( ecp_point *pt )
|
|||||||
if( pt == NULL )
|
if( pt == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
pt->is_zero = 1;
|
||||||
mpi_free( &( pt->X ) );
|
mpi_free( &( pt->X ) );
|
||||||
mpi_free( &( pt->Y ) );
|
mpi_free( &( pt->Y ) );
|
||||||
}
|
}
|
||||||
@@ -62,6 +63,8 @@ void ecp_group_free( ecp_group *grp )
|
|||||||
ecp_point_free( &( grp->G ) );
|
ecp_point_free( &( grp->G ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(POLARSSL_SELF_TEST)
|
#if defined(POLARSSL_SELF_TEST)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user