Skip to content

Commit 331fd7f

Browse files
committed
fix(mbedtls/port): Check signature hash length before using ECDSA hardware
1 parent 59e1838 commit 331fd7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/mbedtls/port/ecdsa/ecdsa_alt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ int __wrap_mbedtls_ecdsa_verify(mbedtls_ecp_group *grp,
674674
const mbedtls_mpi *r,
675675
const mbedtls_mpi *s)
676676
{
677-
if (grp->id == MBEDTLS_ECP_DP_SECP192R1 || grp->id == MBEDTLS_ECP_DP_SECP256R1) {
677+
if ((grp->id == MBEDTLS_ECP_DP_SECP192R1 || grp->id == MBEDTLS_ECP_DP_SECP256R1) && blen == ECDSA_SHA_LEN) {
678678
return esp_ecdsa_verify(grp, buf, blen, Q, r, s);
679679
} else {
680680
return __real_mbedtls_ecdsa_verify(grp, buf, blen, Q, r, s);

0 commit comments

Comments
 (0)