00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 #ifndef HEADER_CRYPTO_H
00121 #define HEADER_CRYPTO_H
00122
00123 #if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
00124 #define SYMBIAN
00125 #endif
00126
00127 #ifdef SYMBIAN
00128 #include <e32def.h>
00129 #endif
00130 #include <stdlib.h>
00131
00132 #include <openssl/e_os2.h>
00133
00134 #ifndef OPENSSL_NO_FP_API
00135 #include <stdio.h>
00136 #endif
00137
00138 #include <openssl/stack.h>
00139 #include <openssl/safestack.h>
00140 #include <openssl/opensslv.h>
00141 #include <openssl/ossl_typ.h>
00142
00143 #ifdef CHARSET_EBCDIC
00144 #include <openssl/ebcdic.h>
00145 #endif
00146
00147
00148
00149 #include <openssl/symhacks.h>
00150
00151 #ifdef __cplusplus
00152 extern "C" {
00153 #endif
00154
00155
00156
00157
00158 #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
00159 #define SSLEAY_VERSION 0
00160
00161 #define SSLEAY_CFLAGS 2
00162 #define SSLEAY_BUILT_ON 3
00163 #define SSLEAY_PLATFORM 4
00164 #define SSLEAY_DIR 5
00165
00166
00167 #if 0
00168 typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
00169
00170 typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
00171 int idx, long argl, void *argp);
00172
00173 typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
00174 int idx, long argl, void *argp);
00175
00176 typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
00177 int idx, long argl, void *argp);
00178 #endif
00179
00180
00181 typedef struct openssl_item_st
00182 {
00183 int code;
00184 void *value;
00185 size_t value_size;
00186 size_t *value_length;
00187 } OPENSSL_ITEM;
00188
00189
00190
00191
00192
00193
00194 #define CRYPTO_LOCK_ERR 1
00195 #define CRYPTO_LOCK_EX_DATA 2
00196 #define CRYPTO_LOCK_X509 3
00197 #define CRYPTO_LOCK_X509_INFO 4
00198 #define CRYPTO_LOCK_X509_PKEY 5
00199 #define CRYPTO_LOCK_X509_CRL 6
00200 #define CRYPTO_LOCK_X509_REQ 7
00201 #define CRYPTO_LOCK_DSA 8
00202 #define CRYPTO_LOCK_RSA 9
00203 #define CRYPTO_LOCK_EVP_PKEY 10
00204 #define CRYPTO_LOCK_X509_STORE 11
00205 #define CRYPTO_LOCK_SSL_CTX 12
00206 #define CRYPTO_LOCK_SSL_CERT 13
00207 #define CRYPTO_LOCK_SSL_SESSION 14
00208 #define CRYPTO_LOCK_SSL_SESS_CERT 15
00209 #define CRYPTO_LOCK_SSL 16
00210 #define CRYPTO_LOCK_SSL_METHOD 17
00211 #define CRYPTO_LOCK_RAND 18
00212 #define CRYPTO_LOCK_RAND2 19
00213 #define CRYPTO_LOCK_MALLOC 20
00214 #define CRYPTO_LOCK_BIO 21
00215 #define CRYPTO_LOCK_GETHOSTBYNAME 22
00216 #define CRYPTO_LOCK_GETSERVBYNAME 23
00217 #define CRYPTO_LOCK_READDIR 24
00218 #define CRYPTO_LOCK_RSA_BLINDING 25
00219 #define CRYPTO_LOCK_DH 26
00220 #define CRYPTO_LOCK_MALLOC2 27
00221 #define CRYPTO_LOCK_DSO 28
00222 #define CRYPTO_LOCK_DYNLOCK 29
00223 #define CRYPTO_LOCK_ENGINE 30
00224 #define CRYPTO_LOCK_UI 31
00225 #define CRYPTO_LOCK_ECDSA 32
00226 #define CRYPTO_LOCK_EC 33
00227 #define CRYPTO_LOCK_ECDH 34
00228 #define CRYPTO_LOCK_BN 35
00229 #define CRYPTO_LOCK_EC_PRE_COMP 36
00230 #define CRYPTO_LOCK_STORE 37
00231 #define CRYPTO_LOCK_COMP 38
00232 #define CRYPTO_NUM_LOCKS 39
00233
00234 #define CRYPTO_LOCK 1
00235 #define CRYPTO_UNLOCK 2
00236 #define CRYPTO_READ 4
00237 #define CRYPTO_WRITE 8
00238
00239 #ifndef OPENSSL_NO_LOCKING
00240 #ifndef CRYPTO_w_lock
00241 #define CRYPTO_w_lock(type) \
00242 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
00243 #define CRYPTO_w_unlock(type) \
00244 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
00245 #define CRYPTO_r_lock(type) \
00246 CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
00247 #define CRYPTO_r_unlock(type) \
00248 CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
00249 #define CRYPTO_add(addr,amount,type) \
00250 CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
00251 #endif
00252 #else
00253 #define CRYPTO_w_lock(a)
00254 #define CRYPTO_w_unlock(a)
00255 #define CRYPTO_r_lock(a)
00256 #define CRYPTO_r_unlock(a)
00257 #define CRYPTO_add(a,b,c) ((*(a))+=(b))
00258 #endif
00259
00260
00261
00262
00263
00264 typedef struct
00265 {
00266 int references;
00267 struct CRYPTO_dynlock_value *data;
00268 } CRYPTO_dynlock;
00269
00270
00271
00272
00273
00274 #define CRYPTO_MEM_CHECK_OFF 0x0
00275 #define CRYPTO_MEM_CHECK_ON 0x1
00276 #define CRYPTO_MEM_CHECK_ENABLE 0x2
00277 #define CRYPTO_MEM_CHECK_DISABLE 0x3
00278
00279
00280
00281
00282
00283 #define V_CRYPTO_MDEBUG_TIME 0x1
00284
00285 #define V_CRYPTO_MDEBUG_THREAD 0x2
00286
00287 #define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
00288
00289
00290
00291 typedef struct bio_st BIO_dummy;
00292
00293 struct crypto_ex_data_st
00294 {
00295 STACK *sk;
00296 int dummy;
00297 };
00298
00299
00300
00301
00302 typedef struct crypto_ex_data_func_st
00303 {
00304 long argl;
00305 void *argp;
00306 CRYPTO_EX_new *new_func;
00307 CRYPTO_EX_free *free_func;
00308 CRYPTO_EX_dup *dup_func;
00309 } CRYPTO_EX_DATA_FUNCS;
00310
00311 DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
00312
00313
00314
00315
00316
00317 #define CRYPTO_EX_INDEX_BIO 0
00318 #define CRYPTO_EX_INDEX_SSL 1
00319 #define CRYPTO_EX_INDEX_SSL_CTX 2
00320 #define CRYPTO_EX_INDEX_SSL_SESSION 3
00321 #define CRYPTO_EX_INDEX_X509_STORE 4
00322 #define CRYPTO_EX_INDEX_X509_STORE_CTX 5
00323 #define CRYPTO_EX_INDEX_RSA 6
00324 #define CRYPTO_EX_INDEX_DSA 7
00325 #define CRYPTO_EX_INDEX_DH 8
00326 #define CRYPTO_EX_INDEX_ENGINE 9
00327 #define CRYPTO_EX_INDEX_X509 10
00328 #define CRYPTO_EX_INDEX_UI 11
00329 #define CRYPTO_EX_INDEX_ECDSA 12
00330 #define CRYPTO_EX_INDEX_ECDH 13
00331 #define CRYPTO_EX_INDEX_COMP 14
00332 #define CRYPTO_EX_INDEX_STORE 15
00333
00334
00335
00336 #define CRYPTO_EX_INDEX_USER 100
00337
00338
00339
00340
00341
00342
00343 #define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\
00344 malloc, realloc, free)
00345
00346 #if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
00347 # ifndef CRYPTO_MDEBUG
00348 # define CRYPTO_MDEBUG
00349 # endif
00350 #endif
00351
00352
00353
00354 #define CRYPTO_malloc_debug_init() do {\
00355 CRYPTO_set_mem_debug_functions(\
00356 CRYPTO_dbg_malloc,\
00357 CRYPTO_dbg_realloc,\
00358 CRYPTO_dbg_free,\
00359 CRYPTO_dbg_set_options,\
00360 CRYPTO_dbg_get_options);\
00361 } while(0)
00362
00363 IMPORT_C int CRYPTO_mem_ctrl(int mode);
00364 IMPORT_C int CRYPTO_is_mem_check_on(void);
00365
00366
00367 #define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
00368 #define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
00369
00370
00371 #define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
00372 #define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
00373 #define is_MemCheck_on() CRYPTO_is_mem_check_on()
00374
00375 #define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
00376 #define OPENSSL_realloc(addr,num) \
00377 CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
00378 #define OPENSSL_realloc_clean(addr,old_num,num) \
00379 CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
00380 #define OPENSSL_remalloc(addr,num) \
00381 CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
00382 #define OPENSSL_freeFunc CRYPTO_free
00383 #define OPENSSL_free(addr) CRYPTO_free(addr)
00384
00385 #define OPENSSL_malloc_locked(num) \
00386 CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
00387 #define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
00388
00389
00390 IMPORT_C const char *SSLeay_version(int type);
00391 IMPORT_C unsigned long SSLeay(void);
00392
00393 IMPORT_C int OPENSSL_issetugid(void);
00394
00395
00396 typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
00397
00398 IMPORT_C const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
00399
00400 IMPORT_C int CRYPTO_set_ex_data_implementation(CRYPTO_EX_DATA_IMPL *i);
00401
00402 IMPORT_C int CRYPTO_ex_data_new_class(void);
00403
00404 IMPORT_C int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
00405 CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
00406 CRYPTO_EX_free *free_func);
00407
00408
00409 IMPORT_C int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
00410 IMPORT_C int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
00411 CRYPTO_EX_DATA *from);
00412 IMPORT_C void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
00413
00414
00415 IMPORT_C int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
00416 IMPORT_C void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
00417
00418
00419 IMPORT_C void CRYPTO_cleanup_all_ex_data(void);
00420
00421 IMPORT_C int CRYPTO_get_new_lockid(char *name);
00422
00423 IMPORT_C int CRYPTO_num_locks(void);
00424 IMPORT_C void CRYPTO_lock(int mode, int type,const char *file,int line);
00425 IMPORT_C void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
00426 const char *file,int line));
00427 IMPORT_C void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
00428 int line);
00429 IMPORT_C void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
00430 const char *file, int line));
00431 IMPORT_C int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
00432 const char *file,int line);
00433 IMPORT_C void CRYPTO_set_id_callback(unsigned long (*func)(void));
00434 IMPORT_C unsigned long (*CRYPTO_get_id_callback(void))(void);
00435 IMPORT_C unsigned long CRYPTO_thread_id(void);
00436 IMPORT_C const char *CRYPTO_get_lock_name(int type);
00437 IMPORT_C int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
00438 int line);
00439
00440 IMPORT_C int CRYPTO_get_new_dynlockid(void);
00441 IMPORT_C void CRYPTO_destroy_dynlockid(int i);
00442 IMPORT_C struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
00443 IMPORT_C void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
00444 IMPORT_C void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
00445 IMPORT_C void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
00446 IMPORT_C struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);
00447 IMPORT_C void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);
00448 IMPORT_C void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);
00449
00450
00451
00452 IMPORT_C int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
00453 IMPORT_C int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
00454 IMPORT_C int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
00455 void *(*r)(void *,size_t,const char *,int),
00456 void (*f)(void *));
00457 IMPORT_C int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
00458 void (*free_func)(void *));
00459 IMPORT_C int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
00460 void (*r)(void *,void *,int,const char *,int,int),
00461 void (*f)(void *,int),
00462 void (*so)(long),
00463 long (*go)(void));
00464 IMPORT_C void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
00465 IMPORT_C void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
00466 IMPORT_C void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
00467 void *(**r)(void *, size_t,const char *,int),
00468 void (**f)(void *));
00469 IMPORT_C void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
00470 void (**f)(void *));
00471 IMPORT_C void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
00472 void (**r)(void *,void *,int,const char *,int,int),
00473 void (**f)(void *,int),
00474 void (**so)(long),
00475 long (**go)(void));
00476
00477 IMPORT_C void *CRYPTO_malloc_locked(int num, const char *file, int line);
00478 IMPORT_C void CRYPTO_free_locked(void *);
00479 IMPORT_C void *CRYPTO_malloc(int num, const char *file, int line);
00480 IMPORT_C void CRYPTO_free(void *);
00481 IMPORT_C void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
00482 IMPORT_C void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
00483 int line);
00484 IMPORT_C void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
00485
00486 IMPORT_C void OPENSSL_cleanse(void *ptr, size_t len);
00487
00488 IMPORT_C void CRYPTO_set_mem_debug_options(long bits);
00489 long CRYPTO_get_mem_debug_options(void);
00490
00491 #define CRYPTO_push_info(info) \
00492 CRYPTO_push_info_(info, __FILE__, __LINE__);
00493 IMPORT_C int CRYPTO_push_info_(const char *info, const char *file, int line);
00494 IMPORT_C int CRYPTO_pop_info(void);
00495 IMPORT_C int CRYPTO_remove_all_info(void);
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505 IMPORT_C void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
00506 IMPORT_C void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
00507 IMPORT_C void CRYPTO_dbg_free(void *addr,int before_p);
00508
00509
00510
00511
00512
00513
00514
00515
00516 IMPORT_C void CRYPTO_dbg_set_options(long bits);
00517 IMPORT_C long CRYPTO_dbg_get_options(void);
00518
00519
00520 #ifndef OPENSSL_NO_FP_API
00521 IMPORT_C void CRYPTO_mem_leaks_fp(FILE *);
00522 #endif
00523 IMPORT_C void CRYPTO_mem_leaks(struct bio_st *bio);
00524
00525 typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
00526 IMPORT_C void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
00527
00528
00529 IMPORT_C void OpenSSLDie(const char *file,int line,const char *assertion);
00530 #define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
00531
00532 unsigned long *OPENSSL_ia32cap_loc(void);
00533 #define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
00534
00535
00536
00537
00538
00539 IMPORT_C void ERR_load_crypto_strings(void);
00540
00541
00542
00543
00544 #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
00545 #define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103
00546 #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101
00547 #define CRYPTO_F_CRYPTO_SET_EX_DATA 102
00548 #define CRYPTO_F_DEF_ADD_INDEX 104
00549 #define CRYPTO_F_DEF_GET_CLASS 105
00550 #define CRYPTO_F_INT_DUP_EX_DATA 106
00551 #define CRYPTO_F_INT_FREE_EX_DATA 107
00552 #define CRYPTO_F_INT_NEW_EX_DATA 108
00553
00554
00555 #define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
00556
00557 #ifdef __cplusplus
00558 }
00559 #endif
00560 #endif