/* Allocate buffer for new encoding */
new_der = OPENSSL_malloc(len);
+ if (!new_der)
+ goto err;
/* Generate tagged encoding */
arg->format = ASN1_GEN_FORMAT_BITLIST;
else
{
- ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKOWN_FORMAT);
+ ASN1err(ASN1_F_ASN1_CB, ASN1_R_UNKNOWN_FORMAT);
return -1;
}
break;
int derlen;
int i;
sk = sk_ASN1_TYPE_new_null();
+ if (!sk)
+ goto bad;
if (section)
{
if (!cnf)
ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf);
if (!typ)
goto bad;
- sk_ASN1_TYPE_push(sk, typ);
+ if (!sk_ASN1_TYPE_push(sk, typ))
+ goto bad;
}
}
else
derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);
+ if (derlen < 0)
+ goto bad;
+
if (!(ret = ASN1_TYPE_new()))
goto bad;
return 1;
}
+static int mask_cb(const char *elem, int len, void *arg)
+ {
+ unsigned long *pmask = arg, tmpmask;
+ int tag;
+ if (len == 3 && !strncmp(elem, "DIR", 3))
+ {
+ *pmask |= B_ASN1_DIRECTORYSTRING;
+ return 1;
+ }
+ tag = asn1_str2tag(elem, len);
+ if (!tag || (tag & ASN1_GEN_FLAG))
+ return 0;
+ tmpmask = ASN1_tag2bit(tag);
+ if (!tmpmask)
+ return 0;
+ *pmask |= tmpmask;
+ return 1;
+ }
+
+int ASN1_str2mask(const char *str, unsigned long *pmask)
+ {
+ *pmask = 0;
+ return CONF_parse_list(str, '|', 1, mask_cb, pmask);
+ }