From e786a7ecdb2d843562c29b973402a88f45b77bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 7 Mar 2018 09:41:20 +0100 Subject: [PATCH] x509: fix remaining unchecked call to mbedtls_md() The other two calls have been fixed already, fix that one too for consistency. --- library/x509_crt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index c797e7470..e2ad57923 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -2098,17 +2098,13 @@ static int x509_crt_verify_child( *flags |= MBEDTLS_X509_BADCERT_BAD_PK; 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 ) { - /* - * Cannot check 'unknown' hash - */ + /* Note: this can't happen except after an internal error */ *flags |= MBEDTLS_X509_BADCERT_NOT_TRUSTED; } else { - mbedtls_md( md_info, child->tbs.p, child->tbs.len, hash ); - if( x509_profile_check_key( profile, child->sig_pk, &parent->pk ) != 0 ) *flags |= MBEDTLS_X509_BADCERT_BAD_KEY;