Added ecp_copy() (for points)
diff --git a/library/ecp.c b/library/ecp.c
index 2173e24..6c3b4a8 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -26,7 +26,7 @@
/*
* References:
*
- * SEC1-v2 (XXX: insert url)
+ * SEC1 http://www.secg.org/index.php?action=secg,docs_secg
* Guide to Elliptic Curve Cryptography - Hankerson, Menezes, Vanstone
*/
@@ -57,12 +57,26 @@
if( grp == NULL )
return;
- mpi_free( &( grp->P ) );
- mpi_free( &( grp->B ) );
- mpi_free( &( grp->N ) );
- ecp_point_free( &( grp->G ) );
+ mpi_free( &grp->P );
+ mpi_free( &grp->B );
+ ecp_point_free( &grp->G );
+ mpi_free( &grp->N );
}
+/*
+ * Copy the contents of Q into P
+ */
+int ecp_copy( ecp_point *P, const ecp_point *Q )
+{
+ int ret;
+
+ P->is_zero = Q->is_zero;
+ MPI_CHK( mpi_copy( &P->X, &Q->X ) );
+ MPI_CHK( mpi_copy( &P->Y, &Q->Y ) );
+
+cleanup:
+ return( ret );
+}
#if defined(POLARSSL_SELF_TEST)