159 static int asn1_item_print_ctx(
BIO *out,
ASN1_VALUE **fld,
int indent,
161 const char *fname,
const char *sname,
169 const char *fname,
const char *sname,
172 static int asn1_print_fsname(
BIO *out,
int indent,
173 const char *fname,
const char *sname,
186 return asn1_item_print_ctx(out, &ifld, indent, it,
187 NULL, sname, 0, pctx);
190 static int asn1_item_print_ctx(
BIO *out,
ASN1_VALUE **fld,
int indent,
192 const char *fname,
const char *sname,
215 if (!nohdr && !asn1_print_fsname(out, indent,
218 if (
BIO_puts(out,
"<ABSENT>\n") <= 0)
235 if (!asn1_primitive_print(out, fld, it,
236 indent, fname, sname,pctx))
241 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
250 if ((i == 2) && (
BIO_puts(out,
"\n") <= 0))
255 BIO_printf(out,
":EXTERNAL TYPE %s\n", sname) <= 0)
261 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
267 if((i < 0) || (i >= it->
tcount))
270 "ERROR: selector [%d] invalid\n", i) <= 0)
282 if (!nohdr && !asn1_print_fsname(out, indent, fname, sname, pctx))
308 for(i = 0, tt = it->
templates; i < it->tcount; i++, tt++)
314 indent + 2, seqtt, pctx))
319 if (
BIO_printf(out,
"%*s}\n", indent,
"") < 0)
343 const char *sname, *fname;
372 else if (
BIO_printf(out,
"%*s%s:\n", indent,
"",
379 if ((i > 0) && (
BIO_puts(out,
"\n") <= 0))
383 if (!asn1_item_print_ctx(out, &skitem, indent + 2,
387 if (!i &&
BIO_printf(out,
"%*s<EMPTY>\n", indent + 2,
"") <= 0)
391 if (
BIO_printf(out,
"%*s}\n", indent,
"") <= 0)
397 fname, sname, 0, pctx);
400 static int asn1_print_fsname(
BIO *out,
int indent,
401 const char *fname,
const char *sname,
404 static char spaces[] =
" ";
405 const int nspaces =
sizeof(spaces) - 1;
408 if (!sname && !fname)
412 while (indent > nspaces)
414 if (
BIO_write(out, spaces, nspaces) != nspaces)
418 if (
BIO_write(out, spaces, indent) != indent)
424 if (!sname && !fname)
449 static int asn1_print_boolean_ctx(
BIO *out,
int boolval,
496 if (
BIO_printf(out,
"%s (%s)", ln, objbuf) <= 0)
501 static int asn1_print_obstring_ctx(
BIO *out,
ASN1_STRING *str,
int indent,
507 str->
flags & 0x7) <= 0)
521 const char *fname,
const char *sname,
526 int ret = 1, needlf = 1;
530 if (!asn1_print_fsname(out, indent, fname, sname, pctx))
533 return pf->
prim_print(out, fld, it, indent, pctx);
577 int boolval = *(
int *)fld;
580 ret = asn1_print_boolean_ctx(out, boolval, pctx);
586 ret = asn1_print_integer_ctx(out, str, pctx);
598 ret = asn1_print_oid_ctx(out, (
const ASN1_OBJECT *)*fld, pctx);
603 ret = asn1_print_obstring_ctx(out, str, indent, pctx);
624 if (needlf &&
BIO_puts(out,
"\n") <= 0)