ECP: Add a sanity check to mbedtls_ecp_ansi_write_group

Check for p != q at the end to ensure that everything went as it should.
This commit is contained in:
Andrzej Kurek 2018-02-20 11:20:09 -05:00
parent 0044ab12b7
commit b6e81bc3d7

View file

@ -2082,6 +2082,8 @@ int mbedtls_ecp_ansi_write_group( const mbedtls_ecp_group *grp,
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
q = p + 2 + oid_length;
*olen = mbedtls_asn1_write_oid( &q, p, oid, oid_length );
if ( p != q )
return ( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
return ( 0 );
}