aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn1_par.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-02-09 01:29:37 +0000
committerDr. Stephen Henson <steve@openssl.org>1999-02-09 01:29:37 +0000
commitbceacf938f07f84ecd2c0f2ad42b1ff90f34f93b (patch)
treeb51771101152e30447f5af89cc89698203db23f6 /crypto/asn1/asn1_par.c
parent068197a70ca2f3a16a5cc71ef164ef54a31e63e5 (diff)
downloadopenssl-bceacf938f07f84ecd2c0f2ad42b1ff90f34f93b.tar.gz
Support for ASN1 ENUMERATED type. This copies and duplicates the ASN1_INTEGER
code and adds support to ASN1_TYPE and asn1parse.
Diffstat (limited to 'crypto/asn1/asn1_par.c')
-rw-r--r--crypto/asn1/asn1_par.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c
index af71b1a85d..bde3a3b2c3 100644
--- a/crypto/asn1/asn1_par.c
+++ b/crypto/asn1/asn1_par.c
@@ -108,6 +108,8 @@ int indent;
p="BOOLEAN";
else if (tag == V_ASN1_INTEGER)
p="INTEGER";
+ else if (tag == V_ASN1_ENUMERATED)
+ p="ENUMERATED";
else if (tag == V_ASN1_BIT_STRING)
p="BIT STRING";
else if (tag == V_ASN1_OCTET_STRING)
@@ -371,6 +373,38 @@ int indent;
}
ASN1_INTEGER_free(bs);
}
+ else if (tag == V_ASN1_ENUMERATED)
+ {
+ ASN1_ENUMERATED *bs;
+ int i;
+
+ opp=op;
+ bs=d2i_ASN1_ENUMERATED(NULL,&opp,len+hl);
+ if (bs != NULL)
+ {
+ if (BIO_write(bp,":",1) <= 0) goto end;
+ if (bs->type == V_ASN1_NEG_ENUMERATED)
+ if (BIO_write(bp,"-",1) <= 0)
+ goto end;
+ for (i=0; i<bs->length; i++)
+ {
+ if (BIO_printf(bp,"%02X",
+ bs->data[i]) <= 0)
+ goto end;
+ }
+ if (bs->length == 0)
+ {
+ if (BIO_write(bp,"00",2) <= 0)
+ goto end;
+ }
+ }
+ else
+ {
+ if (BIO_write(bp,"BAD ENUMERATED",11) <= 0)
+ goto end;
+ }
+ ASN1_ENUMERATED_free(bs);
+ }
if (!nl)
{