#include <stdio.h>
#include "cryptlib.h"
-#include "objects.h"
-#include "asn1_mac.h"
-
-/*
- * ASN1err(ASN1_F_D2I_X509_ATTRIBUTE,ERR_R_ASN1_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_X509_ATTRIBUTE_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
- * ASN1err(ASN1_F_I2D_X509_ATTRIBUTE,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
- */
+#include <openssl/objects.h>
+#include <openssl/asn1_mac.h>
/* sequence */
-int i2d_X509_ATTRIBUTE(a,pp)
-X509_ATTRIBUTE *a;
-unsigned char **pp;
+int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **pp)
{
int k=0;
int r=0,ret=0;
ret+=i2d_ASN1_OBJECT(a->object,p);
if (a->set)
- ret+=i2d_ASN1_SET(a->value.set,p,i2d_ASN1_TYPE,
- V_ASN1_SET,V_ASN1_UNIVERSAL);
+ ret+=i2d_ASN1_SET_OF_ASN1_TYPE(a->value.set,p,i2d_ASN1_TYPE,
+ V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
else
ret+=i2d_ASN1_TYPE(a->value.single,p);
if (k++) return(r);
}
}
-X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(a,pp,length)
-X509_ATTRIBUTE **a;
-unsigned char **pp;
-long length;
+X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, unsigned char **pp,
+ long length)
{
M_ASN1_D2I_vars(a,X509_ATTRIBUTE *,X509_ATTRIBUTE_new);
(M_ASN1_next == (V_ASN1_CONSTRUCTED|V_ASN1_UNIVERSAL|V_ASN1_SET)))
{
ret->set=1;
- M_ASN1_D2I_get_set(ret->value.set,d2i_ASN1_TYPE,ASN1_TYPE_free);
+ M_ASN1_D2I_get_set_type(ASN1_TYPE,ret->value.set,d2i_ASN1_TYPE,
+ ASN1_TYPE_free);
}
else
{
M_ASN1_D2I_Finish(a,X509_ATTRIBUTE_free,ASN1_F_D2I_X509_ATTRIBUTE);
}
-X509_ATTRIBUTE *X509_ATTRIBUTE_create(nid,atrtype,value)
-int nid;
-int atrtype;
-char *value;
+X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, char *value)
{
X509_ATTRIBUTE *ret=NULL;
ASN1_TYPE *val=NULL;
return(NULL);
ret->object=OBJ_nid2obj(nid);
ret->set=1;
- if ((ret->value.set=sk_new_null()) == NULL) goto err;
+ if ((ret->value.set=sk_ASN1_TYPE_new_null()) == NULL) goto err;
if ((val=ASN1_TYPE_new()) == NULL) goto err;
- if (!sk_push(ret->value.set,(char *)val)) goto err;
+ if (!sk_ASN1_TYPE_push(ret->value.set,val)) goto err;
ASN1_TYPE_set(val,atrtype,value);
return(ret);
return(NULL);
}
-X509_ATTRIBUTE *X509_ATTRIBUTE_new()
+X509_ATTRIBUTE *X509_ATTRIBUTE_new(void)
{
X509_ATTRIBUTE *ret=NULL;
ASN1_CTX c;
M_ASN1_New_Error(ASN1_F_X509_ATTRIBUTE_NEW);
}
-void X509_ATTRIBUTE_free(a)
-X509_ATTRIBUTE *a;
+void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a)
{
if (a == NULL) return;
ASN1_OBJECT_free(a->object);
if (a->set)
- sk_pop_free(a->value.set,ASN1_TYPE_free);
+ sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free);
else
ASN1_TYPE_free(a->value.single);
Free((char *)a);