mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-03 17:38:20 +00:00
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:
parent
0044ab12b7
commit
b6e81bc3d7
|
@ -2082,6 +2082,8 @@ int mbedtls_ecp_ansi_write_group( const mbedtls_ecp_group *grp,
|
||||||
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
|
||||||
q = p + 2 + oid_length;
|
q = p + 2 + oid_length;
|
||||||
*olen = mbedtls_asn1_write_oid( &q, p, oid, oid_length );
|
*olen = mbedtls_asn1_write_oid( &q, p, oid, oid_length );
|
||||||
|
if ( p != q )
|
||||||
|
return ( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
|
||||||
return ( 0 );
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue