Skip to content

Commit

Permalink
M487: Fix ECP P + P operation
Browse files Browse the repository at this point in the history
Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P
  • Loading branch information
ccli8 committed May 24, 2022
1 parent 3adb735 commit b402c97
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ NU_STATIC int internal_run_eccop(const mbedtls_ecp_group *grp,
return MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED;
}

/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
return internal_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE);
}

int ret;
bool ecc_done;

Expand Down

0 comments on commit b402c97

Please sign in to comment.