asn1_node node, p, p2, p3;
char temp[128];
int counter, len2, len3, len4, move, ris, tlen;
+ asn1_node ptail = NULL;
unsigned char class;
unsigned long tag;
int indefinite, result, total_len = ider_len;
{ /* indefinite length method */
if (!HAVE_TWO(ider_len) || ((der[counter]) || der[counter + 1]))
{
- _asn1_append_sequence_set (p);
+ _asn1_append_sequence_set (p, &ptail);
p = p->down;
while (p->right)
p = p->right;
}
p->tmp_ival = 0;
+ ptail = NULL; /* finished decoding this structure */
DECR_LEN(ider_len, 2);
counter += 2;
}
{ /* definite length method */
if (len2 > counter)
{
- _asn1_append_sequence_set (p);
+ _asn1_append_sequence_set (p, &ptail);
p = p->down;
while (p->right)
p = p->right;
}
p->tmp_ival = 0;
+ ptail = NULL; /* finished decoding this structure */
+
if (len2 != counter)
{
result = ASN1_DER_ERROR;
|| (type_field (p2->type) == ASN1_ETYPE_SIZE))
p2 = p2->right;
if (p2->right == NULL)
- _asn1_append_sequence_set (p);
+ _asn1_append_sequence_set (p, &ptail);
p = p2;
}
}
int
-_asn1_append_sequence_set (asn1_node node)
+_asn1_append_sequence_set (asn1_node node, asn1_node *ptail)
{
asn1_node p, p2;
char temp[LTOSTR_MAX_SIZE];
|| (type_field (p->type) == ASN1_ETYPE_SIZE))
p = p->right;
p2 = _asn1_copy_structure3 (p);
- while (p->right)
- p = p->right;
+
+ if (ptail == NULL || *ptail == NULL || (*ptail)->up != p->up)
+ while (p->right) {
+ p = p->right;
+ }
+ else
+ {
+ p = *ptail;
+ }
+
_asn1_set_right (p, p2);
+ if (ptail)
+ *ptail = p2;
if (p->name[0] == 0)
_asn1_str_cpy (temp, sizeof (temp), "?1");
case ASN1_ETYPE_SET_OF:
if (_asn1_strcmp (value, "NEW"))
return ASN1_VALUE_NOT_VALID;
- _asn1_append_sequence_set (node);
+ _asn1_append_sequence_set (node, NULL);
break;
default:
return ASN1_ELEMENT_NOT_FOUND;
#define _ELEMENT_H
-int _asn1_append_sequence_set (asn1_node node);
+int _asn1_append_sequence_set (asn1_node node, asn1_node *pcached);
int _asn1_convert_integer (const unsigned char *value,
unsigned char *value_out,