mirror of https://github.com/ARMmbed/mbed-os.git
M467: Fix mbedtls_ecp_point_cmp() call with null argument
Guard from null argument passed to mbedtls_ecp_point_cmp() in ECC H/W portpull/15337/head
parent
2f8b60d501
commit
1dd95465f6
|
|
@ -181,9 +181,14 @@ int crypto_ecc_run_eccop(const mbedtls_ecp_group *grp,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
|
/* NOTE: Engine doesn't support P + Q when P and Q are the same. Workaround by 2*P */
|
||||||
|
if (eccop == ECCOP_POINT_ADD) {
|
||||||
|
if (P == NULL || Q == NULL) {
|
||||||
|
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
|
}
|
||||||
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
|
if (mbedtls_ecp_point_cmp(P, Q) == 0) {
|
||||||
return crypto_ecc_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE, blinding);
|
return crypto_ecc_run_eccop(grp, R, NULL, P, NULL, NULL, ECCOP_POINT_DOUBLE, blinding);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Acquire ownership of ECC accelerator */
|
/* Acquire ownership of ECC accelerator */
|
||||||
crypto_ecc_acquire();
|
crypto_ecc_acquire();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue