[openssl-commits] [openssl] master update

Dr. Stephen Henson steve at openssl.org
Thu Feb 11 01:01:19 UTC 2016


The branch master has been updated
       via  b1a99374aec17822e924795a6a30ab306d4c46c9 (commit)
       via  2ab7af7b08c5213ae85c2a4aa1c15fe8dfe92137 (commit)
      from  e3e6a72ec800cd112e42ec654cfb9d715c544eb0 (commit)


- Log -----------------------------------------------------------------
commit b1a99374aec17822e924795a6a30ab306d4c46c9
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Thu Feb 11 00:23:17 2016 +0000

    use consistent error messages
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

commit 2ab7af7b08c5213ae85c2a4aa1c15fe8dfe92137
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Feb 10 23:54:52 2016 +0000

    Print out bad content octets.
    
    If asn1parse doesn't like a structure print out the content octets
    for diagnostic purposes.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/asn1_par.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index e65dacd..773b8b2 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -124,7 +124,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
     ASN1_OBJECT *o = NULL;
     ASN1_OCTET_STRING *os = NULL;
     /* ASN1_BMPSTRING *bmp=NULL; */
-    int dump_indent;
+    int dump_indent, dump_cont = 0;
 
     if (depth > ASN1_PARSE_MAXDEPTH) {
             BIO_puts(bp, "BAD RECURSION DEPTH\n");
@@ -219,13 +219,15 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                         goto end;
                     i2a_ASN1_OBJECT(bp, o);
                 } else {
-                    if (BIO_write(bp, ":BAD OBJECT", 11) <= 0)
+                    if (BIO_puts(bp, ":BAD OBJECT") <= 0)
                         goto end;
+                    dump_cont = 1;
                 }
             } else if (tag == V_ASN1_BOOLEAN) {
                 if (len != 1) {
-                    if (BIO_write(bp, "Bad boolean\n", 12) <= 0)
+                    if (BIO_puts(bp, ":BAD BOOLEAN") <= 0)
                         goto end;
+                    dump_cont = 1;
                 }
                 BIO_printf(bp, ":%u", p[0]);
             } else if (tag == V_ASN1_BMPSTRING) {
@@ -307,8 +309,9 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                             goto end;
                     }
                 } else {
-                    if (BIO_write(bp, "BAD INTEGER", 11) <= 0)
+                    if (BIO_puts(bp, ":BAD INTEGER") <= 0)
                         goto end;
+                    dump_cont = 1;
                 }
                 ASN1_INTEGER_free(bs);
             } else if (tag == V_ASN1_ENUMERATED) {
@@ -332,8 +335,9 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                             goto end;
                     }
                 } else {
-                    if (BIO_write(bp, "BAD ENUMERATED", 14) <= 0)
+                    if (BIO_puts(bp, ":BAD ENUMERATED") <= 0)
                         goto end;
+                    dump_cont = 1;
                 }
                 ASN1_ENUMERATED_free(bs);
             } else if (len > 0 && dump) {
@@ -347,6 +351,18 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
                     goto end;
                 nl = 1;
             }
+            if (dump_cont) {
+                int i;
+                const unsigned char *tmp = op + hl;
+                if (BIO_puts(bp, ":[") <= 0)
+                    goto end;
+                for (i = 0; i < len; i++) {
+                    if (BIO_printf(bp, "%02X", tmp[i]) <= 0)
+                        goto end;
+                }
+                if (BIO_puts(bp, "]") <= 0)
+                    goto end;
+            }
 
             if (!nl) {
                 if (BIO_write(bp, "\n", 1) <= 0)


More information about the openssl-commits mailing list