Remove X509_ATTRIBUTE hack.
[openssl.git] / crypto / x509 / x_attrib.c
index 335a85be7cb1de730beb7c379f751bdd7130e6cd..a07a5da1398d560c02571503b6fccda49bd2c53a 100644 (file)
  * typedef struct x509_attributes_st
  *      {
  *      ASN1_OBJECT *object;
  * typedef struct x509_attributes_st
  *      {
  *      ASN1_OBJECT *object;
- *      int single;
- *      union   {
- *              char            *ptr;
- *              STACK_OF(ASN1_TYPE) *set;
- *              ASN1_TYPE       *single;
- *              } value;
+ *      STACK_OF(ASN1_TYPE) *set;
  *      } X509_ATTRIBUTE;
  *
  *      } X509_ATTRIBUTE;
  *
- * this needs some extra thought because the CHOICE type is
- * merged with the main structure and because the value can
- * be anything at all we *must* try the SET OF first because
- * the ASN1_ANY type will swallow anything including the whole
- * SET OF structure.
  */
 
  */
 
-ASN1_CHOICE(X509_ATTRIBUTE_SET) = {
-        ASN1_SET_OF(X509_ATTRIBUTE, value.set, ASN1_ANY),
-        ASN1_SIMPLE(X509_ATTRIBUTE, value.single, ASN1_ANY)
-} ASN1_CHOICE_END_selector(X509_ATTRIBUTE, X509_ATTRIBUTE_SET, single)
-
 ASN1_SEQUENCE(X509_ATTRIBUTE) = {
         ASN1_SIMPLE(X509_ATTRIBUTE, object, ASN1_OBJECT),
 ASN1_SEQUENCE(X509_ATTRIBUTE) = {
         ASN1_SIMPLE(X509_ATTRIBUTE, object, ASN1_OBJECT),
-        /* CHOICE type merged with parent */
-        ASN1_EX_COMBINE(0, 0, X509_ATTRIBUTE_SET)
+        ASN1_SET_OF(X509_ATTRIBUTE, set, ASN1_ANY)
 } ASN1_SEQUENCE_END(X509_ATTRIBUTE)
 
 IMPLEMENT_ASN1_FUNCTIONS(X509_ATTRIBUTE)
 } ASN1_SEQUENCE_END(X509_ATTRIBUTE)
 
 IMPLEMENT_ASN1_FUNCTIONS(X509_ATTRIBUTE)
@@ -106,12 +90,9 @@ X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value)
     if ((ret = X509_ATTRIBUTE_new()) == NULL)
         return (NULL);
     ret->object = OBJ_nid2obj(nid);
     if ((ret = X509_ATTRIBUTE_new()) == NULL)
         return (NULL);
     ret->object = OBJ_nid2obj(nid);
-    ret->single = 0;
-    if ((ret->value.set = sk_ASN1_TYPE_new_null()) == NULL)
-        goto err;
     if ((val = ASN1_TYPE_new()) == NULL)
         goto err;
     if ((val = ASN1_TYPE_new()) == NULL)
         goto err;
-    if (!sk_ASN1_TYPE_push(ret->value.set, val))
+    if (!sk_ASN1_TYPE_push(ret->set, val))
         goto err;
 
     ASN1_TYPE_set(val, atrtype, value);
         goto err;
 
     ASN1_TYPE_set(val, atrtype, value);