From 2e7fee09da8b00c58effd3f1957eece9514a8be9 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 25 Sep 2017 10:47:58 +0100 Subject: [PATCH] Fix bug in X.509 CRT verification code --- library/x509_crt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index 474c24473..5d70f511f 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -714,7 +714,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char * memcpy( p, buf, crt->raw.len ); - // Direct pointers to the new buffer + // Direct pointers to the new buffer p += crt->raw.len - len; end = crt_end = p + len; @@ -1968,7 +1968,7 @@ static int x509_crt_verify_top( */ if( child->subject_raw.len == trust_ca->subject_raw.len && memcmp( child->subject_raw.p, trust_ca->subject_raw.p, - child->issuer_raw.len ) == 0 ) + child->subject_raw.len ) == 0 ) { check_path_cnt--; } @@ -2018,7 +2018,7 @@ static int x509_crt_verify_top( if( trust_ca != NULL && ( child->subject_raw.len != trust_ca->subject_raw.len || memcmp( child->subject_raw.p, trust_ca->subject_raw.p, - child->issuer_raw.len ) != 0 ) ) + child->subject_raw.len ) != 0 ) ) { #if defined(MBEDTLS_X509_CRL_PARSE_C) /* Check trusted CA's CRL for the chain's top crt */