1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Fix length checking of various ClientKeyExchange's

This commit is contained in:
Manuel Pégourié-Gonnard
2014-03-26 19:53:25 +01:00
parent 96d5265315
commit 969ccc6289
3 changed files with 45 additions and 21 deletions

View File

@ -218,10 +218,19 @@ int ecdh_make_public( ecdh_context *ctx, size_t *olen,
int ecdh_read_public( ecdh_context *ctx,
const unsigned char *buf, size_t blen )
{
int ret;
const unsigned char *p = buf;
if( ctx == NULL )
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
return ecp_tls_read_point( &ctx->grp, &ctx->Qp, &buf, blen );
if( ( ret = ecp_tls_read_point( &ctx->grp, &ctx->Qp, &p, blen ) ) != 0 )
return( ret );
if( (size_t)( p - buf ) != blen )
return( POLARSSL_ERR_ECP_BAD_INPUT_DATA );
return( 0 );
}
/*