00001
00007 #ifndef ARC_VOMSATTRIBUTE_H
00008 #define ARC_VOMSATTRIBUTE_H
00009
00010 #include <openssl/opensslv.h>
00011
00012 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
00013
00014 #include <openssl/safestack.h>
00015 #undef SKM_ASN1_SET_OF_d2i
00016 #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
00017 (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \
00018 pp, length, \
00019 CHECKED_D2I_OF(type, d2i_func), \
00020 CHECKED_SK_FREE_FUNC(type, free_func), \
00021 ex_tag, ex_class)
00022 #undef SKM_ASN1_SET_OF_i2d
00023 #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
00024 i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK) *)CHECKED_STACK_OF(type, st), pp, \
00025 CHECKED_I2D_OF(type, i2d_func), \
00026 ex_tag, ex_class, is_set)
00027 #endif
00028
00029 #include <openssl/evp.h>
00030 #include <openssl/asn1_mac.h>
00031 #include <openssl/x509.h>
00032 #include <openssl/x509v3.h>
00033 #include <openssl/stack.h>
00034 #include <openssl/safestack.h>
00035 #include <openssl/err.h>
00036
00037 namespace ArcCredential {
00038
00039 #define ASN1_F_D2I_AC_ATTR 5000
00040 #define AC_F_ATTR_New 5001
00041 #define ASN1_F_D2I_AC_ROLE 5002
00042 #define AC_F_ROLE_New 5003
00043 #define ASN1_F_D2I_AC_IETFATTR 5004
00044 #define AC_F_IETFATTR_New 5005
00045 #define ASN1_F_D2I_AC_IETFATTRVAL 5006
00046 #define ASN1_F_D2I_AC_DIGEST 5007
00047 #define AC_F_DIGEST_New 5008
00048 #define ASN1_F_D2I_AC_IS 5009
00049 #define AC_F_AC_IS_New 5010
00050 #define ASN1_F_D2I_AC_FORM 5011
00051 #define AC_F_AC_FORM_New 5012
00052 #define ASN1_F_D2I_AC_ACI 5013
00053 #define ASN1_F_AC_ACI_New 5014
00054 #define ASN1_F_D2I_AC_HOLDER 5015
00055 #define ASN1_F_AC_HOLDER_New 5016
00056 #define ASN1_F_AC_VAL_New 5017
00057 #define AC_F_AC_INFO_NEW 5018
00058 #define AC_F_D2I_AC 5019
00059 #define AC_F_AC_New 5020
00060 #define ASN1_F_I2D_AC_IETFATTRVAL 5021
00061 #define AC_F_D2I_AC_DIGEST 5022
00062 #define AC_F_AC_DIGEST_New 5023
00063 #define AC_F_D2I_AC_IS 5024
00064 #define AC_ERR_UNSET 5025
00065 #define AC_ERR_SET 5026
00066 #define AC_ERR_SIGNATURE 5027
00067 #define AC_ERR_VERSION 5028
00068 #define AC_ERR_HOLDER_SERIAL 5029
00069 #define AC_ERR_HOLDER 5030
00070 #define AC_ERR_UID_MISMATCH 5031
00071 #define AC_ERR_ISSUER_NAME 5032
00072 #define AC_ERR_SERIAL 5033
00073 #define AC_ERR_DATES 5034
00074 #define AC_ERR_ATTRIBS 5035
00075 #define AC_F_AC_TARGET_New 5036
00076 #define ASN1_F_D2I_AC_TARGET 5037
00077 #define AC_F_AC_TARGETS_New 5036
00078 #define ASN1_F_D2I_AC_TARGETS 5037
00079 #define ASN1_F_D2I_AC_SEQ 5038
00080 #define AC_F_AC_SEQ_new 5039
00081 #define AC_ERR_ATTRIB_URI 5040
00082 #define AC_ERR_ATTRIB_FQAN 5041
00083 #define AC_ERR_EXTS_ABSENT 5042
00084 #define AC_ERR_MEMORY 5043
00085 #define AC_ERR_EXT_CRIT 5044
00086 #define AC_ERR_EXT_TARGET 5045
00087 #define AC_ERR_EXT_KEY 5046
00088 #define AC_ERR_UNKNOWN 5047
00089
00090 #define AC_ERR_PARAMETERS 5048
00091 #define X509_ERR_ISSUER_NAME 5049
00092 #define X509_ERR_HOLDER_NAME 5050
00093 #define AC_ERR_NO_EXTENSION 5051
00094
00095 #define ASN1_F_D2I_AC_CERTS 5052
00096 #define AC_F_X509_New 5053
00097
00098 #define AC_F_D2I_AC_ATTRIBUTE 5054
00099 #define AC_F_ATTRIBUTE_New 5055
00100 #define ASN1_F_D2I_AC_ATT_HOLDER 5056
00101 #define AC_F_AC_ATT_HOLDER_New 5057
00102 #define ASN1_F_D2I_AC_FULL_ATTRIBUTES 5058
00103 #define AC_F_AC_FULL_ATTRIBUTES_New 5059
00104 #define ASN1_F_D2I_AC_ATTRIBUTEVAL 5060
00105 #define ASN1_F_I2D_AC_ATTRIBUTEVAL 5061
00106 #define AC_F_AC_ATTRIBUTEVAL_New 5062
00107 #define AC_ERR_ATTRIB 5063
00108
00109 typedef struct ACDIGEST {
00110 ASN1_ENUMERATED *type;
00111 ASN1_OBJECT *oid;
00112 X509_ALGOR *algor;
00113 ASN1_BIT_STRING *digest;
00114 } AC_DIGEST;
00115
00116 typedef struct ACIS {
00117 STACK_OF(GENERAL_NAME) *issuer;
00118 ASN1_INTEGER *serial;
00119 ASN1_BIT_STRING *uid;
00120 } AC_IS;
00121
00122 typedef struct ACFORM {
00123 STACK_OF(GENERAL_NAME) *names;
00124 AC_IS *is;
00125 AC_DIGEST *digest;
00126 } AC_FORM;
00127
00128 typedef struct ACACI {
00129 STACK_OF(GENERAL_NAME) *names;
00130 AC_FORM *form;
00131 } AC_ACI;
00132
00133 typedef struct ACHOLDER {
00134 AC_IS *baseid;
00135 STACK_OF(GENERAL_NAME) *name;
00136 AC_DIGEST *digest;
00137 } AC_HOLDER;
00138
00139 typedef struct ACVAL {
00140 ASN1_GENERALIZEDTIME *notBefore;
00141 ASN1_GENERALIZEDTIME *notAfter;
00142 } AC_VAL;
00143
00144 typedef struct asn1_string_st AC_IETFATTRVAL;
00145
00146 typedef struct ACIETFATTR {
00147 STACK_OF(GENERAL_NAME) *names;
00148 STACK_OF(AC_IETFATTRVAL) *values;
00149 } AC_IETFATTR;
00150
00151 typedef struct ACTARGET {
00152 GENERAL_NAME *name;
00153 GENERAL_NAME *group;
00154 AC_IS *cert;
00155 } AC_TARGET;
00156
00157 typedef struct ACTARGETS {
00158 STACK_OF(AC_TARGET) *targets;
00159 } AC_TARGETS;
00160
00161 typedef struct ACATTR {
00162 ASN1_OBJECT * type;
00163 int get_type;
00164 STACK_OF(AC_IETFATTR) *ietfattr;
00165 STACK_OF(AC_FULL_ATTRIBUTES) *fullattributes;
00166 } AC_ATTR;
00167 #define GET_TYPE_FQAN 1
00168 #define GET_TYPE_ATTRIBUTES 2
00169
00170 typedef struct ACINFO {
00171 ASN1_INTEGER *version;
00172 AC_HOLDER *holder;
00173 AC_FORM *form;
00174 X509_ALGOR *alg;
00175 ASN1_INTEGER *serial;
00176 AC_VAL *validity;
00177 STACK_OF(AC_ATTR) *attrib;
00178 ASN1_BIT_STRING *id;
00179 STACK_OF(X509_EXTENSION) *exts;
00180 } AC_INFO;
00181
00182 typedef struct ACC {
00183 AC_INFO *acinfo;
00184 X509_ALGOR *sig_alg;
00185 ASN1_BIT_STRING *signature;
00186 } AC;
00187
00188 typedef struct ACSEQ {
00189 STACK_OF(AC) *acs;
00190 } AC_SEQ;
00191
00192 typedef struct ACCERTS {
00193 STACK_OF(X509) *stackcert;
00194 } AC_CERTS;
00195
00196 typedef struct ACATTRIBUTE {
00197 ASN1_OCTET_STRING *name;
00198 ASN1_OCTET_STRING *qualifier;
00199 ASN1_OCTET_STRING *value;
00200 } AC_ATTRIBUTE;
00201
00202 typedef struct ACATTHOLDER {
00203 STACK_OF(GENERAL_NAME) *grantor;
00204 STACK_OF(AC_ATTRIBUTE) *attributes;
00205 } AC_ATT_HOLDER;
00206
00207 typedef struct ACFULLATTRIBUTES {
00208 STACK_OF(AC_ATT_HOLDER) *providers;
00209 } AC_FULL_ATTRIBUTES;
00210
00211 #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
00212 #define IMPL_STACK(type) \
00213 DECLARE_STACK_OF(type) \
00214 STACK_OF(type) *sk_##type##_new (int (*cmp)(const type * const *, \
00215 const type * const *)) \
00216 { return (STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp));} \
00217 STACK_OF(type) *sk_##type##_new_null () { return (STACK_OF(type) *)sk_new_null(); } \
00218 void sk_##type##_free (STACK_OF(type) *st) { sk_free(CHECKED_STACK_OF(type, st)); } \
00219 int sk_##type##_num (const STACK_OF(type) *st) { return sk_num(CHECKED_STACK_OF(type, st)); } \
00220 type *sk_##type##_value (const STACK_OF(type) *st, int i) { return (type *)sk_value(CHECKED_STACK_OF(type, st), i); } \
00221 type *sk_##type##_set (STACK_OF(type) *st, int i, type *val) { return (type *)sk_set(CHECKED_STACK_OF(type, st), i, CHECKED_PTR_OF(type, val)); } \
00222 void sk_##type##_zero (STACK_OF(type) *st) { sk_zero(CHECKED_STACK_OF(type, st)); } \
00223 int sk_##type##_push (STACK_OF(type) *st, type *val) { return sk_push(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)); } \
00224 int sk_##type##_unshift (STACK_OF(type) *st, type *val) { return sk_unshift(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)); } \
00225 int sk_##type##_find (STACK_OF(type) *st, type *val) { return sk_find(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val)); } \
00226 type *sk_##type##_delete (STACK_OF(type) *st, int i) { return (type *)sk_delete(CHECKED_STACK_OF(type, st), i); } \
00227 type *sk_##type##_delete_ptr (STACK_OF(type) *st, type *ptr) { return (type *)sk_delete_ptr(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, ptr)); } \
00228 int sk_##type##_insert (STACK_OF(type) *st, type *val, int i) { return sk_insert(CHECKED_STACK_OF(type, st), CHECKED_PTR_OF(type, val), i); } \
00229 int (*sk_##type##_set_cmp_func (STACK_OF(type) *st, int (*cmp)(const type * const *, const type * const *)))(const type * const *, const type * const *) \
00230 { return (int ((*)(const type * const *, const type * const *)))sk_set_cmp_func(CHECKED_STACK_OF(type, st), CHECKED_SK_CMP_FUNC(type, cmp)); } \
00231 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *st) { return (STACK_OF(type) *)sk_dup(CHECKED_STACK_OF(type, st)); } \
00232 void sk_##type##_pop_free (STACK_OF(type) *st, void (*func)(type *)) { sk_pop_free(CHECKED_STACK_OF(type, st), CHECKED_SK_FREE_FUNC(type, func)); } \
00233 type *sk_##type##_shift (STACK_OF(type) *st) { return (type *)sk_shift(CHECKED_STACK_OF(type, st)); } \
00234 type *sk_##type##_pop (STACK_OF(type) *st) { return (type *)sk_pop(CHECKED_STACK_OF(type, st)); } \
00235 void sk_##type##_sort (STACK_OF(type) *st) { sk_sort(CHECKED_STACK_OF(type, st)); } \
00236 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **st, const unsigned char **pp, long length, type *(*d2ifunc)(type**, const unsigned char**, long), void (*freefunc)(type *), int ex_tag, int ex_class) \
00237 { return (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK)**)CHECKED_PTR_OF(STACK_OF(type)*, st), \
00238 pp, length, \
00239 CHECKED_D2I_OF(type, d2ifunc), \
00240 CHECKED_SK_FREE_FUNC(type, freefunc), \
00241 ex_tag, ex_class); } \
00242 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *st, unsigned char **pp, int (*i2dfunc)(type*, unsigned char**), int ex_tag, int ex_class, int is_set) \
00243 { return i2d_ASN1_SET((STACK_OF(OPENSSL_BLOCK)*)CHECKED_STACK_OF(type, st), pp, \
00244 CHECKED_I2D_OF(type, i2dfunc), \
00245 ex_tag, ex_class, is_set); } \
00246 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *st, int (*i2dfunc)(type*, unsigned char**), unsigned char **buf, int *len) { return ASN1_seq_pack((STACK_OF(OPENSSL_BLOCK)*)CHECKED_PTR_OF(STACK_OF(type), st), \
00247 CHECKED_I2D_OF(type, i2dfunc), buf, len); } \
00248 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *buf, int len, type *(*d2ifunc)(type**, const unsigned char**, long), void (*freefunc)(type *)) \
00249 { return (STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2ifunc), CHECKED_SK_FREE_FUNC(type, freefunc)); }
00250
00251 #define DECL_STACK(type) \
00252 PREDECLARE_STACK_OF(type) \
00253 STACK_OF(type) *sk_##type##_new (int (*)(const type * const *, const type * const *)); \
00254 STACK_OF(type) *sk_##type##_new_null (); \
00255 void sk_##type##_free (STACK_OF(type) *); \
00256 int sk_##type##_num (const STACK_OF(type) *); \
00257 type *sk_##type##_value (const STACK_OF(type) *, int); \
00258 type *sk_##type##_set (STACK_OF(type) *, int, type *); \
00259 void sk_##type##_zero (STACK_OF(type) *); \
00260 int sk_##type##_push (STACK_OF(type) *, type *); \
00261 int sk_##type##_unshift (STACK_OF(type) *, type *); \
00262 int sk_##type##_find (STACK_OF(type) *, type *); \
00263 type *sk_##type##_delete (STACK_OF(type) *, int); \
00264 type *sk_##type##_delete_ptr (STACK_OF(type) *, type *); \
00265 int sk_##type##_insert (STACK_OF(type) *, type *, int); \
00266 int (*sk_##type##_set_cmp_func (STACK_OF(type) *, int (*)(const type * const *, const type * const *)))(const type * const *, const type * const *); \
00267 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *); \
00268 void sk_##type##_pop_free (STACK_OF(type) *, void (*)(type *)); \
00269 type *sk_##type##_shift (STACK_OF(type) *); \
00270 type *sk_##type##_pop (STACK_OF(type) *); \
00271 void sk_##type##_sort (STACK_OF(type) *); \
00272 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **, const unsigned char **, long, type *(*)(type**, const unsigned char **, long), void (*)(type *), int, int); \
00273 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *, unsigned char **, int (*)(type*, unsigned char**), int, int, int); \
00274 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *, int (*)(type*, unsigned char**), unsigned char **, int *); \
00275 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *, int, type *(*)(), void (*)(type *)) ;
00276
00277 #elif (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
00278 #define IMPL_STACK(type) \
00279 DECLARE_STACK_OF(type) \
00280 STACK_OF(type) *sk_##type##_new (int (*cmp)(const type * const *, const type * const *)) \
00281 { return sk_new ( (int (*)(const char * const *, const char * const *))cmp);} \
00282 STACK_OF(type) *sk_##type##_new_null () { return sk_new_null(); } \
00283 void sk_##type##_free (STACK_OF(type) *st) { sk_free(st); } \
00284 int sk_##type##_num (const STACK_OF(type) *st) { return sk_num(st); } \
00285 type *sk_##type##_value (const STACK_OF(type) *st, int i) { return (type *)sk_value(st, i); } \
00286 type *sk_##type##_set (STACK_OF(type) *st, int i, type *val) { return ((type *)sk_set(st, i, (char *)val)); } \
00287 void sk_##type##_zero (STACK_OF(type) *st) { sk_zero(st);} \
00288 int sk_##type##_push (STACK_OF(type) *st, type *val) { return sk_push(st, (char *)val); } \
00289 int sk_##type##_unshift (STACK_OF(type) *st, type *val) { return sk_unshift(st, (char *)val); } \
00290 int sk_##type##_find (STACK_OF(type) *st, type *val) { return sk_find(st, (char *)val); } \
00291 type *sk_##type##_delete (STACK_OF(type) *st, int i) { return (type *)sk_delete(st, i); } \
00292 type *sk_##type##_delete_ptr (STACK_OF(type) *st, type *ptr) { return (type *)sk_delete_ptr(st, (char *)ptr); } \
00293 int sk_##type##_insert (STACK_OF(type) *st, type *val, int i) { return sk_insert(st, (char *)val, i); } \
00294 int (*sk_##type##_set_cmp_func (STACK_OF(type) *st, int (*cmp)(const type * const *, const type * const *)))(const type * const *, const type * const *) \
00295 { return (int ((*)(const type * const *, const type * const *)))sk_set_cmp_func (st, (int (*)(const char * const *, const char * const *))cmp); } \
00296 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *st) { return sk_dup(st); } \
00297 void sk_##type##_pop_free (STACK_OF(type) *st, void (*func)(type *)) { sk_pop_free(st, (void (*)(void *))func); } \
00298 type *sk_##type##_shift (STACK_OF(type) *st) { return (type *)sk_shift(st); } \
00299 type *sk_##type##_pop (STACK_OF(type) *st) { return (type *)sk_pop(st); } \
00300 void sk_##type##_sort (STACK_OF(type) *st) { sk_sort(st); } \
00301 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **st, const unsigned char **pp, long length, type *(*d2ifunc)(), void (*freefunc)(type *), int ex_tag, int ex_class) \
00302 { return d2i_ASN1_SET(st, pp, length, (void*(*)(void**, const unsigned char**, long int))d2ifunc, (void (*)(void *))freefunc, ex_tag, ex_class); } \
00303 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *st, unsigned char **pp, int (*i2dfunc)(void*, unsigned char**), int ex_tag, int ex_class, int is_set) \
00304 { return i2d_ASN1_SET(st, pp, i2dfunc, ex_tag, ex_class, is_set); } \
00305 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *st, int (*i2d)(void*, unsigned char**), unsigned char **buf, int *len) { return ASN1_seq_pack(st, i2d, buf, len); } \
00306 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *buf, int len, type *(*d2i)(), void (*freefunc)(type *)) \
00307 { return ASN1_seq_unpack(buf, len, (void*(*)(void**, const unsigned char**, long int))d2i, (void (*)(void *))freefunc); }
00308
00309 #define DECL_STACK(type) \
00310 PREDECLARE_STACK_OF(type) \
00311 STACK_OF(type) *sk_##type##_new (int (*)(const type * const *, const type * const *)); \
00312 STACK_OF(type) *sk_##type##_new_null (); \
00313 void sk_##type##_free (STACK_OF(type) *); \
00314 int sk_##type##_num (const STACK_OF(type) *); \
00315 type *sk_##type##_value (const STACK_OF(type) *, int); \
00316 type *sk_##type##_set (STACK_OF(type) *, int, type *); \
00317 void sk_##type##_zero (STACK_OF(type) *); \
00318 int sk_##type##_push (STACK_OF(type) *, type *); \
00319 int sk_##type##_unshift (STACK_OF(type) *, type *); \
00320 int sk_##type##_find (STACK_OF(type) *, type *); \
00321 type *sk_##type##_delete (STACK_OF(type) *, int); \
00322 type *sk_##type##_delete_ptr (STACK_OF(type) *, type *); \
00323 int sk_##type##_insert (STACK_OF(type) *, type *, int); \
00324 int (*sk_##type##_set_cmp_func (STACK_OF(type) *, int (*)(const type * const *, const type * const *)))(const type * const *, const type * const *); \
00325 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *); \
00326 void sk_##type##_pop_free (STACK_OF(type) *, void (*)(type *)); \
00327 type *sk_##type##_shift (STACK_OF(type) *); \
00328 type *sk_##type##_pop (STACK_OF(type) *); \
00329 void sk_##type##_sort (STACK_OF(type) *); \
00330 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **, const unsigned char **, long, type *(*)(), void (*)(type *), int, int); \
00331 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *, unsigned char **, int (*)(void*, unsigned char**), int, int, int); \
00332 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *, int (*)(void*, unsigned char**), unsigned char **, int *); \
00333 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *, int, type *(*)(), void (*)(type *)) ;
00334
00335 #else
00336 #define IMPL_STACK(type) \
00337 DECLARE_STACK_OF(type) \
00338 STACK_OF(type) *sk_##type##_new (int (*cmp)(const type * const *, const type * const *)) \
00339 { return sk_new ( (int (*)(const char * const *, const char * const *))cmp);} \
00340 STACK_OF(type) *sk_##type##_new_null () { return sk_new_null(); } \
00341 void sk_##type##_free (STACK_OF(type) *st) { sk_free(st); } \
00342 int sk_##type##_num (const STACK_OF(type) *st) { return sk_num(st); } \
00343 type *sk_##type##_value (const STACK_OF(type) *st, int i) { return (type *)sk_value(st, i); } \
00344 type *sk_##type##_set (STACK_OF(type) *st, int i, type *val) { return ((type *)sk_set(st, i, (char *)val)); } \
00345 void sk_##type##_zero (STACK_OF(type) *st) { sk_zero(st);} \
00346 int sk_##type##_push (STACK_OF(type) *st, type *val) { return sk_push(st, (char *)val); } \
00347 int sk_##type##_unshift (STACK_OF(type) *st, type *val) { return sk_unshift(st, (char *)val); } \
00348 int sk_##type##_find (STACK_OF(type) *st, type *val) { return sk_find(st, (char *)val); } \
00349 type *sk_##type##_delete (STACK_OF(type) *st, int i) { return (type *)sk_delete(st, i); } \
00350 type *sk_##type##_delete_ptr (STACK_OF(type) *st, type *ptr) { return (type *)sk_delete_ptr(st, (char *)ptr); } \
00351 int sk_##type##_insert (STACK_OF(type) *st, type *val, int i) { return sk_insert(st, (char *)val, i); } \
00352 int (*sk_##type##_set_cmp_func (STACK_OF(type) *st, int (*cmp)(const type * const *, const type * const *)))(const type * const *, const type * const *) \
00353 { return (int ((*)(const type * const *, const type * const *)))sk_set_cmp_func (st, (int (*)(const char * const *, const char * const *))cmp); } \
00354 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *st) { return sk_dup(st); } \
00355 void sk_##type##_pop_free (STACK_OF(type) *st, void (*func)(type *)) { sk_pop_free(st, (void (*)(void *))func); } \
00356 type *sk_##type##_shift (STACK_OF(type) *st) { return (type *)sk_shift(st); } \
00357 type *sk_##type##_pop (STACK_OF(type) *st) { return (type *)sk_pop(st); } \
00358 void sk_##type##_sort (STACK_OF(type) *st) { sk_sort(st); } \
00359 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **st, unsigned char **pp, long length, type *(*d2ifunc)(), void (*freefunc)(type *), int ex_tag, int ex_class) \
00360 { return d2i_ASN1_SET(st, pp, length, (char *(*)())d2ifunc, (void (*)(void *))freefunc, ex_tag, ex_class); } \
00361 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *st, unsigned char **pp, int (*i2dfunc)(), int ex_tag, int ex_class, int is_set) \
00362 { return i2d_ASN1_SET(st, pp, i2dfunc, ex_tag, ex_class, is_set); } \
00363 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *st, int (*i2d)(), unsigned char **buf, int *len) { return ASN1_seq_pack(st, i2d, buf, len); } \
00364 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *buf, int len, type *(*d2i)(), void (*freefunc)(type *)) \
00365 { return ASN1_seq_unpack(buf, len, (char *(*)())d2i, (void (*)(void *))freefunc); }
00366
00367 #define DECL_STACK(type) \
00368 PREDECLARE_STACK_OF(type) \
00369 STACK_OF(type) *sk_##type##_new (int (*)(const type * const *, const type * const *)); \
00370 STACK_OF(type) *sk_##type##_new_null (); \
00371 void sk_##type##_free (STACK_OF(type) *); \
00372 int sk_##type##_num (const STACK_OF(type) *); \
00373 type *sk_##type##_value (const STACK_OF(type) *, int); \
00374 type *sk_##type##_set (STACK_OF(type) *, int, type *); \
00375 void sk_##type##_zero (STACK_OF(type) *); \
00376 int sk_##type##_push (STACK_OF(type) *, type *); \
00377 int sk_##type##_unshift (STACK_OF(type) *, type *); \
00378 int sk_##type##_find (STACK_OF(type) *, type *); \
00379 type *sk_##type##_delete (STACK_OF(type) *, int); \
00380 type *sk_##type##_delete_ptr (STACK_OF(type) *, type *); \
00381 int sk_##type##_insert (STACK_OF(type) *, type *, int); \
00382 int (*sk_##type##_set_cmp_func (STACK_OF(type) *, int (*)(const type * const *, const type * const *)))(const type * const *, const type * const *); \
00383 STACK_OF(type) *sk_##type##_dup (STACK_OF(type) *); \
00384 void sk_##type##_pop_free (STACK_OF(type) *, void (*)(type *)); \
00385 type *sk_##type##_shift (STACK_OF(type) *); \
00386 type *sk_##type##_pop (STACK_OF(type) *); \
00387 void sk_##type##_sort (STACK_OF(type) *); \
00388 STACK_OF(type) *d2i_ASN1_SET_OF_##type (STACK_OF(type) **, unsigned char **, long, type *(*)(), void (*)(type *), int, int); \
00389 int i2d_ASN1_SET_OF_##type (STACK_OF(type) *, unsigned char **, int (*)(), int, int, int); \
00390 unsigned char *ASN1_seq_pack_##type (STACK_OF(type) *, int (*)(), unsigned char **, int *); \
00391 STACK_OF(type) *ASN1_seq_unpack_##type (unsigned char *, int, type *(*)(), void (*)(type *)) ;
00392 #endif
00393
00394 DECL_STACK(AC_TARGET)
00395 DECL_STACK(AC_TARGETS)
00396 DECL_STACK(AC_IETFATTR)
00397 DECL_STACK(AC_IETFATTRVAL)
00398 DECL_STACK(AC_ATTR)
00399 DECL_STACK(AC)
00400 DECL_STACK(AC_INFO)
00401 DECL_STACK(AC_VAL)
00402 DECL_STACK(AC_HOLDER)
00403 DECL_STACK(AC_ACI)
00404 DECL_STACK(AC_FORM)
00405 DECL_STACK(AC_IS)
00406 DECL_STACK(AC_DIGEST)
00407 DECL_STACK(AC_CERTS)
00408 DECL_STACK(AC_ATTRIBUTE)
00409 DECL_STACK(AC_ATT_HOLDER)
00410 DECL_STACK(AC_FULL_ATTRIBUTES)
00411
00412 #if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
00413 #define SSLCONST const
00414 #else
00415 #define SSLCONST
00416 #endif
00417
00418 int i2d_AC_ATTR(AC_ATTR *a, unsigned char **pp);
00419 AC_ATTR *d2i_AC_ATTR(AC_ATTR **a, SSLCONST unsigned char **p, long length);
00420 AC_ATTR *AC_ATTR_new();
00421 void AC_ATTR_free(AC_ATTR *a);
00422
00423 int i2d_AC_IETFATTR(AC_IETFATTR *a, unsigned char **pp);
00424 AC_IETFATTR *d2i_AC_IETFATTR(AC_IETFATTR **a, SSLCONST unsigned char **p, long length);
00425 AC_IETFATTR *AC_IETFATTR_new();
00426 void AC_IETFATTR_free (AC_IETFATTR *a);
00427
00428 int i2d_AC_IETFATTRVAL(AC_IETFATTRVAL *a, unsigned char **pp);
00429 AC_IETFATTRVAL *d2i_AC_IETFATTRVAL(AC_IETFATTRVAL **a, SSLCONST unsigned char **pp, long length);
00430 AC_IETFATTRVAL *AC_IETFATTRVAL_new();
00431 void AC_IETFATTRVAL_free(AC_IETFATTRVAL *a);
00432
00433 int i2d_AC_DIGEST(AC_DIGEST *a, unsigned char **pp);
00434 AC_DIGEST *d2i_AC_DIGEST(AC_DIGEST **a, SSLCONST unsigned char **pp, long length);
00435 AC_DIGEST *AC_DIGEST_new(void);
00436 void AC_DIGEST_free(AC_DIGEST *a);
00437
00438 int i2d_AC_IS(AC_IS *a, unsigned char **pp);
00439 AC_IS *d2i_AC_IS(AC_IS **a, SSLCONST unsigned char **pp, long length);
00440 AC_IS *AC_IS_new(void);
00441 void AC_IS_free(AC_IS *a);
00442
00443 int i2d_AC_FORM(AC_FORM *a, unsigned char **pp);
00444 AC_FORM *d2i_AC_FORM(AC_FORM **a, SSLCONST unsigned char **pp, long length);
00445 AC_FORM *AC_FORM_new(void);
00446 void AC_FORM_free(AC_FORM *a);
00447
00448 int i2d_AC_ACI(AC_ACI *a, unsigned char **pp);
00449 AC_ACI *d2i_AC_ACI(AC_ACI **a, SSLCONST unsigned char **pp, long length);
00450 AC_ACI *AC_ACI_new(void);
00451 void AC_ACI_free(AC_ACI *a);
00452
00453 int i2d_AC_HOLDER(AC_HOLDER *a, unsigned char **pp);
00454 AC_HOLDER *d2i_AC_HOLDER(AC_HOLDER **a, SSLCONST unsigned char **pp, long length);
00455 AC_HOLDER *AC_HOLDER_new(void);
00456 void AC_HOLDER_free(AC_HOLDER *a);
00457
00458
00459 int i2d_AC_VAL(AC_VAL *a, unsigned char **pp);
00460 AC_VAL *d2i_AC_VAL(AC_VAL **a, SSLCONST unsigned char **pp, long length);
00461 AC_VAL *AC_VAL_new(void);
00462 void AC_VAL_free(AC_VAL *a);
00463
00464
00465 int i2d_AC_INFO(AC_INFO *a, unsigned char **pp);
00466 AC_INFO *d2i_AC_INFO(AC_INFO **a, SSLCONST unsigned char **p, long length);
00467 AC_INFO *AC_INFO_new(void);
00468 void AC_INFO_free(AC_INFO *a);
00469
00470 int i2d_AC(AC *a, unsigned char **pp) ;
00471 AC *d2i_AC(AC **a, SSLCONST unsigned char **pp, long length);
00472 AC *AC_new(void);
00473 void AC_free(AC *a);
00474
00475 int i2d_AC_TARGETS(AC_TARGETS *a, unsigned char **pp) ;
00476 AC_TARGETS *d2i_AC_TARGETS(AC_TARGETS **a, SSLCONST unsigned char **pp, long length);
00477 AC_TARGETS *AC_TARGETS_new(void);
00478 void AC_TARGETS_free(AC_TARGETS *a);
00479
00480 int i2d_AC_TARGET(AC_TARGET *a, unsigned char **pp) ;
00481 AC_TARGET *d2i_AC_TARGET(AC_TARGET **a, SSLCONST unsigned char **pp, long length);
00482 AC_TARGET *AC_TARGET_new(void);
00483 void AC_TARGET_free(AC_TARGET *a);
00484
00485 int i2d_AC_SEQ(AC_SEQ *a, unsigned char **pp) ;
00486 AC_SEQ *d2i_AC_SEQ(AC_SEQ **a, SSLCONST unsigned char **pp, long length);
00487 AC_SEQ *AC_SEQ_new(void);
00488 void AC_SEQ_free(AC_SEQ *a);
00489
00490 int i2d_AC_CERTS(AC_CERTS *a, unsigned char **pp) ;
00491 AC_CERTS *d2i_AC_CERTS(AC_CERTS **a, SSLCONST unsigned char **pp, long length);
00492 AC_CERTS *AC_CERTS_new(void);
00493 void AC_CERTS_free(AC_CERTS *a);
00494
00495 int i2d_AC_ATTRIBUTE(AC_ATTRIBUTE *, unsigned char **);
00496 AC_ATTRIBUTE *d2i_AC_ATTRIBUTE(AC_ATTRIBUTE **, SSLCONST unsigned char **, long);
00497 AC_ATTRIBUTE *AC_ATTRIBUTE_new();
00498 void AC_ATTRIBUTE_free(AC_ATTRIBUTE *);
00499
00500 int i2d_AC_ATT_HOLDER(AC_ATT_HOLDER *, unsigned char **);
00501 AC_ATT_HOLDER *d2i_AC_ATT_HOLDER(AC_ATT_HOLDER **, SSLCONST unsigned char **, long);
00502 AC_ATT_HOLDER *AC_ATT_HOLDER_new();
00503 void AC_ATT_HOLDER_free(AC_ATT_HOLDER *);
00504
00505 int i2d_AC_FULL_ATTRIBUTES(AC_FULL_ATTRIBUTES *, unsigned char **);
00506 AC_FULL_ATTRIBUTES *d2i_AC_FULL_ATTRIBUTES(AC_FULL_ATTRIBUTES **, SSLCONST unsigned char **, long);
00507 AC_FULL_ATTRIBUTES *AC_FULL_ATTRIBUTES_new();
00508 void AC_FULL_ATTRIBUTES_free(AC_FULL_ATTRIBUTES *);
00509
00510 X509V3_EXT_METHOD * VOMSAttribute_auth_x509v3_ext_meth();
00511 X509V3_EXT_METHOD * VOMSAttribute_avail_x509v3_ext_meth();
00512 X509V3_EXT_METHOD * VOMSAttribute_targets_x509v3_ext_meth();
00513 X509V3_EXT_METHOD * VOMSAttribute_acseq_x509v3_ext_meth();
00514 X509V3_EXT_METHOD * VOMSAttribute_certseq_x509v3_ext_meth();
00515 X509V3_EXT_METHOD * VOMSAttribute_attribs_x509v3_ext_meth();
00516
00517 }
00518
00519 #endif