ASN1: rename asn1_par.c to asn1_parse.c for clarity; simplify asn1_parse2()
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 12 Jun 2021 09:25:07 +0000 (11:25 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Tue, 15 Jun 2021 12:23:21 +0000 (14:23 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15722)

crypto/asn1/asn1_parse.c [moved from crypto/asn1/asn1_par.c with 97% similarity]
crypto/asn1/build.info

similarity index 97%
rename from crypto/asn1/asn1_par.c
rename to crypto/asn1/asn1_parse.c
index 3a493de0fc585a1fdcebfb6796725f7a601b131f..83ac535cc3754d5deb0f7523cc44dae1b5fdbf12 100644 (file)
@@ -115,9 +115,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
         op = p;
         j = ASN1_get_object(&p, &len, &tag, &xclass, length);
         if (j & 0x80) {
-            if (BIO_write(bp, "Error in encoding\n", 18) <= 0)
-                goto end;
-            ret = 0;
+            BIO_puts(bp, "Error in encoding\n");
             goto end;
         }
         hl = (p - op);
@@ -136,7 +134,6 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                 goto end;
             if (len > length) {
                 BIO_printf(bp, "length is greater than %ld\n", length);
-                ret = 0;
                 goto end;
             }
             if ((j == 0x21) && (len == 0)) {
@@ -144,10 +141,8 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                     r = asn1_parse2(bp, &p, (long)(tot - p),
                                     offset + (p - *pp), depth + 1,
                                     indent, dump);
-                    if (r == 0) {
-                        ret = 0;
+                    if (r == 0)
                         goto end;
-                    }
                     if ((r == 2) || (p >= tot)) {
                         len = p - sp;
                         break;
@@ -161,10 +156,8 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                     r = asn1_parse2(bp, &p, tmp,
                                     offset + (p - *pp), depth + 1,
                                     indent, dump);
-                    if (r == 0) {
-                        ret = 0;
+                    if (r == 0)
                         goto end;
-                    }
                     tmp -= p - sp;
                 }
             }
index e10d631654be5d91350fbba0890c7ec67c242fc1..33b86fdd31f521dc898fbf099b585c9237322025 100644 (file)
@@ -11,7 +11,7 @@ SOURCE[../../libcrypto]=\
         tasn_prn.c tasn_scn.c ameth_lib.c \
         f_int.c f_string.c \
         x_pkey.c bio_asn1.c bio_ndef.c asn_mime.c \
-        asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_strnid.c \
+        asn1_gen.c asn1_parse.c asn1_lib.c asn1_err.c a_strnid.c \
         evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p5_scrypt.c p8_pkey.c \
         asn_moid.c asn_mstbl.c asn1_item_list.c \
         d2i_param.c