From fd64f14ef9a1a8b9ba328a1494f5b094c67b700e Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Fri, 7 Jun 2019 11:47:12 +0100 Subject: [PATCH] Remove redundant CRT version check during CRT parsing --- library/x509_crt.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index ee9e95dc9..c79193e61 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -1297,26 +1297,25 @@ static int x509_crt_parse_frame( unsigned char *start, p += len; frame->pubkey_raw.len = p - frame->pubkey_raw.p; - /* - * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - */ if( frame->version == 2 || frame->version == 3 ) { + /* + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + */ + ret = x509_get_uid( &p, end, &tmp, 1 /* implicit tag */ ); if( ret != 0 ) return( ret ); frame->issuer_id.p = tmp.p; frame->issuer_id.len = tmp.len; - } - /* - * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - */ - if( frame->version == 2 || frame->version == 3 ) - { + /* + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, + * -- If present, version shall be v2 or v3 + */ + ret = x509_get_uid( &p, end, &tmp, 2 /* implicit tag */ ); if( ret != 0 ) return( ret );