x509: fix remaining unchecked call to mbedtls_md()

The other two calls have been fixed already, fix that one too for consistency.
This commit is contained in:
Manuel Pégourié-Gonnard 2018-03-07 09:41:20 +01:00
parent 71df3733d0
commit e786a7ecdb

View File

@ -2098,17 +2098,13 @@ static int x509_crt_verify_child(
*flags |= MBEDTLS_X509_BADCERT_BAD_PK; *flags |= MBEDTLS_X509_BADCERT_BAD_PK;
md_info = mbedtls_md_info_from_type( child->sig_md ); md_info = mbedtls_md_info_from_type( child->sig_md );
if( md_info == NULL ) if( mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash ) != 0 )
{ {
/* /* Note: this can't happen except after an internal error */
* Cannot check 'unknown' hash
*/
*flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED; *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED;
} }
else else
{ {
mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash );
if( x509_profile_check_key( profile, child->sig_pk, &parent->pk ) != 0 ) if( x509_profile_check_key( profile, child->sig_pk, &parent->pk ) != 0 )
*flags |= MBEDTLS_X509_BADCERT_BAD_KEY; *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;