summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x_attrib.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-03-25 15:08:55 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-03-25 15:46:54 +0000
commite20b57270dece66ce2c68aeb5d14dd6d9f3c5d68 (patch)
tree169ebd0aa0e409d8a23e332f5e8ac29f1b2151dd /crypto/x509/x_attrib.c
parentca3a82c3b364e1e584546f0f3bbb938b0b472580 (diff)
Remove X509_ATTRIBUTE hack.
The X509_ATTRIBUTE structure includes a hack to tolerate malformed attributes that encode as the type instead of SET OF type. This form is never created by OpenSSL and shouldn't be needed any more. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509/x_attrib.c')
-rw-r--r--crypto/x509/x_attrib.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/crypto/x509/x_attrib.c b/crypto/x509/x_attrib.c
index 335a85be7c..a07a5da139 100644
--- a/crypto/x509/x_attrib.c
+++ b/crypto/x509/x_attrib.c
@@ -69,30 +69,14 @@
* 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;
*
- * 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),
- /* 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)
@@ -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);
- ret->single = 0;
- if ((ret->value.set = sk_ASN1_TYPE_new_null()) == 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);