Latest update
This commit is contained in:
+26
-26
@@ -101,15 +101,15 @@ void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags)
|
||||
|
||||
/* Main print routines */
|
||||
|
||||
static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
static int asn1_item_print_ctx(BIO *out, const ASN1_VALUE **fld, int indent,
|
||||
const ASN1_ITEM *it,
|
||||
const char *fname, const char *sname,
|
||||
int nohdr, const ASN1_PCTX *pctx);
|
||||
|
||||
static int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
static int asn1_template_print_ctx(BIO *out, const ASN1_VALUE **fld, int indent,
|
||||
const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx);
|
||||
|
||||
static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
|
||||
static int asn1_primitive_print(BIO *out, const ASN1_VALUE **fld,
|
||||
const ASN1_ITEM *it, int indent,
|
||||
const char *fname, const char *sname,
|
||||
const ASN1_PCTX *pctx);
|
||||
@@ -118,7 +118,7 @@ static int asn1_print_fsname(BIO *out, int indent,
|
||||
const char *fname, const char *sname,
|
||||
const ASN1_PCTX *pctx);
|
||||
|
||||
int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
|
||||
int ASN1_item_print(BIO *out, const ASN1_VALUE *ifld, int indent,
|
||||
const ASN1_ITEM *it, const ASN1_PCTX *pctx)
|
||||
{
|
||||
const char *sname;
|
||||
@@ -131,25 +131,25 @@ int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
|
||||
return asn1_item_print_ctx(out, &ifld, indent, it, NULL, sname, 0, pctx);
|
||||
}
|
||||
|
||||
static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
static int asn1_item_print_ctx(BIO *out, const ASN1_VALUE **fld, int indent,
|
||||
const ASN1_ITEM *it,
|
||||
const char *fname, const char *sname,
|
||||
int nohdr, const ASN1_PCTX *pctx)
|
||||
{
|
||||
const ASN1_TEMPLATE *tt;
|
||||
const ASN1_EXTERN_FUNCS *ef;
|
||||
ASN1_VALUE **tmpfld;
|
||||
const ASN1_VALUE **tmpfld;
|
||||
const ASN1_AUX *aux = it->funcs;
|
||||
ASN1_aux_cb *asn1_cb;
|
||||
ASN1_aux_const_cb *asn1_cb = NULL;
|
||||
ASN1_PRINT_ARG parg;
|
||||
int i;
|
||||
if (aux && aux->asn1_cb) {
|
||||
if (aux != NULL) {
|
||||
parg.out = out;
|
||||
parg.indent = indent;
|
||||
parg.pctx = pctx;
|
||||
asn1_cb = aux->asn1_cb;
|
||||
} else
|
||||
asn1_cb = 0;
|
||||
asn1_cb = ((aux->flags & ASN1_AFLG_CONST_CB) != 0) ? aux->asn1_const_cb
|
||||
: (ASN1_aux_const_cb *)aux->asn1_cb; /* backward compatibility */
|
||||
}
|
||||
|
||||
if (((it->itype != ASN1_ITYPE_PRIMITIVE)
|
||||
|| (it->utype != V_ASN1_BOOLEAN)) && *fld == NULL) {
|
||||
@@ -195,7 +195,7 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
|
||||
case ASN1_ITYPE_CHOICE:
|
||||
/* CHOICE type, get selector */
|
||||
i = asn1_get_choice_selector(fld, it);
|
||||
i = asn1_get_choice_selector_const(fld, it);
|
||||
/* This should never happen... */
|
||||
if ((i < 0) || (i >= it->tcount)) {
|
||||
if (BIO_printf(out, "ERROR: selector [%d] invalid\n", i) <= 0)
|
||||
@@ -203,7 +203,7 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
return 1;
|
||||
}
|
||||
tt = it->templates + i;
|
||||
tmpfld = asn1_get_field_ptr(fld, tt);
|
||||
tmpfld = asn1_get_const_field_ptr(fld, tt);
|
||||
if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx))
|
||||
return 0;
|
||||
break;
|
||||
@@ -233,10 +233,10 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
/* Print each field entry */
|
||||
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
|
||||
const ASN1_TEMPLATE *seqtt;
|
||||
seqtt = asn1_do_adb(fld, tt, 1);
|
||||
seqtt = asn1_do_adb(*fld, tt, 1);
|
||||
if (!seqtt)
|
||||
return 0;
|
||||
tmpfld = asn1_get_field_ptr(fld, seqtt);
|
||||
tmpfld = asn1_get_const_field_ptr(fld, seqtt);
|
||||
if (!asn1_template_print_ctx(out, tmpfld,
|
||||
indent + 2, seqtt, pctx))
|
||||
return 0;
|
||||
@@ -261,12 +261,12 @@ static int asn1_item_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
static int asn1_template_print_ctx(BIO *out, const ASN1_VALUE **fld, int indent,
|
||||
const ASN1_TEMPLATE *tt, const ASN1_PCTX *pctx)
|
||||
{
|
||||
int i, flags;
|
||||
const char *sname, *fname;
|
||||
ASN1_VALUE *tfld;
|
||||
const ASN1_VALUE *tfld;
|
||||
flags = tt->flags;
|
||||
if (pctx->flags & ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME)
|
||||
sname = ASN1_ITEM_ptr(tt->item)->sname;
|
||||
@@ -282,14 +282,14 @@ static int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
* a pointer to a field.
|
||||
*/
|
||||
if (flags & ASN1_TFLG_EMBED) {
|
||||
tfld = (ASN1_VALUE *)fld;
|
||||
tfld = (const ASN1_VALUE *)fld;
|
||||
fld = &tfld;
|
||||
}
|
||||
|
||||
if (flags & ASN1_TFLG_SK_MASK) {
|
||||
char *tname;
|
||||
ASN1_VALUE *skitem;
|
||||
STACK_OF(ASN1_VALUE) *stack;
|
||||
const ASN1_VALUE *skitem;
|
||||
STACK_OF(const_ASN1_VALUE) *stack;
|
||||
|
||||
/* SET OF, SEQUENCE OF */
|
||||
if (fname) {
|
||||
@@ -304,12 +304,12 @@ static int asn1_template_print_ctx(BIO *out, ASN1_VALUE **fld, int indent,
|
||||
} else if (BIO_printf(out, "%*s%s:\n", indent, "", fname) <= 0)
|
||||
return 0;
|
||||
}
|
||||
stack = (STACK_OF(ASN1_VALUE) *)*fld;
|
||||
for (i = 0; i < sk_ASN1_VALUE_num(stack); i++) {
|
||||
stack = (STACK_OF(const_ASN1_VALUE) *)*fld;
|
||||
for (i = 0; i < sk_const_ASN1_VALUE_num(stack); i++) {
|
||||
if ((i > 0) && (BIO_puts(out, "\n") <= 0))
|
||||
return 0;
|
||||
|
||||
skitem = sk_ASN1_VALUE_value(stack, i);
|
||||
skitem = sk_const_ASN1_VALUE_value(stack, i);
|
||||
if (!asn1_item_print_ctx(out, &skitem, indent + 2,
|
||||
ASN1_ITEM_ptr(tt->item), NULL, NULL, 1,
|
||||
pctx))
|
||||
@@ -430,7 +430,7 @@ static int asn1_print_obstring(BIO *out, const ASN1_STRING *str, int indent)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
|
||||
static int asn1_primitive_print(BIO *out, const ASN1_VALUE **fld,
|
||||
const ASN1_ITEM *it, int indent,
|
||||
const char *fname, const char *sname,
|
||||
const ASN1_PCTX *pctx)
|
||||
@@ -456,9 +456,9 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld,
|
||||
str = (ASN1_STRING *)*fld;
|
||||
}
|
||||
if (utype == V_ASN1_ANY) {
|
||||
ASN1_TYPE *atype = (ASN1_TYPE *)*fld;
|
||||
const ASN1_TYPE *atype = (const ASN1_TYPE *)*fld;
|
||||
utype = atype->type;
|
||||
fld = &atype->value.asn1_value;
|
||||
fld = (const ASN1_VALUE **)&atype->value.asn1_value; /* actually is const */
|
||||
str = (ASN1_STRING *)*fld;
|
||||
if (pctx->flags & ASN1_PCTX_FLAGS_NO_ANY_TYPE)
|
||||
pname = NULL;
|
||||
|
||||
Reference in New Issue
Block a user