mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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:
commit
eca073df3c
@ -81,6 +81,10 @@ int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp,
|
||||
int res;
|
||||
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 defined(MBEDTLS_ECP_VERIFY_ALT_SOFT_FALLBACK)
|
||||
return mbedtls_ecp_check_pubkey_soft(grp, pt);
|
||||
@ -89,13 +93,10 @@ int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (grp == NULL || pt == NULL) {
|
||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
/* 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 );
|
||||
}
|
||||
|
||||
mbedtls_platform_zeroize((void *)&point, sizeof(ecc_point_t));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user