New config module for string tables. This can be used to add new
[openssl.git] / crypto / asn1 / asn1_gen.c
index 4fc241908f6923b4f99e5e4e8d2ed0c1ba4a17bf..7c2c337a1a6670807521c8ddc35a113e4f3b0726 100644 (file)
@@ -852,3 +852,27 @@ static int bitstr_cb(const char *elem, int len, void *bitstr)
        return 1;
        }
 
        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);
+       }