Work around compressed EC public key in some cases
diff --git a/library/ecp.c b/library/ecp.c
index f4f2d1c..7cfb44f 100644
--- a/library/ecp.c
+++ b/library/ecp.c
@@ -478,7 +478,8 @@
* Import a point from unsigned binary data (SEC1 2.3.4)
*/
int ecp_point_read_binary( const ecp_group *grp, ecp_point *pt,
- const unsigned char *buf, size_t ilen ) {
+ const unsigned char *buf, size_t ilen )
+{
int ret;
size_t plen;
@@ -487,7 +488,10 @@
plen = mpi_size( &grp->P );
- if( ilen != 2 * plen + 1 || buf[0] != 0x04 )
+ if( buf[0] != 0x04 )
+ return( POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE );
+
+ if( ilen != 2 * plen + 1 )
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
MPI_CHK( mpi_read_binary( &pt->X, buf + 1, plen ) );