summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_par.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_par.c')
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index 8657f73d66..aaca69aebd 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -70,9 +70,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
70 int indent) 70 int indent)
71 { 71 {
72 static const char fmt[]="%-18s"; 72 static const char fmt[]="%-18s";
73 static const char fmt2[]="%2d %-15s";
74 char str[128]; 73 char str[128];
75 const char *p,*p2=NULL; 74 const char *p;
76 75
77 if (constructed & V_ASN1_CONSTRUCTED) 76 if (constructed & V_ASN1_CONSTRUCTED)
78 p="cons: "; 77 p="cons: ";
@@ -93,14 +92,8 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
93 else 92 else
94 p = ASN1_tag2str(tag); 93 p = ASN1_tag2str(tag);
95 94
96 if (p2 != NULL) 95 if (BIO_printf(bp,fmt,p) <= 0)
97 { 96 goto err;
98 if (BIO_printf(bp,fmt2,tag,p2) <= 0) goto err;
99 }
100 else
101 {
102 if (BIO_printf(bp,fmt,p) <= 0) goto err;
103 }
104 return(1); 97 return(1);
105err: 98err:
106 return(0); 99 return(0);
@@ -246,7 +239,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse
246 ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl); 239 ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl);
247 if (ii < 0) 240 if (ii < 0)
248 { 241 {
249 if (BIO_write(bp,"Bad boolean\n",12)) 242 if (BIO_write(bp,"Bad boolean\n",12) <= 0)
250 goto end; 243 goto end;
251 } 244 }
252 BIO_printf(bp,":%d",ii); 245 BIO_printf(bp,":%d",ii);
@@ -424,7 +417,7 @@ end:
424 417
425const char *ASN1_tag2str(int tag) 418const char *ASN1_tag2str(int tag)
426{ 419{
427 static const char *tag2str[] = { 420 static const char * const tag2str[] = {
428 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ 421 "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
429 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ 422 "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
430 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ 423 "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */