Simplify OID tag parsing in x509_get_cert_ext( )

This commit is contained in:
k-stachowiak 2018-06-28 16:23:39 +02:00
parent fe60132305
commit 470dfbabb9

View File

@ -574,14 +574,10 @@ static int x509_get_crt_ext( unsigned char **p,
end_ext_data = *p + len; end_ext_data = *p + len;
/* Get extension ID */ /* Get extension ID */
if( ( end - *p ) < 1 )
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
MBEDTLS_ERR_ASN1_OUT_OF_DATA );
extn_oid.tag = **p;
if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 ) if( ( ret = mbedtls_asn1_get_tag( p, end, &extn_oid.len, MBEDTLS_ASN1_OID ) ) != 0 )
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret ); return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
extn_oid.tag = MBEDTLS_ASN1_OID;
extn_oid.p = *p; extn_oid.p = *p;
*p += extn_oid.len; *p += extn_oid.len;