mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix EC J-PAKE failing when the payload is all-bits-zero
Fix function mbedtls_ecp_mul_shortcuts() to skip multiplication when m is 0 and simply assignt 0 to R. Additionally fix ecjpake_zkp_read() to return MBEDTLS_ERR_ECP_INVALID_KEY when the above condintion is met. Fix #1792 Signed-off-by: TRodziewicz <rodziewicz@gmail.com>
This commit is contained in:
@ -286,6 +286,13 @@ static int ecjpake_zkp_read( const mbedtls_md_info_t *md_info,
|
||||
* Verification
|
||||
*/
|
||||
MBEDTLS_MPI_CHK( ecjpake_hash( md_info, grp, pf, G, &V, X, id, &h ) );
|
||||
|
||||
if( mbedtls_mpi_cmp_int( &r,0 ) == 0 )
|
||||
{
|
||||
ret = MBEDTLS_ERR_ECP_INVALID_KEY;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
MBEDTLS_MPI_CHK( mbedtls_ecp_muladd( (mbedtls_ecp_group *) grp,
|
||||
&VV, &h, X, &r, G ) );
|
||||
|
||||
|
Reference in New Issue
Block a user