From: jsing Date: Wed, 4 May 2022 10:53:26 +0000 (+0000) Subject: Avoid special handling of definite length before calling asn1_find_end(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=76ae1ec394038d75f36be1017901478adc57fc1e;p=openbsd Avoid special handling of definite length before calling asn1_find_end(). The asn1_find_end() function handles definite length ASN.1, which means that there is no point in the only caller having code to explicitly handle definite length - it can just call the function. ok tb@ --- diff --git a/lib/libcrypto/asn1/tasn_dec.c b/lib/libcrypto/asn1/tasn_dec.c index a6614f174ed..7e416719e02 100644 --- a/lib/libcrypto/asn1/tasn_dec.c +++ b/lib/libcrypto/asn1/tasn_dec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_dec.c,v 1.55 2022/05/04 10:47:36 jsing Exp $ */ +/* $OpenBSD: tasn_dec.c,v 1.56 2022/05/04 10:53:26 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -716,15 +716,9 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen, } content = *in; - /* If indefinite length constructed find the real end */ - if (inf) { - if (!asn1_find_end(&p, plen, inf)) - goto err; - len = p - content; - } else { - len = p - content + plen; - p += plen; - } + if (!asn1_find_end(&p, plen, inf)) + goto err; + len = p - content; } else if (cst) { /* * Should really check the internal tags are correct but