X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fasn1%2Ftasn_prn.c;h=361e93c59fa301a697d35f164b8a2e8698d56967;hb=5e4430e70df0020f5f1517249851696cb9ac4ad2;hp=3cc98ea7d2258211470b809317ec78b117f11c20;hpb=c11c64fbe0c0d3d8eb3bdbda368805dc58d55b90;p=openssl.git diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c index 3cc98ea7d2..361e93c59f 100644 --- a/crypto/asn1/tasn_prn.c +++ b/crypto/asn1/tasn_prn.c @@ -343,7 +343,7 @@ int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, const char *sname, *fname; flags = tt->flags; if(pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME) - sname = tt->item->sname; + sname = ASN1_ITEM_ptr(tt->item)->sname; else sname = NULL; if(pctx->flags & ASN1_PCTX_FLAGS_NO_FIELD_NAME) @@ -354,6 +354,8 @@ int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, { char *tname; ASN1_VALUE *skitem; + STACK_OF(ASN1_VALUE) *stack; + /* SET OF, SEQUENCE OF */ if (fname) { @@ -371,14 +373,15 @@ int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, fname) <= 0) return 0; } - for(i = 0; i < sk_num((STACK *)*fld); i++) + stack = (STACK_OF(ASN1_VALUE) *)*fld; + for(i = 0; i < sk_ASN1_VALUE_num(stack); i++) { if ((i > 0) && (BIO_puts(out, "\n") <= 0)) return 0; - skitem = (ASN1_VALUE *)sk_value((STACK *)*fld, i); + skitem = sk_ASN1_VALUE_value(stack, i); if (!asn1_item_print_ctx(out, &skitem, indent + 2, - tt->item, NULL, NULL, 1, pctx)) + ASN1_ITEM_ptr(tt->item), NULL, NULL, 1, pctx)) return 0; } if (!i && BIO_printf(out, "%*s\n", indent + 2, "") <= 0) @@ -390,7 +393,7 @@ int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent, } return 1; } - return asn1_item_print_ctx(out, fld, indent, tt->item, + return asn1_item_print_ctx(out, fld, indent, ASN1_ITEM_ptr(tt->item), fname, sname, 0, pctx); } @@ -506,7 +509,8 @@ static int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent, } else if (BIO_puts(out, "\n") <= 0) return 0; - if (BIO_dump_indent(out, (char *)str->data, str->length, + if ((str->length > 0) + && BIO_dump_indent(out, (char *)str->data, str->length, indent + 2) <= 0) return 0; return 1; @@ -521,8 +525,12 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, ASN1_STRING *str; int ret = 1, needlf = 1; const char *pname; + const ASN1_PRIMITIVE_FUNCS *pf; + pf = it->funcs; if (!asn1_print_fsname(out, indent, fname, sname, pctx)) return 0; + if (pf && pf->prim_print) + return pf->prim_print(out, fld, it, indent, pctx); str = (ASN1_STRING *)*fld; if (it->itype == ASN1_ITYPE_MSTRING) utype = str->type & ~V_ASN1_NEG; @@ -532,7 +540,7 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, { ASN1_TYPE *atype = (ASN1_TYPE *)*fld; utype = atype->type; - fld = (ASN1_VALUE **)&atype->value.ptr; + fld = &atype->value.asn1_value; str = (ASN1_STRING *)*fld; if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE) pname = NULL;