forked from espressif/esp-idf
Merge branch 'bugfix/ecc_coverity_warning' into 'master'
fix(ecc_alt): adjust null pointer check to fix coverity warning Closes IDF-9872 See merge request espressif/esp-idf!30946
This commit is contained in:
@@ -81,6 +81,10 @@ int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp,
|
|||||||
int res;
|
int res;
|
||||||
ecc_point_t point;
|
ecc_point_t point;
|
||||||
|
|
||||||
|
if (grp == NULL || pt == NULL) {
|
||||||
|
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
if (grp->id != MBEDTLS_ECP_DP_SECP192R1 && grp->id != MBEDTLS_ECP_DP_SECP256R1) {
|
if (grp->id != MBEDTLS_ECP_DP_SECP192R1 && grp->id != MBEDTLS_ECP_DP_SECP256R1) {
|
||||||
#if defined(MBEDTLS_ECP_VERIFY_ALT_SOFT_FALLBACK)
|
#if defined(MBEDTLS_ECP_VERIFY_ALT_SOFT_FALLBACK)
|
||||||
return mbedtls_ecp_check_pubkey_soft(grp, pt);
|
return mbedtls_ecp_check_pubkey_soft(grp, pt);
|
||||||
@@ -89,13 +93,10 @@ int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grp == NULL || pt == NULL) {
|
|
||||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Must use affine coordinates */
|
/* Must use affine coordinates */
|
||||||
if( mbedtls_mpi_cmp_int( &pt->MBEDTLS_PRIVATE(Z), 1 ) != 0 )
|
if (mbedtls_mpi_cmp_int( &pt->MBEDTLS_PRIVATE(Z), 1 ) != 0 ) {
|
||||||
return( MBEDTLS_ERR_ECP_INVALID_KEY );
|
return( MBEDTLS_ERR_ECP_INVALID_KEY );
|
||||||
|
}
|
||||||
|
|
||||||
mbedtls_platform_zeroize((void *)&point, sizeof(ecc_point_t));
|
mbedtls_platform_zeroize((void *)&point, sizeof(ecc_point_t));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user