diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 168 |
1 files changed, 68 insertions, 100 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index dfc060f899..ecfd4cf9ed 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -56,6 +56,12 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #ifndef HEADER_X509_H | ||
60 | #include <openssl/x509.h> | ||
61 | /* openssl/x509.h ends up #include-ing this file at about the only | ||
62 | * appropriate moment. */ | ||
63 | #endif | ||
64 | |||
59 | #ifndef HEADER_X509_VFY_H | 65 | #ifndef HEADER_X509_VFY_H |
60 | #define HEADER_X509_VFY_H | 66 | #define HEADER_X509_VFY_H |
61 | 67 | ||
@@ -63,8 +69,8 @@ | |||
63 | extern "C" { | 69 | extern "C" { |
64 | #endif | 70 | #endif |
65 | 71 | ||
66 | #include "bio.h" | 72 | #include <openssl/bio.h> |
67 | #include "crypto.h" | 73 | #include <openssl/crypto.h> |
68 | 74 | ||
69 | /* Outer object */ | 75 | /* Outer object */ |
70 | typedef struct x509_hash_dir_st | 76 | typedef struct x509_hash_dir_st |
@@ -119,21 +125,33 @@ typedef struct x509_object_st | |||
119 | } data; | 125 | } data; |
120 | } X509_OBJECT; | 126 | } X509_OBJECT; |
121 | 127 | ||
128 | typedef struct x509_lookup_st X509_LOOKUP; | ||
129 | |||
130 | DECLARE_STACK_OF(X509_LOOKUP) | ||
131 | |||
122 | /* This is a static that defines the function interface */ | 132 | /* This is a static that defines the function interface */ |
123 | typedef struct x509_lookup_method_st | 133 | typedef struct x509_lookup_method_st |
124 | { | 134 | { |
125 | char *name; | 135 | const char *name; |
126 | int (*new_item)(); | 136 | int (*new_item)(X509_LOOKUP *ctx); |
127 | void (*free)(); | 137 | void (*free)(X509_LOOKUP *ctx); |
128 | int (*init)(/* meth, char ** */); | 138 | int (*init)(X509_LOOKUP *ctx); |
129 | int (*shutdown)( /* meth, char ** */); | 139 | int (*shutdown)(X509_LOOKUP *ctx); |
130 | int (*ctrl)( /* meth, char **, int cmd, char *argp, int argi */); | 140 | int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl, |
131 | int (*get_by_subject)(/* meth, char **, XNAME *, X509 **ret */); | 141 | char **ret); |
132 | int (*get_by_issuer_serial)(); | 142 | int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name, |
133 | int (*get_by_fingerprint)(); | 143 | X509_OBJECT *ret); |
134 | int (*get_by_alias)(); | 144 | int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name, |
145 | ASN1_INTEGER *serial,X509_OBJECT *ret); | ||
146 | int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type, | ||
147 | unsigned char *bytes,int len, | ||
148 | X509_OBJECT *ret); | ||
149 | int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len, | ||
150 | X509_OBJECT *ret); | ||
135 | } X509_LOOKUP_METHOD; | 151 | } X509_LOOKUP_METHOD; |
136 | 152 | ||
153 | typedef struct x509_store_state_st X509_STORE_CTX; | ||
154 | |||
137 | /* This is used to hold everything. It is used for all certificate | 155 | /* This is used to hold everything. It is used for all certificate |
138 | * validation. Once we have a certificate chain, the 'verify' | 156 | * validation. Once we have a certificate chain, the 'verify' |
139 | * function is then called to actually check the cert chain. */ | 157 | * function is then called to actually check the cert chain. */ |
@@ -148,13 +166,13 @@ typedef struct x509_store_st | |||
148 | #endif | 166 | #endif |
149 | 167 | ||
150 | /* These are external lookup methods */ | 168 | /* These are external lookup methods */ |
151 | STACK *get_cert_methods;/* X509_LOOKUP */ | 169 | STACK_OF(X509_LOOKUP) *get_cert_methods; |
152 | int (*verify)(); /* called to verify a certificate */ | 170 | int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ |
153 | int (*verify_cb)(); /* error callback */ | 171 | int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ |
154 | 172 | ||
155 | CRYPTO_EX_DATA ex_data; | 173 | CRYPTO_EX_DATA ex_data; |
156 | int references; | 174 | int references; |
157 | int depth; /* how deep to look */ | 175 | int depth; /* how deep to look (still unused -- X509_STORE_CTX's depth is used) */ |
158 | } X509_STORE; | 176 | } X509_STORE; |
159 | 177 | ||
160 | #define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d)) | 178 | #define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d)) |
@@ -163,7 +181,7 @@ typedef struct x509_store_st | |||
163 | #define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) | 181 | #define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) |
164 | 182 | ||
165 | /* This is the functions plus an instance of the local variables. */ | 183 | /* This is the functions plus an instance of the local variables. */ |
166 | typedef struct x509_lookup_st | 184 | struct x509_lookup_st |
167 | { | 185 | { |
168 | int init; /* have we been started */ | 186 | int init; /* have we been started */ |
169 | int skip; /* don't use us. */ | 187 | int skip; /* don't use us. */ |
@@ -171,25 +189,25 @@ typedef struct x509_lookup_st | |||
171 | char *method_data; /* method data */ | 189 | char *method_data; /* method data */ |
172 | 190 | ||
173 | X509_STORE *store_ctx; /* who owns us */ | 191 | X509_STORE *store_ctx; /* who owns us */ |
174 | } X509_LOOKUP; | 192 | }; |
175 | 193 | ||
176 | /* This is a temporary used when processing cert chains. Since the | 194 | /* This is a temporary used when processing cert chains. Since the |
177 | * gathering of the cert chain can take some time (and have to be | 195 | * gathering of the cert chain can take some time (and have to be |
178 | * 'retried', this needs to be kept and passed around. */ | 196 | * 'retried', this needs to be kept and passed around. */ |
179 | typedef struct x509_store_state_st | 197 | struct x509_store_state_st /* X509_STORE_CTX */ |
180 | { | 198 | { |
181 | X509_STORE *ctx; | 199 | X509_STORE *ctx; |
182 | int current_method; /* used when looking up certs */ | 200 | int current_method; /* used when looking up certs */ |
183 | 201 | ||
184 | /* The following are set by the caller */ | 202 | /* The following are set by the caller */ |
185 | X509 *cert; /* The cert to check */ | 203 | X509 *cert; /* The cert to check */ |
186 | STACK *untrusted; /* chain of X509s - untrusted - passed in */ | 204 | STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ |
187 | 205 | ||
188 | /* The following is built up */ | 206 | /* The following is built up */ |
189 | int depth; /* how far to go looking up certs */ | 207 | int depth; /* how far to go looking up certs */ |
190 | int valid; /* if 0, rebuild chain */ | 208 | int valid; /* if 0, rebuild chain */ |
191 | int last_untrusted; /* index of last untrusted cert */ | 209 | int last_untrusted; /* index of last untrusted cert */ |
192 | STACK *chain; /* chain of X509s - built up and trusted */ | 210 | STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ |
193 | 211 | ||
194 | /* When something goes wrong, this is why */ | 212 | /* When something goes wrong, this is why */ |
195 | int error_depth; | 213 | int error_depth; |
@@ -197,7 +215,9 @@ typedef struct x509_store_state_st | |||
197 | X509 *current_cert; | 215 | X509 *current_cert; |
198 | 216 | ||
199 | CRYPTO_EX_DATA ex_data; | 217 | CRYPTO_EX_DATA ex_data; |
200 | } X509_STORE_CTX; | 218 | }; |
219 | |||
220 | #define X509_STORE_CTX_set_depth(ctx,d) ((ctx)->depth=(d)) | ||
201 | 221 | ||
202 | #define X509_STORE_CTX_set_app_data(ctx,data) \ | 222 | #define X509_STORE_CTX_set_app_data(ctx,data) \ |
203 | X509_STORE_CTX_set_ex_data(ctx,0,data) | 223 | X509_STORE_CTX_set_ex_data(ctx,0,data) |
@@ -207,11 +227,9 @@ typedef struct x509_store_state_st | |||
207 | #define X509_L_FILE_LOAD 1 | 227 | #define X509_L_FILE_LOAD 1 |
208 | #define X509_L_ADD_DIR 2 | 228 | #define X509_L_ADD_DIR 2 |
209 | 229 | ||
210 | X509_LOOKUP_METHOD *X509_LOOKUP_file(); | ||
211 | #define X509_LOOKUP_load_file(x,name,type) \ | 230 | #define X509_LOOKUP_load_file(x,name,type) \ |
212 | X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) | 231 | X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL) |
213 | 232 | ||
214 | X509_LOOKUP_METHOD *X509_LOOKUP_dir(); | ||
215 | #define X509_LOOKUP_add_dir(x,name,type) \ | 233 | #define X509_LOOKUP_add_dir(x,name,type) \ |
216 | X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) | 234 | X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL) |
217 | 235 | ||
@@ -243,9 +261,23 @@ X509_LOOKUP_METHOD *X509_LOOKUP_dir(); | |||
243 | /* The application is not happy */ | 261 | /* The application is not happy */ |
244 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 | 262 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 |
245 | 263 | ||
246 | #ifndef NOPROTO | 264 | /* These functions are being redefined in another directory, |
265 | and clash when the linker is case-insensitive, so let's | ||
266 | hide them a little, by giving them an extra 'o' at the | ||
267 | beginning of the name... */ | ||
268 | #ifdef VMS | ||
269 | #undef X509v3_cleanup_extensions | ||
270 | #define X509v3_cleanup_extensions oX509v3_cleanup_extensions | ||
271 | #undef X509v3_add_extension | ||
272 | #define X509v3_add_extension oX509v3_add_extension | ||
273 | #undef X509v3_add_netscape_extensions | ||
274 | #define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions | ||
275 | #undef X509v3_add_standard_extensions | ||
276 | #define X509v3_add_standard_extensions oX509v3_add_standard_extensions | ||
277 | #endif | ||
278 | |||
247 | #ifdef HEADER_LHASH_H | 279 | #ifdef HEADER_LHASH_H |
248 | X509_OBJECT *X509_OBJECT_retrive_by_subject(LHASH *h,int type,X509_NAME *name); | 280 | X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h,int type,X509_NAME *name); |
249 | #endif | 281 | #endif |
250 | void X509_OBJECT_up_ref_count(X509_OBJECT *a); | 282 | void X509_OBJECT_up_ref_count(X509_OBJECT *a); |
251 | void X509_OBJECT_free_contents(X509_OBJECT *a); | 283 | void X509_OBJECT_free_contents(X509_OBJECT *a); |
@@ -253,7 +285,7 @@ X509_STORE *X509_STORE_new(void ); | |||
253 | void X509_STORE_free(X509_STORE *v); | 285 | void X509_STORE_free(X509_STORE *v); |
254 | 286 | ||
255 | void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, | 287 | void X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, |
256 | X509 *x509, STACK *chain); | 288 | X509 *x509, STACK_OF(X509) *chain); |
257 | void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); | 289 | void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); |
258 | 290 | ||
259 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); | 291 | X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); |
@@ -267,17 +299,14 @@ int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); | |||
267 | int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, | 299 | int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name, |
268 | X509_OBJECT *ret); | 300 | X509_OBJECT *ret); |
269 | 301 | ||
270 | int X509_LOOKUP_ctrl(X509_LOOKUP *ctx,int cmd,char *argc,long argl,char **ret); | 302 | int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, |
303 | long argl, char **ret); | ||
271 | 304 | ||
272 | #ifndef NO_STDIO | 305 | #ifndef NO_STDIO |
273 | int X509_load_cert_file(X509_LOOKUP *ctx, char *file, int type); | 306 | int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type); |
274 | int X509_load_crl_file(X509_LOOKUP *ctx, char *file, int type); | 307 | int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type); |
275 | #endif | 308 | #endif |
276 | 309 | ||
277 | void X509v3_cleanup_extensions(void ); | ||
278 | int X509v3_add_extension(X509_EXTENSION_METHOD *x); | ||
279 | int X509v3_add_netscape_extensions(void ); | ||
280 | int X509v3_add_standard_extensions(void ); | ||
281 | 310 | ||
282 | X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); | 311 | X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); |
283 | void X509_LOOKUP_free(X509_LOOKUP *ctx); | 312 | void X509_LOOKUP_free(X509_LOOKUP *ctx); |
@@ -294,82 +323,21 @@ int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); | |||
294 | 323 | ||
295 | #ifndef NO_STDIO | 324 | #ifndef NO_STDIO |
296 | int X509_STORE_load_locations (X509_STORE *ctx, | 325 | int X509_STORE_load_locations (X509_STORE *ctx, |
297 | char *file, char *dir); | 326 | const char *file, const char *dir); |
298 | int X509_STORE_set_default_paths(X509_STORE *ctx); | 327 | int X509_STORE_set_default_paths(X509_STORE *ctx); |
299 | #endif | 328 | #endif |
300 | 329 | ||
301 | int X509_STORE_CTX_get_ex_new_index(long argl, char *argp, int (*new_func)(), | 330 | int X509_STORE_CTX_get_ex_new_index(long argl, char *argp, int (*new_func)(), |
302 | int (*dup_func)(), void (*free_func)()); | 331 | int (*dup_func)(), void (*free_func)()); |
303 | int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,char *data); | 332 | int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data); |
304 | char * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); | 333 | void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); |
305 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | 334 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); |
306 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | 335 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); |
307 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | 336 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); |
308 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | 337 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); |
309 | STACK * X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); | 338 | STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); |
310 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); | 339 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); |
311 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK /* X509 */ *sk); | 340 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); |
312 | |||
313 | #else | ||
314 | |||
315 | #ifdef HEADER_LHASH_H | ||
316 | X509_OBJECT *X509_OBJECT_retrive_by_subject(); | ||
317 | #endif | ||
318 | void X509_OBJECT_up_ref_count(); | ||
319 | void X509_OBJECT_free_contents(); | ||
320 | X509_STORE *X509_STORE_new(); | ||
321 | void X509_STORE_free(); | ||
322 | |||
323 | void X509_STORE_CTX_init(); | ||
324 | void X509_STORE_CTX_cleanup(); | ||
325 | |||
326 | X509_LOOKUP *X509_STORE_add_lookup(); | ||
327 | |||
328 | X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(); | ||
329 | X509_LOOKUP_METHOD *X509_LOOKUP_file(); | ||
330 | |||
331 | int X509_STORE_add_cert(); | ||
332 | int X509_STORE_add_crl(); | ||
333 | |||
334 | int X509_STORE_get_by_subject(); | ||
335 | |||
336 | int X509_LOOKUP_ctrl(); | ||
337 | |||
338 | #ifndef NO_STDIO | ||
339 | int X509_load_cert_file(); | ||
340 | int X509_load_crl_file(); | ||
341 | #endif | ||
342 | |||
343 | void X509v3_cleanup_extensions(); | ||
344 | int X509v3_add_extension(); | ||
345 | int X509v3_add_netscape_extensions(); | ||
346 | int X509v3_add_standard_extensions(); | ||
347 | |||
348 | X509_LOOKUP *X509_LOOKUP_new(); | ||
349 | void X509_LOOKUP_free(); | ||
350 | int X509_LOOKUP_init(); | ||
351 | int X509_LOOKUP_by_subject(); | ||
352 | int X509_LOOKUP_by_issuer_serial(); | ||
353 | int X509_LOOKUP_by_fingerprint(); | ||
354 | int X509_LOOKUP_by_alias(); | ||
355 | int X509_LOOKUP_shutdown(); | ||
356 | |||
357 | #ifndef NO_STDIO | ||
358 | int X509_STORE_load_locations (); | ||
359 | int X509_STORE_set_default_paths(); | ||
360 | #endif | ||
361 | |||
362 | int X509_STORE_CTX_set_ex_data(); | ||
363 | char * X509_STORE_CTX_get_ex_data(); | ||
364 | int X509_STORE_CTX_get_error(); | ||
365 | void X509_STORE_CTX_set_error(); | ||
366 | int X509_STORE_CTX_get_error_depth(); | ||
367 | X509 * X509_STORE_CTX_get_current_cert(); | ||
368 | STACK * X509_STORE_CTX_get_chain(); | ||
369 | void X509_STORE_CTX_set_cert(); | ||
370 | void X509_STORE_CTX_set_chain(); | ||
371 | |||
372 | #endif | ||
373 | 341 | ||
374 | #ifdef __cplusplus | 342 | #ifdef __cplusplus |
375 | } | 343 | } |