Cache pre-computed points for ecp_mul()
Up to 1.25 speedup on ECDSA sign for small curves, but mainly useful as a
preparation for fixed-point mult (a few prototypes changed in constness).
diff --git a/include/polarssl/ecdh.h b/include/polarssl/ecdh.h
index 0fa2dfa..81c8f93 100644
--- a/include/polarssl/ecdh.h
+++ b/include/polarssl/ecdh.h
@@ -62,7 +62,7 @@
* \return 0 if successful,
* or a POLARSSL_ERR_ECP_XXX or POLARSSL_MPI_XXX error code
*/
-int ecdh_gen_public( const ecp_group *grp, mpi *d, ecp_point *Q,
+int ecdh_gen_public( ecp_group *grp, mpi *d, ecp_point *Q,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
@@ -83,7 +83,7 @@
* countermeasures against potential elaborate timing
* attacks, see \c ecp_mul() for details.
*/
-int ecdh_compute_shared( const ecp_group *grp, mpi *z,
+int ecdh_compute_shared( ecp_group *grp, mpi *z,
const ecp_point *Q, const mpi *d,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
diff --git a/include/polarssl/ecdsa.h b/include/polarssl/ecdsa.h
index 3159d89..2de3b68 100644
--- a/include/polarssl/ecdsa.h
+++ b/include/polarssl/ecdsa.h
@@ -63,7 +63,7 @@
* \return 0 if successful,
* or a POLARSSL_ERR_ECP_XXX or POLARSSL_MPI_XXX error code
*/
-int ecdsa_sign( const ecp_group *grp, mpi *r, mpi *s,
+int ecdsa_sign( ecp_group *grp, mpi *r, mpi *s,
const mpi *d, const unsigned char *buf, size_t blen,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
@@ -81,7 +81,7 @@
* POLARSSL_ERR_ECP_BAD_INPUT_DATA if signature is invalid
* or a POLARSSL_ERR_ECP_XXX or POLARSSL_MPI_XXX error code
*/
-int ecdsa_verify( const ecp_group *grp,
+int ecdsa_verify( ecp_group *grp,
const unsigned char *buf, size_t blen,
const ecp_point *Q, const mpi *r, const mpi *s);
diff --git a/include/polarssl/ecp.h b/include/polarssl/ecp.h
index 513b355..cd1568c 100644
--- a/include/polarssl/ecp.h
+++ b/include/polarssl/ecp.h
@@ -155,16 +155,15 @@
/*
* Maximum window size (actually, NAF width) used for point multipliation.
- * Default: 7.
+ * Default: 8.
* Minimum value: 2. Maximum value: 8.
*
* Result is an array of at most ( 1 << ( POLARSSL_ECP_WINDOW_SIZE - 1 ) )
- * points used for point multiplication, so at most 64 by default.
- * In practice, most curves will use less precomputed points.
+ * points used for point multiplication.
*
* Reduction in size may reduce speed for big curves.
*/
-#define POLARSSL_ECP_WINDOW_SIZE 7 /**< Maximum NAF width used. */
+#define POLARSSL_ECP_WINDOW_SIZE 8 /**< Maximum NAF width used. */
/*
* Point formats, from RFC 4492's enum ECPointFormat
@@ -472,7 +471,7 @@
* has very low overhead, it is recommended to always provide
* a non-NULL f_rng parameter when using secret inputs.
*/
-int ecp_mul( const ecp_group *grp, ecp_point *R,
+int ecp_mul( ecp_group *grp, ecp_point *R,
const mpi *m, const ecp_point *P,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng );
@@ -531,7 +530,7 @@
* in order to ease use with other structures such as
* ecdh_context of ecdsa_context.
*/
-int ecp_gen_keypair( const ecp_group *grp, mpi *d, ecp_point *Q,
+int ecp_gen_keypair( ecp_group *grp, mpi *d, ecp_point *Q,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );