Skip to content

Commit c9cc357

Browse files
committed
[M487] Check divisor is not zero in MODOP_DIV operation in ECP alter.
1 parent 1728037 commit c9cc357

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

features/mbedtls/targets/TARGET_NUVOTON/TARGET_M480/ecp/ecp_internal_alt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,11 @@ int mbedtls_internal_run_modop(mbedtls_mpi *r,
719719
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
720720
}
721721

722+
/* Check divisor is not zero in MODOP_DIV operation */
723+
if (modop == MODOP_DIV && mbedtls_mpi_cmp_int(o2, 0) == 0) {
724+
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
725+
}
726+
722727
int ret;
723728
bool ecc_done;
724729

0 commit comments

Comments
 (0)