Another STACK bites the dust.

This commit is contained in:
Ben Laurie 1999-04-17 10:28:46 +00:00
parent 1d48dd0019
commit cfdcfede9c
5 changed files with 41 additions and 25 deletions

View file

@ -193,6 +193,10 @@ err:\
M_ASN1_D2I_get_imp_set(r,func,free_func,\
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
@ -211,8 +215,8 @@ err:\
#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
c.q=c.p; \
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,free_func,a,b) \
== NULL) \
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
free_func,a,b) == NULL) \
{ c.line=__LINE__; goto err; } \
c.slen-=(c.p-c.q);
@ -309,6 +313,10 @@ err:\
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
IS_SEQUENCE);
#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
V_ASN1_UNIVERSAL,IS_SEQUENCE)
#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
if ((a != NULL) && (sk_num(a) != 0)) \
M_ASN1_I2D_len_SEQUENCE(a,f);
@ -379,6 +387,10 @@ err:\
#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
V_ASN1_UNIVERSAL,IS_SEQUENCE)
#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
IS_SEQUENCE)
#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
if ((a != NULL) && (sk_num(a) != 0)) \
M_ASN1_I2D_put_SEQUENCE(a,f);

View file

@ -164,11 +164,7 @@ typedef struct evp_pkey_st
struct dh_st *dh; /* DH */
} pkey;
int save_parameters;
#ifdef HEADER_STACK_H
STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */
#else
char /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */
#endif
STACK /*X509_ATTRIBUTE*/ *attributes; /* [ 0 ] */
} EVP_PKEY;
#define EVP_PKEY_MO_SIGN 0x0001

View file

@ -126,7 +126,7 @@ typedef struct X509_pubkey_st
{
X509_ALGOR *algor;
ASN1_BIT_STRING *public_key;
struct evp_pkey_st /* EVP_PKEY*/ *pkey;
EVP_PKEY *pkey;
} X509_PUBKEY;
typedef struct X509_sig_st
@ -256,6 +256,8 @@ typedef struct x509_attributes_st
} value;
} X509_ATTRIBUTE;
DECLARE_STACK_OF(X509_ATTRIBUTE);
typedef struct private_key_st
{
int version;

View file

@ -109,12 +109,12 @@ unsigned char **pp;
M_ASN1_I2D_vars(a);
M_ASN1_I2D_len (a->version, i2d_ASN1_INTEGER);
M_ASN1_I2D_len_SEQUENCE (a->ids, i2d_SXNETID);
M_ASN1_I2D_len_SEQUENCE_type (SXNETID, a->ids, i2d_SXNETID);
M_ASN1_I2D_seq_total();
M_ASN1_I2D_put (a->version, i2d_ASN1_INTEGER);
M_ASN1_I2D_put_SEQUENCE (a->ids, i2d_SXNETID);
M_ASN1_I2D_put_SEQUENCE_type (SXNETID, a->ids, i2d_SXNETID);
M_ASN1_I2D_finish();
}
@ -125,7 +125,7 @@ SXNET *SXNET_new()
ASN1_CTX c;
M_ASN1_New_Malloc(ret, SXNET);
M_ASN1_New(ret->version,ASN1_INTEGER_new);
M_ASN1_New(ret->ids,sk_new_null);
M_ASN1_New(ret->ids,sk_SXNETID_new_null);
return (ret);
M_ASN1_New_Error(ASN1_F_SXNET_NEW);
}
@ -139,7 +139,7 @@ long length;
M_ASN1_D2I_Init();
M_ASN1_D2I_start_sequence();
M_ASN1_D2I_get (ret->version, d2i_ASN1_INTEGER);
M_ASN1_D2I_get_seq (ret->ids, d2i_SXNETID, SXNETID_free);
M_ASN1_D2I_get_seq_type (SXNETID, ret->ids, d2i_SXNETID, SXNETID_free);
M_ASN1_D2I_Finish(a, SXNET_free, ASN1_F_D2I_SXNET);
}
@ -148,8 +148,8 @@ SXNET *a;
{
if (a == NULL) return;
ASN1_INTEGER_free(a->version);
sk_pop_free(a->ids, SXNETID_free);
Free ((char *)a);
sk_SXNETID_pop_free(a->ids, SXNETID_free);
Free (a);
}
int i2d_SXNETID(a,pp)
@ -199,7 +199,7 @@ SXNETID *a;
if (a == NULL) return;
ASN1_INTEGER_free(a->zone);
ASN1_OCTET_STRING_free(a->user);
Free ((char *)a);
Free (a);
}
static int sxnet_i2r(method, sx, out, indent)
@ -214,8 +214,8 @@ int indent;
int i;
v = ASN1_INTEGER_get(sx->version);
BIO_printf(out, "%*sVersion: %d (0x%X)", indent, "", v + 1, v);
for(i = 0; i < sk_num(sx->ids); i++) {
id = (SXNETID *)sk_value(sx->ids, i);
for(i = 0; i < sk_SXNETID_num(sx->ids); i++) {
id = sk_SXNETID_value(sx->ids, i);
tmp = i2s_ASN1_INTEGER(NULL, id->zone);
BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
Free(tmp);
@ -323,7 +323,7 @@ int userlen;
if(userlen == -1) userlen = strlen(user);
if(!ASN1_OCTET_STRING_set(id->user, user, userlen)) goto err;
if(!sk_push(sx->ids, (char *)id)) goto err;
if(!sk_SXNETID_push(sx->ids, id)) goto err;
id->zone = zone;
return 1;
@ -372,9 +372,12 @@ ASN1_INTEGER *zone;
{
SXNETID *id;
int i;
for(i = 0; i < sk_num(sx->ids); i++) {
id = (SXNETID *)sk_value(sx->ids, i);
for(i = 0; i < sk_SXNETID_num(sx->ids); i++) {
id = sk_SXNETID_value(sx->ids, i);
if(!ASN1_INTEGER_cmp(id->zone, zone)) return id->user;
}
return NULL;
}
IMPLEMENT_STACK_OF(SXNETID)
IMPLEMENT_ASN1_SET_OF(SXNETID)

View file

@ -184,16 +184,19 @@ union {
/* Strong extranet structures */
typedef struct SXNET_st {
ASN1_INTEGER *version;
STACK /* SXNETID */ *ids;
} SXNET;
typedef struct SXNET_ID_st {
ASN1_INTEGER *zone;
ASN1_OCTET_STRING *user;
} SXNETID;
DECLARE_STACK_OF(SXNETID)
DECLARE_ASN1_SET_OF(SXNETID)
typedef struct SXNET_st {
ASN1_INTEGER *version;
STACK_OF(SXNETID) *ids;
} SXNET;
#define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
",name:", val->name, ",value:", val->value);