*/
static int make_REQ(X509_REQ *req,EVP_PKEY *pkey,int attribs);
-static int add_attribute_object(STACK *n, char *text, char *def,
- char *value, int nid,int min,int max);
+static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,
+ char *def, char *value, int nid, int min,
+ int max);
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
int nid,int min,int max);
static void MS_CALLBACK req_cb(int p,int n,char *arg);
return(ret);
}
-static int add_attribute_object(STACK *n, char *text, char *def, char *value,
- int nid, int min, int max)
+static int add_attribute_object(STACK_OF(X509_ATTRIBUTE) *n, char *text,
+ char *def, char *value, int nid, int min,
+ int max)
{
int i,z;
X509_ATTRIBUTE *xa=NULL;
at=NULL;
/* only one item per attribute */
- if (!sk_push(n,(char *)xa)) goto err;
+ if (!sk_X509_ATTRIBUTE_push(n,xa)) goto err;
return(1);
err:
if (xa != NULL) X509_ATTRIBUTE_free(xa);
M_ASN1_D2I_get_imp_set(r,func,free_func,\
x,V_ASN1_CONTEXT_SPECIFIC);
+#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
+ M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
+ x,V_ASN1_CONTEXT_SPECIFIC);
+
#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
c.q=c.p; \
if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
#define M_ASN1_I2D_len_IMP_SET(a,f,x) \
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
+ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+ V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+
#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
if ((a != NULL) && (sk_num(a) != 0)) \
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
IS_SET);
+#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
+ if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+ ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
+ V_ASN1_CONTEXT_SPECIFIC,IS_SET);
+
#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
IS_SEQUENCE);
V_ASN1_UNIVERSAL,IS_SET)
#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
V_ASN1_CONTEXT_SPECIFIC,IS_SET)
+#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
+ i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
IS_SET); }
+#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
+ if ((a != NULL) && (sk_##type##_num(a) != 0)) \
+ { i2d_ASN1_SET_OF_##type(a,&p,f,x, \
+ V_ASN1_CONTEXT_SPECIFIC, \
+ IS_SET); }
+
#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
if ((a != NULL) && (sk_num(a) != 0)) \
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
const char *neg;
X509_REQ_INFO *ri;
EVP_PKEY *pkey;
- STACK *sk;
+ STACK_OF(X509_ATTRIBUTE) *sk;
char str[128];
ri=x->req_info;
if (BIO_puts(bp,str) <= 0) goto err;
sk=x->req_info->attributes;
- if ((sk == NULL) || (sk_num(sk) == 0))
+ if ((sk == NULL) || (sk_X509_ATTRIBUTE_num(sk) == 0))
{
if (!x->req_info->req_kludge)
{
}
else
{
- for (i=0; i<sk_num(sk); i++)
+ for (i=0; i<sk_X509_ATTRIBUTE_num(sk); i++)
{
ASN1_TYPE *at;
X509_ATTRIBUTE *a;
ASN1_TYPE *t;
int j,type=0,count=1,ii=0;
- a=(X509_ATTRIBUTE *)sk_value(sk,i);
+ a=sk_X509_ATTRIBUTE_value(sk,i);
sprintf(str,"%12s","");
if (BIO_puts(bp,str) <= 0) goto err;
if ((j=i2a_ASN1_OBJECT(bp,a->object)) > 0)
*/
if (a->req_kludge)
{
- M_ASN1_I2D_len_IMP_SET_opt(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_len_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,i2d_X509_ATTRIBUTE,0);
}
else
{
- M_ASN1_I2D_len_IMP_SET(a->attributes, i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_len_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
M_ASN1_I2D_seq_total();
*/
if (a->req_kludge)
{
- M_ASN1_I2D_put_IMP_SET_opt(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_put_IMP_SET_opt_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
else
{
- M_ASN1_I2D_put_IMP_SET(a->attributes,i2d_X509_ATTRIBUTE,0);
+ M_ASN1_I2D_put_IMP_SET_type(X509_ATTRIBUTE,a->attributes,
+ i2d_X509_ATTRIBUTE,0);
}
M_ASN1_I2D_finish();
ret->req_kludge=1;
else
{
- M_ASN1_D2I_get_IMP_set(ret->attributes,d2i_X509_ATTRIBUTE,
- X509_ATTRIBUTE_free,0);
+ M_ASN1_D2I_get_IMP_set_type(X509_ATTRIBUTE,ret->attributes,
+ d2i_X509_ATTRIBUTE,
+ X509_ATTRIBUTE_free,0);
}
M_ASN1_D2I_Finish(a,X509_REQ_INFO_free,ASN1_F_D2I_X509_REQ_INFO);
M_ASN1_New(ret->version,ASN1_INTEGER_new);
M_ASN1_New(ret->subject,X509_NAME_new);
M_ASN1_New(ret->pubkey,X509_PUBKEY_new);
- M_ASN1_New(ret->attributes,sk_new_null);
+ M_ASN1_New(ret->attributes,sk_X509_ATTRIBUTE_new_null);
ret->req_kludge=0;
return(ret);
M_ASN1_New_Error(ASN1_F_X509_REQ_INFO_NEW);
ASN1_INTEGER_free(a->version);
X509_NAME_free(a->subject);
X509_PUBKEY_free(a->pubkey);
- sk_pop_free(a->attributes,X509_ATTRIBUTE_free);
+ sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
Free((char *)a);
}
void (*ex_free)(); /* clear argp stuff */
} X509_EXTENSION;
+/* a sequence of these are used */
+typedef struct x509_attributes_st
+ {
+ ASN1_OBJECT *object;
+ int set; /* 1 for a set, 0 for a single item (which is wrong) */
+ union {
+ char *ptr;
+/* 1 */ STACK /* ASN1_TYPE */ *set;
+/* 0 */ ASN1_TYPE *single;
+ } value;
+ } X509_ATTRIBUTE;
+
+DECLARE_STACK_OF(X509_ATTRIBUTE)
+DECLARE_ASN1_SET_OF(X509_ATTRIBUTE)
+
typedef struct X509_req_info_st
{
ASN1_INTEGER *version;
X509_NAME *subject;
X509_PUBKEY *pubkey;
/* d=2 hl=2 l= 0 cons: cont: 00 */
- STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */
+ STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
int req_kludge;
} X509_REQ_INFO;
int references;
} X509_CRL;
-/* a sequence of these are used */
-typedef struct x509_attributes_st
- {
- ASN1_OBJECT *object;
- int set; /* 1 for a set, 0 for a single item (which is wrong) */
- union {
- char *ptr;
-/* 1 */ STACK /* ASN1_TYPE */ *set;
-/* 0 */ ASN1_TYPE *single;
- } value;
- } X509_ATTRIBUTE;
-
-DECLARE_STACK_OF(X509_ATTRIBUTE)
-
typedef struct private_key_st
{
int version;
/* duplicate the request */
xi=ret->cert_info;
- if (sk_num(r->req_info->attributes) != 0)
+ if (sk_X509_ATTRIBUTE_num(r->req_info->attributes) != 0)
{
if ((xi->version=ASN1_INTEGER_new()) == NULL) goto err;
if (!ASN1_INTEGER_set(xi->version,2)) goto err;
IMPLEMENT_STACK_OF(X509)
IMPLEMENT_ASN1_SET_OF(X509)
+
IMPLEMENT_STACK_OF(X509_NAME)
+
IMPLEMENT_STACK_OF(X509_ATTRIBUTE)
+IMPLEMENT_ASN1_SET_OF(X509_ATTRIBUTE)