Skip to content

Commit b6fadd3

Browse files
authored
Merge pull request #15289 from OpenNuvoton/nuvoton_m487_des_ecp
M487: Fix crypto h/w port
2 parents 1ab98de + b402c97 commit b6fadd3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/des/des_alt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int mbedtls_des_docrypt(uint16_t keyopt, uint8_t key[3][MBEDTLS_DES_KEY_S
375375
* 1. BE for byte sequence in word
376376
* 2. BE for word sequence in double-word
377377
*/
378-
TDES_Open(CRPT
378+
TDES_Open(CRPT,
379379
0, // Channel number (0~4)
380380
enc, // 0: decode, 1: encode
381381
(tdes_opmode & CRPT_TDES_CTL_TMODE_Msk) ? 1 : 0, // 0: DES, 1: TDES

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)