Skip to content

Commit b402c97

Browse files
committed
M487: Fix ECP P + P operation
Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P
1 parent 3adb735 commit b402c97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/ecp/ecp_internal_alt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ NU_STATIC int internal_run_eccop(const mbedtls_ecp_group *grp,
502502
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
503503
}
504504

505+
/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
506+
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
507+
return internal_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE);
508+
}
509+
505510
int ret;
506511
bool ecc_done;
507512

0 commit comments

Comments
 (0)