Some operations are not supported with Curve25519
diff --git a/library/ecdsa.c b/library/ecdsa.c
index 13f394b..2072d55 100644
--- a/library/ecdsa.c
+++ b/library/ecdsa.c
@@ -59,6 +59,10 @@
ecp_point R;
mpi k, e;
+ /* Fail cleanly on curves such as Curve25519 that can't be used for ECDSA */
+ if( grp->N.p == NULL )
+ return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
+
ecp_point_init( &R );
mpi_init( &k );
mpi_init( &e );
@@ -129,6 +133,10 @@
ecp_point_init( &R ); ecp_point_init( &P );
mpi_init( &e ); mpi_init( &s_inv ); mpi_init( &u1 ); mpi_init( &u2 );
+ /* Fail cleanly on curves such as Curve25519 that can't be used for ECDSA */
+ if( grp->N.p == NULL )
+ return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
+
/*
* Step 1: make sure r and s are in range 1..n-1
*/