Added ecp_check_pubkey().

This commit is contained in:
Manuel Pégourié-Gonnard 2012-11-24 12:05:44 +01:00 committed by Paul Bakker
parent c554e9acf1
commit 1c33057a63
4 changed files with 123 additions and 0 deletions

View file

@ -158,6 +158,25 @@ int ecp_set_zero( ecp_point *pt );
*/
int ecp_copy( ecp_point *P, const ecp_point *Q );
/**
* \brief Check that a point is a valid public key on this curve
*
* \param grp Curve/group the point should belong to
* \param pt Point to check
*
* \return 0 if point is a valid public key,
* POLARSSL_ERR_ECP_GENERIC otherwise.
*
* \note This function only checks the point is non-zero, has valid
* coordinates and lies on the curve, but not that it is
* indeed a multiple of G. This is additional check is more
* expensive, isn't required by standards, and shouldn't be
* necessary if the group used has a small cofactor. In
* particular, it is useless for the NIST groups which all
* have a cofactor of 1.
*/
int ecp_check_pubkey( const ecp_group *grp, const ecp_point *pt );
/**
* \brief Import a non-zero point from two ASCII strings
*