[M487] Check divisor is not zero in MODOP_DIV operation in ECP alter.

pull/5812/head
ccli8 2018-02-06 09:30:57 +08:00
parent 17280372a7
commit c9cc357734
1 changed files with 5 additions and 0 deletions

View File

@ -719,6 +719,11 @@ int mbedtls_internal_run_modop(mbedtls_mpi *r,
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
}
/* Check divisor is not zero in MODOP_DIV operation */
if (modop == MODOP_DIV && mbedtls_mpi_cmp_int(o2, 0) == 0) {
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
}
int ret;
bool ecc_done;