Fix broken tests due to changed error code

Introduced in 5246ee5c59
This commit is contained in:
Manuel Pégourié-Gonnard 2014-03-26 14:12:20 +01:00
parent df5024c0dd
commit c042cf0013
3 changed files with 10 additions and 5 deletions

View File

@ -483,8 +483,13 @@ int ecp_point_read_binary( const ecp_group *grp, ecp_point *pt,
int ret; int ret;
size_t plen; size_t plen;
if( ilen == 1 && buf[0] == 0x00 ) if( buf[0] == 0x00 )
return( ecp_set_zero( pt ) ); {
if( ilen == 1 )
return( ecp_set_zero( pt ) );
else
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
}
plen = mpi_size( &grp->P ); plen = mpi_size( &grp->P );

View File

@ -213,7 +213,7 @@ ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0000":"01":"01":"00":POLARSSL_ERR_ECP
ECP read binary #2 (zero, invalid first byte) ECP read binary #2 (zero, invalid first byte)
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"01":"00":POLARSSL_ERR_ECP_BAD_INPUT_DATA ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"01":"01":"01":"00":POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE
ECP read binary #3 (zero, OK) ECP read binary #3 (zero, OK)
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
@ -225,7 +225,7 @@ ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"04001122":"01":"01":"00":POLARSSL_ERR
ECP read binary #5 (non-zero, invalid first byte) ECP read binary #5 (non-zero, invalid first byte)
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED
ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0548d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_BAD_INPUT_DATA ecp_read_binary:POLARSSL_ECP_DP_SECP192R1:"0548d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc99336ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"48d8082a3a1e3112bc03a8ef2f6d40d0a77a6f8e00cc9933":"6ceed4d7cba482e288669ee1b6415626d6f34d28501e060c":"01":POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE
ECP read binary #6 (non-zero, OK) ECP read binary #6 (non-zero, OK)
depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED depends_on:POLARSSL_ECP_DP_SECP192R1_ENABLED

View File

@ -472,7 +472,7 @@ void ecp_tls_write_read_point( int id )
TEST_ASSERT( ecp_tls_write_point( &grp, &grp.G, TEST_ASSERT( ecp_tls_write_point( &grp, &grp.G,
POLARSSL_ECP_PF_COMPRESSED, &olen, buf, 256 ) == 0 ); POLARSSL_ECP_PF_COMPRESSED, &olen, buf, 256 ) == 0 );
TEST_ASSERT( ecp_tls_read_point( &grp, &pt, &vbuf, olen ) TEST_ASSERT( ecp_tls_read_point( &grp, &pt, &vbuf, olen )
== POLARSSL_ERR_ECP_BAD_INPUT_DATA ); == POLARSSL_ERR_ECP_FEATURE_UNAVAILABLE );
TEST_ASSERT( vbuf == buf + olen ); TEST_ASSERT( vbuf == buf + olen );
memset( buf, 0x00, sizeof( buf ) ); vbuf = buf; memset( buf, 0x00, sizeof( buf ) ); vbuf = buf;