mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-09 01:15:31 +00:00
- Extra sanity check for input added
This commit is contained in:
parent
0c93d126bc
commit
b5b20f19e7
|
@ -128,6 +128,9 @@ int dhm_make_params( dhm_context *ctx, int x_size,
|
||||||
size_t n1, n2, n3;
|
size_t n1, n2, n3;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
|
if( mpi_cmp_int( &ctx->P, 0 ) == 0 )
|
||||||
|
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate X as large as possible ( < P )
|
* Generate X as large as possible ( < P )
|
||||||
*/
|
*/
|
||||||
|
@ -211,6 +214,9 @@ int dhm_make_public( dhm_context *ctx, int x_size,
|
||||||
if( ctx == NULL || olen < 1 || olen > ctx->len )
|
if( ctx == NULL || olen < 1 || olen > ctx->len )
|
||||||
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||||
|
|
||||||
|
if( mpi_cmp_int( &ctx->P, 0 ) == 0 )
|
||||||
|
return( POLARSSL_ERR_DHM_BAD_INPUT_DATA );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* generate X and calculate GX = G^X mod P
|
* generate X and calculate GX = G^X mod P
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue