-/* $OpenBSD: asn1t.h,v 1.19 2022/01/14 08:43:06 tb Exp $ */
+/* $OpenBSD: asn1t.h,v 1.20 2022/05/10 05:19:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
(flags), (tag), offsetof(stname, field),\
#field, ASN1_ITEM_ref(type) }
-/* used when the structure is combined with the parent */
-
-#define ASN1_EX_COMBINE(flags, tag, type) { \
- (flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }
-
/* implicit and explicit helper macros */
#define ASN1_IMP_EX(stname, field, type, tag, ex) \
#define ASN1_TFLG_ADB_INT (0x1<<9)
-/*
- * This flag means a parent structure is passed
- * instead of the field: this is useful is a
- * SEQUENCE is being combined with a CHOICE for
- * example. Since this means the structure and
- * item name will differ we need to use the
- * ASN1_CHOICE_END_name() macro for example.
- */
-
-#define ASN1_TFLG_COMBINE (0x1<<10)
-
/*
* This flag when present in a SEQUENCE OF, SET OF
* or EXPLICIT causes indefinite length constructed
-/* $OpenBSD: tasn_dec.c,v 1.61 2022/05/07 15:50:25 jsing Exp $ */
+/* $OpenBSD: tasn_dec.c,v 1.62 2022/05/10 05:19:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
const unsigned char *p = NULL;
int i;
int ret = 0;
- int combine;
-
- combine = aclass & ASN1_TFLG_COMBINE;
- aclass &= ~ASN1_TFLG_COMBINE;
if (it->itype != ASN1_ITYPE_CHOICE)
goto err;
auxerr:
ASN1error(ASN1_R_AUX_ERROR);
err:
- if (combine == 0)
- ASN1_item_ex_free(pval, it);
+ ASN1_item_ex_free(pval, it);
+
if (errtt)
ERR_asprintf_error_data("Field=%s, Type=%s", errtt->field_name,
it->sname);
long tmplen;
int i;
int ret = 0;
- int combine;
-
- combine = aclass & ASN1_TFLG_COMBINE;
- aclass &= ~ASN1_TFLG_COMBINE;
if (it->itype != ASN1_ITYPE_NDEF_SEQUENCE &&
it->itype != ASN1_ITYPE_SEQUENCE)
auxerr:
ASN1error(ASN1_R_AUX_ERROR);
err:
- if (combine == 0)
- ASN1_item_ex_free(pval, it);
+ ASN1_item_ex_free(pval, it);
+
if (errtt)
ERR_asprintf_error_data("Field=%s, Type=%s", errtt->field_name,
it->sname);
unsigned char oclass;
int otag;
int ret = 0;
- int combine;
-
- combine = aclass & ASN1_TFLG_COMBINE;
- aclass &= ~ASN1_TFLG_COMBINE;
if (!pval)
return 0;
case ASN1_ITYPE_CHOICE:
return asn1_item_ex_d2i_choice(pval, in, len, it, tag,
- aclass | combine, opt, depth);
+ aclass, opt, depth);
case ASN1_ITYPE_NDEF_SEQUENCE:
case ASN1_ITYPE_SEQUENCE:
return asn1_item_ex_d2i_sequence(pval, in, len, it, tag,
- aclass | combine, opt, depth);
+ aclass, opt, depth);
default:
return 0;
}
err:
- if (combine == 0)
- ASN1_item_ex_free(pval, it);
+ ASN1_item_ex_free(pval, it);
ERR_asprintf_error_data("Type=%s", it->sname);
return -1;
} else {
/* Nothing special */
- ret = asn1_item_ex_d2i(val, &p, len, tt->item,
- -1, tt->flags & ASN1_TFLG_COMBINE, opt, depth);
+ ret = asn1_item_ex_d2i(val, &p, len, tt->item, -1, 0,
+ opt, depth);
if (!ret) {
ASN1error(ERR_R_NESTED_ASN1_ERROR);
goto err;
-/* $OpenBSD: tasn_fre.c,v 1.18 2022/01/07 12:24:17 tb Exp $ */
+/* $OpenBSD: tasn_fre.c,v 1.19 2022/05/10 05:19:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
#include "asn1_locl.h"
-static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it,
- int combine);
+static void asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
/* Free up an ASN1 structure */
void
ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
- asn1_item_combine_free(&val, it, 0);
+ asn1_item_free(&val, it);
}
void
ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
- asn1_item_combine_free(pval, it, 0);
+ asn1_item_free(pval, it);
}
static void
-asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
+asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
const ASN1_TEMPLATE *tt = NULL, *seqtt;
const ASN1_EXTERN_FUNCS *ef;
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
- if (!combine) {
- free(*pval);
- *pval = NULL;
- }
+ free(*pval);
+ *pval = NULL;
break;
case ASN1_ITYPE_EXTERN:
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
- if (!combine) {
- free(*pval);
- *pval = NULL;
- }
+ free(*pval);
+ *pval = NULL;
break;
}
}
for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
ASN1_VALUE *vtmp;
vtmp = sk_ASN1_VALUE_value(sk, i);
- asn1_item_combine_free(&vtmp, tt->item,
- 0);
+ asn1_item_free(&vtmp, tt->item);
}
sk_ASN1_VALUE_free(sk);
*pval = NULL;
} else
- asn1_item_combine_free(pval, tt->item,
- tt->flags & ASN1_TFLG_COMBINE);
+ asn1_item_free(pval, tt->item);
}
void
-/* $OpenBSD: tasn_new.c,v 1.21 2022/01/07 12:24:17 tb Exp $ */
+/* $OpenBSD: tasn_new.c,v 1.22 2022/05/10 05:19:22 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
#include "asn1_locl.h"
-static int asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
- int combine);
+static int asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void asn1_item_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
int
ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
- return asn1_item_ex_combine_new(pval, it, 0);
+ return asn1_item_ex_new(pval, it);
}
static int
-asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
+asn1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
const ASN1_TEMPLATE *tt = NULL;
const ASN1_EXTERN_FUNCS *ef;
if (aux != NULL && aux->asn1_cb != NULL)
asn1_cb = aux->asn1_cb;
- if (!combine)
- *pval = NULL;
-
+ *pval = NULL;
switch (it->itype) {
case ASN1_ITYPE_EXTERN:
return 1;
}
}
- if (!combine) {
- *pval = calloc(1, it->size);
- if (!*pval)
- goto memerr;
- }
+ *pval = calloc(1, it->size);
+ if (!*pval)
+ goto memerr;
asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr;
return 1;
}
}
- if (!combine) {
- *pval = calloc(1, it->size);
- if (!*pval)
- goto memerr;
- asn1_do_lock(pval, 0, it);
- asn1_enc_init(pval, it);
- }
+ *pval = calloc(1, it->size);
+ if (!*pval)
+ goto memerr;
+ asn1_do_lock(pval, 0, it);
+ asn1_enc_init(pval, it);
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
pseqval = asn1_get_field_ptr(pval, tt);
if (!ASN1_template_new(pseqval, tt))
goto done;
}
/* Otherwise pass it back to the item routine */
- ret = asn1_item_ex_combine_new(pval, it, tt->flags & ASN1_TFLG_COMBINE);
+ ret = asn1_item_ex_new(pval, it);
done:
return ret;
}
-/* $OpenBSD: tasn_utl.c,v 1.13 2021/12/25 13:17:48 jsing Exp $ */
+/* $OpenBSD: tasn_utl.c,v 1.14 2022/05/10 05:19:23 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
{
ASN1_VALUE **pvaltmp;
- if (tt->flags & ASN1_TFLG_COMBINE)
- return pval;
pvaltmp = offset2ptr(*pval, tt->offset);
/* NOTE for BOOLEAN types the field is just a plain
* int so we can't return int **, so settle for