home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / k95source.tar.gz / k95source.tar / ckosslc.c < prev    next >
C/C++ Source or Header  |  2007-02-27  |  158KB  |  5,112 lines

  1. /*
  2.   C K O S S L C . C --  OpenSSL Interface for Kermit 95
  3.  
  4.   Copyright (C) 2000, 2004 Trustees of Columbia University in the City of New
  5.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  6.   sold for profit as a software product itself, nor may it be included in or
  7.   distributed with commercial products or otherwise distributed by commercial
  8.   concerns to their clients or customers without written permission of the
  9.   Office of Kermit Development and Distribution, Columbia University.  This
  10.   copyright notice must not be removed, altered, or obscured.
  11.  
  12.   Copyright (C) 2006, 2007  Secure Endpoints Inc.
  13.  
  14.   Author:  Jeffrey E Altman (jaltman@secure-endpoints.com)
  15.              Secure Endpoints Inc., New York City
  16. */
  17.  
  18. #define CKOSSLC_C
  19.  
  20. #include "ckcdeb.h"
  21. #define OPENSSL_ENABLE_OLD_DES_SUPPORT
  22. #include "openssl/des.h"
  23. #include "ck_ssl.h"
  24.  
  25. #ifdef NT
  26. #include <windows.h>
  27. #else /* NT */
  28. #define INCL_DOSMODULEMGR
  29. #define INCL_DOSSEMAPHORES
  30. #include <os2.h>
  31. #endif /* NT */
  32. #include <stdarg.h>
  33.  
  34. #ifdef OS2
  35. #ifdef CK_SSL
  36. #ifdef SSLDLL
  37.  
  38. #ifdef NT
  39. HINSTANCE hCRYPTO = NULL;
  40. #else /* NT */
  41. HMODULE hCRYPTO = NULL;
  42. #endif /* NT */
  43.  
  44. int crypto_dll_loaded=0;
  45.  
  46. #ifdef NOT_KERMIT
  47. static int deblog = 0;
  48. #ifdef debug
  49. #undef debug
  50. #endif
  51. #define debug(x,a,b,c)
  52. #ifdef printf
  53. #undef printf
  54. #endif
  55. static unsigned long startflags = 0;
  56. #endif /* NOT_KERMIT */
  57.  
  58.  
  59. void (*p_ERR_print_errors)(BIO *bp)=NULL;
  60. void (*p_ERR_print_errors_fp)(FILE *fp)=NULL;
  61. unsigned long (*p_ERR_get_error)(void)=NULL;
  62. char *(*p_ERR_error_string)(unsigned long e,char *buf);
  63.  
  64. int (*p_BIO_printf)( BIO * bio, const char *, ... )=NULL;
  65. long    (*p_BIO_ctrl)(BIO *bp,int cmd,long larg,char *parg)=NULL;
  66. BIO *   (*p_BIO_new)(BIO_METHOD *type)=NULL;
  67. BIO_METHOD *(*p_BIO_s_file)(void )=NULL;
  68. BIO_METHOD *(*p_BIO_s_mem)(void )=NULL;
  69. BIO_METHOD *(*p_BIO_s_null)(void )=NULL;
  70. int     (*p_BIO_read)(BIO *b, char *data, int len)=NULL;
  71. int     (*p_BIO_write)(BIO *b, const char *data, int len)=NULL;
  72. int     (*p_BIO_free)(BIO *a)=NULL;
  73. int     (*p_BIO_free_all)(BIO *a)=NULL;
  74. BIO *   (*p_BIO_new_file)(char *filename, char *mode)=NULL;
  75. X509_NAME * (*p_X509_get_issuer_name)(X509 *a)=NULL;
  76. char * (*p_X509_verify_cert_error_string)(int)=NULL;
  77. char *      (*p_X509_NAME_oneline)(X509_NAME *a,char *buf,int len)=NULL;
  78. int     (*p_X509_NAME_print_ex)(BIO *out, X509_NAME *nm, int indent, unsigned long flags)=NULL;
  79. int (*p_X509_NAME_get_text_by_NID)(X509_NAME *a,int NID,char *buf,int len)=NULL;
  80. X509_NAME * (*p_X509_get_subject_name)(X509 *a)=NULL;
  81. X509 *      (*p_X509_STORE_CTX_get_current_cert)(X509_STORE_CTX *ctx)=NULL;
  82. int         (*p_X509_STORE_CTX_get_error)(X509_STORE_CTX *ctx)=NULL;
  83. int         (*p_X509_STORE_CTX_get_error_depth)(X509_STORE_CTX *ctx)=NULL;
  84. int         (*p_ASN1_TIME_print)( BIO * bio, ASN1_TIME *a)=NULL;
  85. void        (*p_X509_free)(X509 *a)=NULL;
  86. const char * (*p_X509_get_default_cert_dir)()=NULL;
  87. int         (*p_X509_print_ex)(BIO *bio, X509 *cert, unsigned long, unsigned long)=NULL;
  88.  
  89. void    (*p_RSA_free)(RSA *r)=NULL;
  90. RSA *   (*p_RSA_generate_key)(int bits, unsigned long e,
  91.                                void(*callback)(int,int,char *),
  92.                                char *cb_arg)=NULL;
  93. DH *    (*p_DH_new)(void)=NULL;
  94. void    (*p_DH_free)(DH *r)=NULL;
  95. DH *    (*p_DH_generate_parameters)(int bits, unsigned long e,
  96.                                      void(*callback)(int,int,char *),
  97.                                      char *cb_arg)=NULL;
  98. int     (*p_DH_generate_key)(DH * dh)=NULL;
  99. void    (*p_DSA_free)(DSA *r)=NULL;
  100. DSA *   (*p_DSA_generate_parameters)( int bits,
  101.                                       unsigned char * seed,
  102.                                       int seed_len,
  103.                                       int *counter_ret,
  104.                                       unsigned long *h_ret,
  105.                                       void(*callback)(int,int,char *),
  106.                                       char *cb_arg)=NULL;
  107. int     (*p_DSA_generate_key)(DSA * dh)=NULL;
  108. DH * (*p_d2i_DHparams)(DH **a,unsigned char **pp, long length)=NULL;
  109. DH * (*p_PEM_read_bio_DHparams)(BIO *bp,DH **x,int (*cb)(),void *u)=NULL;
  110. char * (*p_PEM_ASN1_read_bio)(char *(*d2i)(),
  111.                              const char *name,BIO *bp,char **x,
  112.                              pem_password_cb *cb, void *u)=NULL;
  113. BIGNUM * (*p_BN_bin2bn)(const unsigned char *s,int len,BIGNUM *ret)=NULL;
  114. void (*p_sk_GENERAL_NAME_free)(STACK_OF(GENERAL_NAME) * sk)=NULL;
  115. GENERAL_NAME * (*p_sk_GENERAL_NAME_value)(const STACK_OF(GENERAL_NAME) * sk,int n)=NULL;
  116. int (*p_sk_GENERAL_NAME_num)(STACK_OF(GENERAL_NAME) * sk)=NULL;
  117. X509_REVOKED * (*p_sk_X509_REVOKED_value)(STACK_OF(X509_REVOKED) * sk,int n)=NULL;
  118. int (*p_sk_X509_REVOKED_num)(STACK_OF(X509_REVOKED) *sk)=NULL;
  119. long (*p_ASN1_INTEGER_get)(ASN1_INTEGER *a)=NULL;
  120. int (*p_ASN1_STRING_cmp)(ASN1_STRING *a, ASN1_STRING *b)=NULL;
  121. X509 *(*p_PEM_read_X509)(FILE *fp,char **x,int (*cb)(char *,int,int,void *),void *u)=NULL;
  122. X509_EXTENSION * (*p_X509_get_ext)(X509 *x, int loc)=NULL;
  123. int (*p_X509_get_ext_by_NID)(X509 * x, int nid, int lastpos)=NULL;
  124. ASN1_INTEGER * (*p_X509_get_serialNumber)(X509 *x)=NULL;
  125. int (*p_X509_cmp_current_time)(ASN1_UTCTIME *s)=NULL;
  126. EVP_PKEY * (*p_X509_get_pubkey)(X509 *x)=NULL;
  127. int (*p_X509_CRL_verify)(X509_CRL *a, EVP_PKEY *r)=NULL;
  128. int (*p_X509_STORE_get_by_subject)(X509_STORE_CTX *vs,int type,X509_NAME *name,X509_OBJECT *ret)=NULL;
  129. X509_STORE_CTX * (*p_X509_STORE_CTX_new)()=NULL;
  130. void (*p_X509_STORE_CTX_free)(X509_STORE_CTX *ctx)=NULL;
  131. void (*p_X509_STORE_CTX_cleanup)(X509_STORE_CTX *ctx)=NULL;
  132. void (*p_X509_STORE_CTX_set_error)(X509_STORE_CTX *ctx,int s)=NULL;
  133. void (*p_X509_STORE_CTX_init)(X509_STORE_CTX *ctx, X509_STORE *store,X509 *x509, STACK_OF(X509) *chain)=NULL;
  134. void (*p_X509_OBJECT_free_contents)(X509_OBJECT *a)=NULL;
  135. int (*p_X509V3_add_standard_extensions)(void)=NULL;
  136. void (*p_X509V3_EXT_cleanup)(void)=NULL;
  137. void *(*p_X509V3_EXT_d2i)(X509_EXTENSION *ext)=NULL;
  138.  
  139. X509_LOOKUP_METHOD * (*p_X509_LOOKUP_hash_dir)(void)=NULL;
  140. int (*p_X509_LOOKUP_ctrl)(X509_LOOKUP *ctx, int cmd, const char *argc,
  141.                            long argl, char ** ret)=NULL;
  142. X509_LOOKUP_METHOD * (*p_X509_LOOKUP_file)(void)=NULL;
  143. X509_LOOKUP * (*p_X509_STORE_add_lookup)(X509_STORE *v, X509_LOOKUP_METHOD *m)=NULL;
  144. X509_STORE * (*p_X509_STORE_new)(void)=NULL;
  145. void (*p_X509_STORE_free)(X509_STORE *)=NULL;
  146. int  (*p_X509_STORE_load_locations)(X509_STORE *,char *,char *)=NULL;
  147. int  (*p_X509_STORE_set_default_paths)(X509_STORE *)=NULL;
  148. int  (*p_ASN1_INTEGER_cmp)(ASN1_INTEGER * x, ASN1_INTEGER *y)=NULL;
  149. int  (*p_X509_subject_name_hash)(X509 *)=NULL;
  150. int  (*p_X509_issuer_name_hash)(X509 *)=NULL;
  151. void (*p_CRYPTO_set_mem_functions)(void *(*m)(unsigned int),
  152.                                    void *(*r)(void *,unsigned int),
  153.                                    void (*free_func)(void *))=NULL;
  154. void (*p_CRYPTO_set_locking_callback)(void (*func)(int mode,int type,
  155.                                       const char *file,int line))=NULL;
  156. void (*p_CRYPTO_set_dynlock_create_callback)(struct CRYPTO_dynlock_value *(*func)
  157.                          (const char *file, int line))=NULL;
  158. void (*p_CRYPTO_set_dynlock_lock_callback)(void (*func)(int mode,
  159.     struct CRYPTO_dynlock_value *l, const char *file, int line))=NULL;
  160. void (*p_CRYPTO_set_dynlock_destroy_callback)(void (*func)
  161.     (struct CRYPTO_dynlock_value *l, const char *file, int line))=NULL;
  162.  
  163. void (*p_RAND_screen)(void)=NULL;
  164. int  (*p_CRYPTO_num_locks)(void)=NULL;
  165. int  (*p_RAND_status)(void)=NULL;
  166. char * (*p_RAND_file_name)(char *,int)=NULL;
  167. int  (*p_RAND_egd)(char *)=NULL;
  168. int  (*p_RAND_load_file)(char *,int)=NULL;
  169. int  (*p_RAND_write_file)(char *)=NULL;
  170. void (*p_RAND_seed)(const void * buf, int num)=NULL;
  171. void (*p_sk_free)(STACK *)=NULL;
  172. char * (*p_sk_value)(const STACK *, int)=NULL;
  173. int (*p_sk_num)(const STACK *)=NULL;
  174.  
  175. #ifdef ZLIB
  176. COMP_METHOD * (*p_COMP_zlib)(void )=NULL;
  177. #endif /* ZLIB */
  178. COMP_METHOD * (*p_COMP_rle)(void )=NULL;
  179. unsigned long (*p_ERR_peek_error)(void)=NULL;
  180. void (*p_sk_pop_free)(STACK *st, void (*func)(void *))=NULL;
  181. X509 * (*p_PEM_read_bio_X509)(BIO *bp, X509** x509, pem_password_cb *cb, void *u)=NULL;
  182. unsigned long (*p_SSLeay)(void)=NULL;
  183. const char * (*p_SSLeay_version)(int)=NULL;
  184.  
  185. BIGNUM *(*p_BN_new)(void)=NULL;
  186. int     (*p_BN_bn2bin)(const BIGNUM *a, unsigned char *to)=NULL;
  187. int     (*p_BN_num_bits)(const BIGNUM *a)=NULL;
  188. int     (*p_BN_cmp)(const BIGNUM *a, const BIGNUM *b)=NULL;
  189. int     (*p_BN_add_word)(BIGNUM *a, BN_ULONG w)=NULL;
  190. int     (*p_BN_lshift)(BIGNUM *r, const BIGNUM *a, int n)=NULL;
  191. int     (*p_BN_set_word)(BIGNUM *a, BN_ULONG w)=NULL;
  192. int     (*p_BN_dec2bn)(BIGNUM **a, const char *str)=NULL;
  193. char *  (*p_BN_bn2dec)(const BIGNUM *a)=NULL;
  194. BIGNUM *(*p_BN_copy)(BIGNUM *a, const BIGNUM *b)=NULL;
  195. void    (*p_BN_CTX_free)(BN_CTX *c)=NULL;
  196. void    (*p_BN_CTX_start)(BN_CTX *ctx)=NULL;
  197. BIGNUM *(*p_BN_CTX_get)(BN_CTX *ctx)=NULL;
  198. void    (*p_BN_CTX_end)(BN_CTX *ctx)=NULL;
  199. int     (*p_BN_div)(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,BN_CTX *ctx)=NULL;
  200. int     (*p_BN_sub)(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)=NULL;
  201. const BIGNUM *(*p_BN_value_one)(void)=NULL;
  202. BN_CTX *(*p_BN_CTX_new)(void)=NULL;
  203. void    (*p_BN_free)(BIGNUM *a)=NULL;
  204. int     (*p_BN_hex2bn)(BIGNUM **a, const char *str)=NULL;
  205. int     (*p_BN_is_bit_set)(const BIGNUM *a, int n)=NULL;
  206. int     (*p_BN_rand)(BIGNUM *rnd, int bits, int top,int bottom)=NULL;
  207. char *  (*p_BN_bn2hex)(const BIGNUM *a)=NULL;
  208. int     (*p_BN_add)(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)=NULL;
  209. int     (*p_BN_mul)(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)=NULL;
  210. int     (*p_BN_mod)(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)=NULL;
  211. BN_ULONG (*p_BN_mod_word)(const BIGNUM *a, BN_ULONG w)=NULL;
  212. int     (*p_BN_mod_mul)(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)=NULL;
  213. int     (*p_BN_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,const BIGNUM *m,BN_CTX *ctx)=NULL;
  214. int     (*p_BN_is_prime)(const BIGNUM *p,int nchecks,void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg)=NULL;
  215. int     (*p_BN_ucmp)(const BIGNUM *a, const BIGNUM *b)=NULL;
  216. int     (*p_BN_mul_word)(BIGNUM *a, BN_ULONG w)=NULL;
  217. int     (*p_BN_rshift1)(BIGNUM *r, const BIGNUM *a)=NULL;
  218. BIGNUM * (*p_BN_dup)(const BIGNUM *a)=NULL;
  219.  
  220. int (*p_MD5_Init)(MD5_CTX *c)=NULL;
  221. int (*p_MD5_Update)(MD5_CTX *c, const void *data, unsigned long len)=NULL;
  222. int (*p_MD5_Final)(unsigned char *md, MD5_CTX *c)=NULL;
  223. unsigned char *(*p_MD5)(const unsigned char *d, unsigned long n, unsigned char *md)=NULL;
  224.  
  225. int     (*p_EVP_DigestInit)(EVP_MD_CTX *ctx, const EVP_MD *type)=NULL;
  226. int     (*p_EVP_DigestUpdate)(EVP_MD_CTX *ctx,const void *d,
  227.                              unsigned int cnt)=NULL;
  228. int     (*p_EVP_DigestFinal)(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s)=NULL;
  229. const EVP_MD *(*p_EVP_sha1)(void)=NULL;
  230. const EVP_MD *(*p_EVP_md5)(void)=NULL;
  231. const EVP_CIPHER *(*p_EVP_des_ede3_cbc)(void)=NULL;
  232. const EVP_MD *(*p_EVP_ripemd160)(void)=NULL;
  233. const EVP_MD *(*p_EVP_get_digestbyname)(const char *name)=NULL;
  234. RSA *           (*p_EVP_PKEY_get1_RSA)(EVP_PKEY *pkey)=NULL;
  235. DSA *           (*p_EVP_PKEY_get1_DSA)(EVP_PKEY *pkey)=NULL;
  236. void            (*p_EVP_PKEY_free)(EVP_PKEY *pkey)=NULL;
  237.  
  238. RSA *   (*p_RSA_new)(void)=NULL;
  239. int     (*p_RSA_public_encrypt)(int flen, const unsigned char *from,
  240.                                unsigned char *to, RSA *rsa,int padding)=NULL;
  241. int     (*p_RSA_private_encrypt)(int flen, const unsigned char *from,
  242.                                 unsigned char *to, RSA *rsa,int padding)=NULL;
  243. int     (*p_RSA_private_decrypt)(int flen, const unsigned char *from,
  244.                                       unsigned char *to, RSA *rsa,int padding)=NULL;
  245. int     (*p_RSA_public_decrypt)(int flen, const unsigned char *from,
  246.                                unsigned char *to, RSA *rsa,int padding)=NULL;
  247. int     (*p_RSA_size)(const RSA *)=NULL;
  248. int (*p_RSA_sign)(int type, const unsigned char *m, unsigned int m_len,
  249.                  unsigned char *sigret, unsigned int *siglen, RSA *rsa)=NULL;
  250. int (*p_RSA_verify)(int type, const unsigned char *m, unsigned int m_len,
  251.                    unsigned char *sigbuf, unsigned int siglen, RSA *rsa)=NULL;
  252.  
  253. DSA *   (*p_DSA_new)(void)=NULL;
  254. DSA_SIG * (*p_DSA_SIG_new)(void)=NULL;
  255. void    (*p_DSA_SIG_free)(DSA_SIG *a)=NULL;
  256. DSA_SIG * (*p_DSA_do_sign)(const unsigned char *dgst,int dlen,DSA *dsa)=NULL;
  257. int     (*p_DSA_do_verify)(const unsigned char *dgst,int dgst_len,
  258.                           DSA_SIG *sig,DSA *dsa)=NULL;
  259.  
  260. void (*p_HMAC_Init)(HMAC_CTX *ctx, const void *key, int len,
  261.                    const EVP_MD *md)=NULL;
  262. void (*p_HMAC_Update)(HMAC_CTX *ctx, const unsigned char *data, int len)=NULL;
  263. void (*p_HMAC_Final)(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)=NULL;
  264. void (*p_HMAC_cleanup)(HMAC_CTX *ctx)=NULL;
  265. void (*p_HMAC_CTX_cleanup)(HMAC_CTX *ctx)=NULL;
  266. void (*p_RAND_add)(const void *buf,int num,double entropy)=NULL;
  267. int  (*p_RAND_bytes)(unsigned char *buf,int num)=NULL;
  268. int  (*p_des_set_key)(const_des_cblock *k,des_key_schedule s)=NULL;
  269. void (*p_des_ncbc_encrypt)(const unsigned char *input,unsigned char *output,
  270.                       long length,des_key_schedule schedule,des_cblock *ivec,
  271.                       int enc)=NULL;
  272. void (*p_des_ede3_cbc_encrypt)(const unsigned char *input,unsigned char *output,
  273.                           long length,
  274.                           des_key_schedule ks1,des_key_schedule ks2,
  275.                           des_key_schedule ks3,des_cblock *ivec,int enc)=NULL;
  276. void (*p_BF_set_key)(BF_KEY *key, int len, const unsigned char *data)=NULL;
  277. void (*p_BF_cbc_encrypt)(const unsigned char *in, unsigned char *out, long length,
  278.         const BF_KEY *schedule, unsigned char *ivec, int enc)=NULL;
  279. void (*p_RC4_set_key)(RC4_KEY *key, int len, const unsigned char *data)=NULL;
  280. void (*p_RC4)(RC4_KEY *key, unsigned long len, const unsigned char *indata,
  281.                 unsigned char *outdata)=NULL;
  282. void (*p_CAST_set_key)(CAST_KEY *key, int len, const unsigned char *data)=NULL;
  283. void (*p_CAST_cbc_encrypt)(const unsigned char *in, unsigned char *out, long length,
  284.                       CAST_KEY *ks, unsigned char *iv, int enc)=NULL;
  285. int  (*p_DH_compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh)=NULL;
  286. int  (*p_DH_size)(const DH *dh)=NULL;
  287. const char *    (*p_OBJ_nid2sn)(int n)=NULL;
  288. int (*p_OBJ_create)(const char *oid,const char *sn,const char *ln)=NULL;
  289. void (*p_ERR_load_crypto_strings)(void)=NULL;
  290. void    (*p_BN_clear_free)(BIGNUM *a)=NULL;
  291. void    (*p_BN_clear)(BIGNUM *a)=NULL;
  292. void (*p_CRYPTO_free)(void *)=NULL;
  293. int (*p_PEM_write_DSAPrivateKey)(FILE *fp, char *x,
  294.                                 const EVP_CIPHER *enc, unsigned char *kstr, int klen,
  295.                                 pem_password_cb *callback, void *u)=NULL;
  296. int (*p_PEM_write_RSAPrivateKey)(FILE *fp, char *x,
  297.                                 const EVP_CIPHER *enc, unsigned char *kstr, int klen,
  298.                                 pem_password_cb *callback, void *u)=NULL;
  299. int (*p_PEM_write_bio_X509)(BIO *a, X509 *x)=NULL;
  300. EVP_PKEY *(*p_PEM_read_PrivateKey)(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u)=NULL;
  301.  
  302. void (*p_SHA1_Init)(SHA_CTX *c)=NULL;
  303. void (*p_SHA1_Update)(SHA_CTX *c, const void *data, unsigned long len)=NULL;
  304. void (*p_SHA1_Final)(unsigned char *md, SHA_CTX *c)=NULL;
  305.  
  306. int               (*p_RSA_blinding_on)(RSA *rsa, BN_CTX *ctx)=NULL;
  307. const EVP_CIPHER *(*p_EVP_aes_256_cbc)(void)=NULL;
  308. const EVP_CIPHER *(*p_EVP_aes_192_cbc)(void)=NULL;
  309. const EVP_CIPHER *(*p_EVP_aes_128_cbc)(void)=NULL;
  310. const EVP_CIPHER *(*p_EVP_rc4)(void)=NULL;
  311. const EVP_CIPHER *(*p_EVP_cast5_cbc)(void)=NULL; 
  312. const EVP_CIPHER *(*p_EVP_bf_cbc)(void)=NULL;  
  313. const EVP_CIPHER *(*p_EVP_des_cbc)(void)=NULL;    
  314. const EVP_CIPHER *(*p_EVP_enc_null)(void)=NULL;   
  315. int   (*p_EVP_CipherInit)(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
  316.                        const unsigned char *key,const unsigned char *iv,
  317.                        int enc)=NULL;
  318. void (*p_EVP_CIPHER_CTX_init)(EVP_CIPHER_CTX *a)=NULL;
  319. int  (*p_EVP_CIPHER_CTX_cleanup)(EVP_CIPHER_CTX *a)=NULL;
  320. int  (*p_EVP_CIPHER_CTX_set_key_length)(EVP_CIPHER_CTX *x, int keylen)=NULL;
  321. int  (*p_EVP_CIPHER_CTX_key_length)(const EVP_CIPHER_CTX *ctx)=NULL;
  322. int  (*p_EVP_Cipher)(EVP_CIPHER_CTX *c, unsigned char *out, 
  323.             const unsigned char *in, unsigned int inl)=NULL;
  324. int  (*p_EVP_CIPHER_CTX_iv_length)(const EVP_CIPHER_CTX *ctx)=NULL;
  325. void *(*p_EVP_CIPHER_CTX_get_app_data)(const EVP_CIPHER_CTX *ctx)=NULL;
  326. void (*p_EVP_CIPHER_CTX_set_app_data)(EVP_CIPHER_CTX *ctx, void *data)=NULL;
  327.  
  328.  
  329. const char *(*p_X509_get_default_cert_dir_env)(void)=NULL;
  330. const char *(*p_X509_get_default_cert_file_env)(void)=NULL;
  331.  
  332. void (*p_OpenSSL_add_all_ciphers)(void)=NULL;
  333. void (*p_OpenSSL_add_all_digests)(void)=NULL;
  334. void (*p_OPENSSL_add_all_algorithms_noconf)(void)=NULL;
  335. void (*p_OPENSSL_add_all_algorithms_conf)(void)=NULL;
  336. int  (*p_EVP_MD_size)(const EVP_MD *md) = NULL;
  337.  
  338. void
  339. ck_ERR_print_errors(BIO *bp)
  340. {
  341.     if ( p_ERR_print_errors )
  342.         p_ERR_print_errors(bp);
  343. }
  344.  
  345. void
  346. ck_ERR_print_errors_fp(FILE *fp)
  347. {
  348.     if ( p_ERR_print_errors_fp )
  349.         p_ERR_print_errors_fp(fp);
  350. }
  351.  
  352. unsigned long
  353. ck_ERR_get_error(void)
  354. {
  355.     if ( p_ERR_get_error )
  356.         return p_ERR_get_error();
  357.     return 0;
  358. }
  359.  
  360. char *
  361. ck_ERR_error_string(unsigned long e,char *buf)
  362. {
  363.     if ( p_ERR_error_string )
  364.         return p_ERR_error_string(e,buf);
  365.     else
  366.         return "";
  367. }
  368.  
  369. static char bioprtfstr[1024];
  370.  
  371. int
  372. ck_BIO_printf(BIO * bio, const char *format, ...)
  373. {
  374.     int rc=0;
  375.     va_list ap;
  376.     if ( p_BIO_printf && bio != NULL) {
  377.         va_start(ap, format);
  378.         rc = vsprintf( bioprtfstr, format, ap ) ;
  379.         rc = p_BIO_printf(bio,bioprtfstr);
  380.         va_end(ap);
  381.     }
  382.     return (rc);
  383. }
  384.  
  385. long
  386. ck_BIO_ctrl(BIO *bp,int cmd,long larg,char *parg)
  387. {
  388.     if ( p_BIO_ctrl )
  389.         return p_BIO_ctrl(bp,cmd,larg,parg);
  390.     return(0);
  391. }
  392.  
  393. BIO *
  394. ck_BIO_new(BIO_METHOD *type)
  395. {
  396.     if ( p_BIO_new )
  397.         return p_BIO_new(type);
  398.     return NULL;
  399. }
  400.  
  401. BIO_METHOD *
  402. ck_BIO_s_file(void )
  403. {
  404.     if ( p_BIO_s_file )
  405.         return p_BIO_s_file();
  406.     return NULL;
  407. }
  408.  
  409. BIO_METHOD *
  410. ck_BIO_s_mem(void )
  411. {
  412.     if ( p_BIO_s_mem )
  413.         return p_BIO_s_mem();
  414.     return NULL;
  415. }
  416.  
  417. BIO_METHOD *
  418. ck_BIO_s_null(void )
  419. {
  420.     if ( p_BIO_s_null )
  421.         return p_BIO_s_null();
  422.     return NULL;
  423. }
  424.  
  425. int
  426. ck_BIO_read(BIO *b, char *data, int len)
  427. {
  428.     if ( p_BIO_read )
  429.         return(p_BIO_read(b,data,len));
  430.     else
  431.         return(-1);
  432. }
  433.  
  434. int
  435. ck_BIO_write(BIO *b, const char *data, int len)
  436. {
  437.     if ( p_BIO_write )
  438.         return(p_BIO_write(b,data,len));
  439.     else
  440.         return(-1);
  441. }
  442.  
  443. int
  444. ck_BIO_free(BIO *a)
  445. {
  446.     if ( p_BIO_free )
  447.         return(p_BIO_free(a));
  448.     else
  449.         return(-1);
  450. }
  451.  
  452. int
  453. ck_BIO_free_all(BIO *a)
  454. {
  455.     if ( p_BIO_free_all )
  456.         return(p_BIO_free_all(a));
  457.     else
  458.         return(-1);
  459. }
  460.  
  461. BIO *
  462. ck_BIO_new_file(char *filename, char *mode)
  463. {
  464.     if ( p_BIO_new_file )
  465.         return(p_BIO_new_file(filename,mode));
  466.     else
  467.         return(NULL);
  468. }
  469.  
  470. X509_NAME *
  471. ck_X509_get_issuer_name(X509 *a)
  472. {
  473.     if ( p_X509_get_issuer_name )
  474.         return p_X509_get_issuer_name(a);
  475.     return NULL;
  476. }
  477.  
  478. int
  479. ck_X509_print_ex(BIO *bio, X509 *cert, unsigned long cert_ext, unsigned long name_ext)
  480. {
  481.     if ( p_X509_print_ex )
  482.         return p_X509_print_ex(bio,cert,cert_ext,name_ext);
  483.     return 0;
  484. }
  485.  
  486. char *
  487. ck_X509_verify_cert_error_string(int error)
  488. {
  489.     if ( p_X509_verify_cert_error_string )
  490.         return p_X509_verify_cert_error_string(error);
  491.     return "<unable to determine error string>";
  492. }
  493.  
  494. char *
  495. ck_X509_NAME_oneline(X509_NAME *a,char *buf,int len)
  496.  
  497. {
  498.     if ( p_X509_NAME_oneline )
  499.         return p_X509_NAME_oneline(a,buf,len);
  500.     return "";
  501. }
  502.  
  503. int     
  504. ck_X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags)
  505. {
  506.     if ( p_X509_NAME_print_ex )
  507.         return p_X509_NAME_print_ex(out, nm, indent, flags);
  508.     return 0;
  509. }
  510.  
  511. int
  512. ck_X509_NAME_get_text_by_NID(X509_NAME *a,int NID,char *buf,int len)
  513.  
  514. {
  515.     if ( p_X509_NAME_get_text_by_NID )
  516.         return p_X509_NAME_get_text_by_NID(a,NID,buf,len);
  517.     return(0);
  518. }
  519.  
  520. X509_NAME *
  521. ck_X509_get_subject_name(X509 *a)
  522. {
  523.     if ( p_X509_get_subject_name )
  524.         return p_X509_get_subject_name(a);
  525.     return NULL;
  526. }
  527.  
  528. X509_STORE_CTX *
  529. ck_X509_STORE_CTX_new()
  530. {
  531.     if ( p_X509_STORE_CTX_new )
  532.         return(p_X509_STORE_CTX_new());
  533.     else
  534.         return((X509_STORE_CTX *)malloc(sizeof(X509_STORE_CTX)));
  535. }
  536.  
  537. void
  538. ck_X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  539. {
  540.     if ( p_X509_STORE_CTX_free )
  541.         p_X509_STORE_CTX_free(ctx);
  542.     else if (ctx)
  543.         free(ctx);
  544. }
  545.  
  546. X509 *
  547. ck_X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx)
  548. {
  549.     if ( p_X509_STORE_CTX_get_current_cert )
  550.         return p_X509_STORE_CTX_get_current_cert(ctx);
  551.     return NULL;
  552. }
  553.  
  554. int
  555. ck_X509_STORE_CTX_get_error(X509_STORE_CTX *ctx)
  556. {
  557.     if ( p_X509_STORE_CTX_get_error )
  558.         return p_X509_STORE_CTX_get_error(ctx);
  559.     return -1;
  560. }
  561.  
  562. int
  563. ck_X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx)
  564. {
  565.     if ( p_X509_STORE_CTX_get_error_depth )
  566.         return p_X509_STORE_CTX_get_error_depth(ctx);
  567.     return -1;
  568. }
  569.  
  570. int
  571. ck_ASN1_TIME_print( BIO * bio, ASN1_TIME *a)
  572. {
  573.     if ( p_ASN1_TIME_print )
  574.         return p_ASN1_TIME_print(bio,a);
  575.     return(-1);
  576. }
  577.  
  578. const char *
  579. ck_X509_get_default_cert_dir()
  580. {
  581.     if ( p_X509_get_default_cert_dir )
  582.         return p_X509_get_default_cert_dir();
  583.     return NULL;
  584. }
  585.  
  586. void
  587. ck_X509_free(X509 *a)
  588. {
  589.     if ( p_X509_free )
  590.         p_X509_free(a);
  591. }
  592.  
  593. void
  594. ck_RSA_free (RSA *r)
  595. {
  596.     if ( p_RSA_free )
  597.         p_RSA_free(r);
  598. }
  599.  
  600. RSA *
  601. ck_RSA_generate_key(int bits, unsigned long e,
  602.                      void(*callback)(int,int,char *),
  603.                      char *cb_arg)
  604. {
  605.     if ( p_RSA_generate_key )
  606.         return p_RSA_generate_key(bits,e,callback,cb_arg);
  607.     return NULL;
  608. }
  609.  
  610. DH *
  611. ck_DH_new(void)
  612. {
  613.     if ( p_DH_new )
  614.         return(p_DH_new());
  615.     else
  616.         return(NULL);
  617. }
  618.  
  619. void
  620. ck_DH_free (DH *r)
  621. {
  622.     if ( p_DH_free )
  623.         p_DH_free(r);
  624. }
  625.  
  626. DH *
  627. ck_DH_generate_parameters(int bits, unsigned long e,
  628.                            void(*callback)(int,int,char *),
  629.                            char *cb_arg)
  630. {
  631.     if ( p_DH_generate_parameters )
  632.         return p_DH_generate_parameters(bits,e,callback,cb_arg);
  633.     return NULL;
  634. }
  635.  
  636. int
  637. ck_DH_generate_key(DH * dh) {
  638.     if ( p_DH_generate_key )
  639.         return p_DH_generate_key(dh);
  640.     else
  641.         return(-1);
  642. }
  643.  
  644. void
  645. ck_DSA_free (DSA *dsa)
  646. {
  647.     if ( p_DSA_free )
  648.         p_DSA_free(dsa);
  649. }
  650.  
  651. DSA *
  652. ck_DSA_generate_parameters( int bits,
  653.                             unsigned char * seed,
  654.                             int seed_len,
  655.                             int *counter_ret,
  656.                             unsigned long *h_ret,
  657.                             void(*callback)(int,int,char *),
  658.                             char *cb_arg)
  659. {
  660.     if ( p_DSA_generate_parameters )
  661.         return p_DSA_generate_parameters(bits,seed,seed_len,
  662.                                           counter_ret, h_ret,
  663.                                           callback,cb_arg);
  664.     return NULL;
  665. }
  666.  
  667. int
  668. ck_DSA_generate_key(DSA * dsa) {
  669.     if ( p_DSA_generate_key )
  670.         return p_DSA_generate_key(dsa);
  671.     else
  672.         return(-1);
  673. }
  674.  
  675. DH *
  676. ck_d2i_DHparams(DH **a,unsigned char **pp, long length)
  677. {
  678.     if ( p_d2i_DHparams )
  679.         return(p_d2i_DHparams(a,pp,length));
  680.     else
  681.         return(NULL);
  682. }
  683.  
  684. char *
  685. ck_PEM_ASN1_read_bio(char *(*d2i)(),
  686.                       const char *name,BIO *bp,char **x,
  687.                       pem_password_cb *cb, void *u)
  688. {
  689.     if ( p_PEM_ASN1_read_bio )
  690.         return(p_PEM_ASN1_read_bio(d2i,name,bp,x,cb,u));
  691.     else
  692.         return(NULL);
  693. }
  694.  
  695. DH *
  696. ck_PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)(char *,int,int,void *),void *u)
  697. {
  698.     return((DH *)ck_PEM_ASN1_read_bio( (char *(*)())ck_d2i_DHparams,
  699.                                     PEM_STRING_DHPARAMS,
  700.                                     bp,(char **)x,cb,u));
  701. }
  702.  
  703. BIGNUM *
  704. ck_BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret)
  705. {
  706.     if ( p_BN_bin2bn )
  707.         return(p_BN_bin2bn(s,len,ret));
  708.     else
  709.         return(NULL);
  710. }
  711.  
  712. void
  713. ck_sk_GENERAL_NAME_free(STACK_OF(GENERAL_NAME) * sk)
  714. {
  715.     if ( p_sk_GENERAL_NAME_free )
  716.         p_sk_GENERAL_NAME_free(sk);
  717. }
  718.  
  719. GENERAL_NAME *
  720. ck_sk_GENERAL_NAME_value(const STACK_OF(GENERAL_NAME) * sk,int n)
  721. {
  722.     if ( p_sk_GENERAL_NAME_value )
  723.         return(p_sk_GENERAL_NAME_value(sk,n));
  724.     else
  725.         return(NULL);
  726. }
  727.  
  728. int
  729. ck_sk_GENERAL_NAME_num(STACK_OF(GENERAL_NAME) * sk)
  730. {
  731.     if ( p_sk_GENERAL_NAME_num )
  732.         return(p_sk_GENERAL_NAME_num(sk));
  733.     else
  734.         return(0);
  735. }
  736.  
  737. X509_REVOKED *
  738. ck_sk_X509_REVOKED_value(STACK_OF(X509_REVOKED) * sk,int n)
  739. {
  740.     if ( p_sk_X509_REVOKED_value )
  741.         return(p_sk_X509_REVOKED_value(sk,n));
  742.     else
  743.         return(NULL);
  744. }
  745.  
  746. int
  747. ck_sk_X509_REVOKED_num(STACK_OF(X509_REVOKED) *sk)
  748. {
  749.     if ( p_sk_X509_REVOKED_num )
  750.         return(p_sk_X509_REVOKED_num(sk));
  751.     else
  752.         return(0);
  753. }
  754.  
  755. long
  756. ck_ASN1_INTEGER_get(ASN1_INTEGER *a)
  757. {
  758.     if ( p_ASN1_INTEGER_get )
  759.         return(p_ASN1_INTEGER_get(a));
  760.     else
  761.         return(0);
  762. }
  763.  
  764. int
  765. ck_ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
  766. {
  767.     if ( p_ASN1_STRING_cmp )
  768.         return(p_ASN1_STRING_cmp(a,b));
  769.     else
  770.         return(-1);
  771. }
  772.  
  773. X509 *
  774. ck_PEM_read_X509(FILE *fp,char **x,int (*cb)(char *,int,int,void *),void *u)
  775. {
  776.     if ( p_PEM_read_X509 )
  777.         return(p_PEM_read_X509(fp,x,cb,u));
  778.     else
  779.         return(NULL);
  780. }
  781.  
  782. X509_EXTENSION *
  783. ck_X509_get_ext(X509 *x, int loc)
  784. {
  785.     if ( p_X509_get_ext )
  786.         return(p_X509_get_ext(x,loc));
  787.     else
  788.         return(NULL);
  789. }
  790.  
  791. int
  792. ck_X509_get_ext_by_NID(X509 * x, int nid, int lastpos)
  793. {
  794.     if ( p_X509_get_ext_by_NID )
  795.         return(p_X509_get_ext_by_NID(x,nid,lastpos));
  796.     else
  797.         return(0);
  798. }
  799.  
  800. ASN1_INTEGER *
  801. ck_X509_get_serialNumber(X509 *x)
  802. {
  803.     if ( p_X509_get_serialNumber )
  804.         return(p_X509_get_serialNumber(x));
  805.     else
  806.         return(NULL);
  807. }
  808.  
  809. int
  810. ck_X509_cmp_current_time(ASN1_UTCTIME *s)
  811. {
  812.     if ( p_X509_cmp_current_time )
  813.         return(p_X509_cmp_current_time(s));
  814.     else
  815.         return(0);
  816. }
  817.  
  818. EVP_PKEY *
  819. ck_X509_get_pubkey(X509 *x)
  820. {
  821.     if ( p_X509_get_pubkey )
  822.         return(p_X509_get_pubkey(x));
  823.     else
  824.         return(NULL);
  825. }
  826.  
  827. int
  828. ck_X509_CRL_verify(X509_CRL *a, EVP_PKEY *r)
  829. {
  830.     if ( p_X509_CRL_verify )
  831.         return(p_X509_CRL_verify(a,r));
  832.     else
  833.         return(0);
  834. }
  835.  
  836. int
  837. ck_X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,X509_OBJECT *ret)
  838. {
  839.     if ( p_X509_STORE_get_by_subject )
  840.         return(p_X509_STORE_get_by_subject(vs,type,name,ret));
  841.     else
  842.         return(0);
  843. }
  844.  
  845. void
  846. ck_X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx)
  847. {
  848.     if ( p_X509_STORE_CTX_cleanup )
  849.         p_X509_STORE_CTX_cleanup(ctx);
  850. }
  851.  
  852. void
  853. ck_X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s)
  854. {
  855.     if ( p_X509_STORE_CTX_set_error )
  856.         p_X509_STORE_CTX_set_error(ctx,s);
  857. }
  858.  
  859. void
  860. ck_X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,X509 *x509, STACK_OF(X509) *chain)
  861. {
  862.     if ( p_X509_STORE_CTX_init )
  863.         p_X509_STORE_CTX_init(ctx,store,x509,chain);
  864. }
  865.  
  866. void
  867. ck_X509_OBJECT_free_contents(X509_OBJECT *a)
  868. {
  869.     if ( p_X509_OBJECT_free_contents )
  870.         p_X509_OBJECT_free_contents(a);
  871. }
  872.  
  873. int
  874. ck_X509V3_add_standard_extensions(void)
  875. {
  876.     if ( p_X509V3_add_standard_extensions )
  877.         return(p_X509V3_add_standard_extensions());
  878.     else
  879.         return(0);
  880. }
  881.  
  882. void
  883. ck_X509V3_EXT_cleanup(void)
  884. {
  885.     if ( p_X509V3_EXT_cleanup )
  886.         p_X509V3_EXT_cleanup();
  887. }
  888.  
  889. void *
  890. ck_X509V3_EXT_d2i(X509_EXTENSION *ext)
  891. {
  892.     if ( p_X509V3_EXT_d2i )
  893.         return(p_X509V3_EXT_d2i(ext));
  894.     else
  895.         return(NULL);
  896. }
  897.  
  898. X509_LOOKUP_METHOD *
  899. ck_X509_LOOKUP_hash_dir(void)
  900. {
  901.     if ( p_X509_LOOKUP_hash_dir )
  902.         return(p_X509_LOOKUP_hash_dir());
  903.     else
  904.         return(NULL);
  905. }
  906.  
  907. int
  908. ck_X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
  909.                     long argl, char ** ret)
  910. {
  911.     if ( p_X509_LOOKUP_ctrl )
  912.         return(p_X509_LOOKUP_ctrl(ctx,cmd,argc,argl,ret));
  913.     else
  914.         return(0);
  915. }
  916.  
  917. X509_LOOKUP_METHOD *
  918. ck_X509_LOOKUP_file(void)
  919. {
  920.     if ( p_X509_LOOKUP_file )
  921.         return(p_X509_LOOKUP_file());
  922.     else
  923.         return(NULL);
  924. }
  925.  
  926. X509_LOOKUP *
  927. ck_X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
  928. {
  929.     if ( p_X509_STORE_add_lookup )
  930.         return(p_X509_STORE_add_lookup(v,m));
  931.     else
  932.         return(NULL);
  933. }
  934.  
  935. X509_STORE *
  936. ck_X509_STORE_new(void)
  937. {
  938.     if ( p_X509_STORE_new )
  939.         return(p_X509_STORE_new());
  940.     else
  941.         return(NULL);
  942. }
  943.  
  944. void
  945. ck_X509_STORE_free(X509_STORE * s)
  946. {
  947.     if ( p_X509_STORE_free )
  948.         p_X509_STORE_free(s);
  949. }
  950.  
  951. int
  952. ck_X509_STORE_load_locations(X509_STORE * s,char * f,char * d)
  953. {
  954.     if ( p_X509_STORE_load_locations )
  955.         return(p_X509_STORE_load_locations(s,f,d));
  956.     else
  957.         return(0);
  958. }
  959.  
  960. int
  961. ck_X509_STORE_set_default_paths(X509_STORE * s)
  962. {
  963.     if ( p_X509_STORE_set_default_paths )
  964.         return(p_X509_STORE_set_default_paths(s));
  965.     else
  966.         return(0);
  967. }
  968.  
  969. int
  970. ck_ASN1_INTEGER_cmp(ASN1_INTEGER * x, ASN1_INTEGER *y)
  971. {
  972.     if ( p_ASN1_INTEGER_cmp )
  973.         return(p_ASN1_INTEGER_cmp(x,y));
  974.     else if ( p_ASN1_STRING_cmp )
  975.         return(p_ASN1_STRING_cmp(x,y));
  976.     else return(-1);
  977. }
  978.  
  979. int
  980. ck_X509_subject_name_hash(X509 * x)
  981. {
  982.     if ( p_X509_subject_name_hash )
  983.         return(p_X509_subject_name_hash(x));
  984.     return(0);
  985. }
  986.  
  987. int
  988. ck_X509_issuer_name_hash(X509 * x)
  989. {
  990.     if ( p_X509_issuer_name_hash )
  991.         return(p_X509_issuer_name_hash(x));
  992.     return(0);
  993. }
  994.  
  995. void
  996. ck_CRYPTO_set_mem_functions(void *(*m)(unsigned int),
  997.                             void *(*r)(void *,unsigned int),
  998.                             void (*free_func)(void *))
  999. {
  1000.     if ( p_CRYPTO_set_mem_functions )
  1001.         p_CRYPTO_set_mem_functions(m,r,free_func);
  1002. }
  1003.  
  1004. void
  1005. ck_RAND_screen(void)
  1006. {
  1007.     if ( p_RAND_screen )
  1008.         p_RAND_screen();
  1009. }
  1010.  
  1011. void
  1012. ck_CRYPTO_set_locking_callback(void (*func)(int mode,int type,
  1013.                                const char *file,int line))
  1014. {
  1015.     if ( p_CRYPTO_set_locking_callback )
  1016.         p_CRYPTO_set_locking_callback(func);
  1017. }
  1018.  
  1019. void 
  1020. ck_CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*func)(const char *file, int line))
  1021. {
  1022.     if ( p_CRYPTO_set_dynlock_create_callback )
  1023.     p_CRYPTO_set_dynlock_create_callback(func);
  1024. }
  1025.  
  1026. void 
  1027. ck_CRYPTO_set_dynlock_lock_callback(void (*func)(int mode,struct CRYPTO_dynlock_value *l, const char *file, int line))
  1028. {
  1029.     if ( p_CRYPTO_set_dynlock_lock_callback )
  1030.     p_CRYPTO_set_dynlock_lock_callback(func);
  1031. }
  1032.  
  1033. void 
  1034. ck_CRYPTO_set_dynlock_destroy_callback(void (*func)(struct CRYPTO_dynlock_value *l, const char *file, int line))
  1035. {
  1036.     if ( p_CRYPTO_set_dynlock_destroy_callback )
  1037.     p_CRYPTO_set_dynlock_destroy_callback(func);
  1038. }
  1039.  
  1040.  
  1041. #ifdef NT
  1042. static HANDLE * lock_cs = 0;
  1043. static void
  1044. win32_locking_callback(int mode, int type, const char *file, int line)
  1045. {
  1046.     if ( type >= CRYPTO_num_locks() )
  1047.         return;
  1048.  
  1049.     if (mode & CRYPTO_LOCK)
  1050.     {
  1051.         WaitForSingleObject(lock_cs[type],INFINITE);
  1052.     }
  1053.     else if (mode & CRYPTO_UNLOCK)
  1054.     {
  1055.         ReleaseMutex(lock_cs[type]);
  1056.     }
  1057. }
  1058.  
  1059. struct CRYPTO_dynlock_value {
  1060.     HANDLE hLock;
  1061. };
  1062.  
  1063. static struct CRYPTO_dynlock_value *
  1064. win32_dynlock_create_callback(const char *file,int line) 
  1065. {
  1066.     struct CRYPTO_dynlock_value * value = malloc(sizeof(struct CRYPTO_dynlock_value));
  1067.     if ( value )
  1068.     value->hLock = CreateMutex(NULL,FALSE,NULL);
  1069.     return value;
  1070. }
  1071.  
  1072. static void 
  1073. win32_dynlock_lock_callback(int mode,struct CRYPTO_dynlock_value *l, const char *file,int line)
  1074. {
  1075.     if (mode & CRYPTO_LOCK)
  1076.     {
  1077.         WaitForSingleObject(l->hLock,INFINITE);
  1078.     }
  1079.     else if (mode & CRYPTO_UNLOCK)
  1080.     {
  1081.         ReleaseMutex(l->hLock);
  1082.     }
  1083. }
  1084.  
  1085. static void 
  1086. win32_dynlock_destroy_callback(struct CRYPTO_dynlock_value *l,const char *file,int line)
  1087. {
  1088.     if ( l ) {
  1089.     CloseHandle(l->hLock);
  1090.     free(l);
  1091.     }
  1092. }
  1093. #else /* NT */
  1094. static HMTX * lock_cs = 0;
  1095. static void
  1096. os2_locking_callback(int mode, int type, const char *file, int line)
  1097. {
  1098.     if ( type >= CRYPTO_num_locks() )
  1099.         return;
  1100.  
  1101.     if (mode & CRYPTO_LOCK)
  1102.     {
  1103.         DosRequestMutexSem(lock_cs[type],SEM_INDEFINITE_WAIT);
  1104.     }
  1105.     else
  1106.     {
  1107.         DosReleaseMutexSem(lock_cs[type]);
  1108.     }
  1109. }
  1110.  
  1111. struct CRYPTO_dynlock_value {
  1112.     HMTX hLock;
  1113. };
  1114.  
  1115. static struct CRYPTO_dynlock_value *
  1116. os2_dynlock_create_callback(const char *file,int line) 
  1117. {
  1118.     struct CRYPTO_dynlock_value * value = malloc(sizeof(struct CRYPTO_dynlock_value));
  1119.     if ( value )
  1120.     DosCreateMutexSem(NULL, &value->hLock, 0, FALSE);
  1121.     return value;
  1122. }
  1123.  
  1124. static void 
  1125. os2_dynlock_lock_callback(int mode,struct CRYPTO_dynlock_value *l, const char *file,int line)
  1126. {
  1127.     if (mode & CRYPTO_LOCK)
  1128.     {
  1129.         DosRequestMutexSem(l->hLock,SEM_INDEFINITE_WAIT);
  1130.     }
  1131.     else if (mode & CRYPTO_UNLOCK)
  1132.     {
  1133.         DosReleaseMutexSem(l->hLock);
  1134.     }
  1135. }
  1136.  
  1137. static void 
  1138. os2_dynlock_destroy_callback(struct CRYPTO_dynlock_value *l,const char *file,int line)
  1139. {
  1140.     if ( l ) {
  1141.     DosCloseMutexSem(l->hLock);
  1142.     free(l);
  1143.     }
  1144. }
  1145. #endif /* NT */
  1146.  
  1147. int
  1148. ck_CRYPTO_num_locks(void)
  1149. {
  1150.     if ( p_CRYPTO_num_locks )
  1151.         return(p_CRYPTO_num_locks());
  1152.     else
  1153.         return(CRYPTO_NUM_LOCKS);
  1154. }
  1155.  
  1156. int
  1157. ck_RAND_status(void)
  1158. {
  1159.     if ( p_RAND_status )
  1160.         return(p_RAND_status());
  1161.     else
  1162.         return(1);
  1163. }
  1164.  
  1165. char *
  1166. ck_RAND_file_name(char * name, int len)
  1167. {
  1168.     if ( p_RAND_file_name )
  1169.         return(p_RAND_file_name(name, len));
  1170.     else
  1171.         return(NULL);
  1172. }
  1173.  
  1174. int
  1175. ck_RAND_egd(char * name)
  1176. {
  1177.     if ( p_RAND_egd )
  1178.         return(p_RAND_egd(name));
  1179.     else
  1180.         return(0);
  1181. }
  1182.  
  1183. int
  1184. ck_RAND_load_file(char * name, int len)
  1185. {
  1186.     if ( p_RAND_load_file )
  1187.         return(p_RAND_load_file(name,len));
  1188.     else
  1189.         return(0);
  1190. }
  1191.  
  1192. int
  1193. ck_RAND_write_file(char * name)
  1194. {
  1195.     if ( p_RAND_write_file )
  1196.         return(p_RAND_write_file(name));
  1197.     else
  1198.         return(0);
  1199. }
  1200.  
  1201. void
  1202. ck_RAND_seed(const void * buf, int num)
  1203. {
  1204.     if ( p_RAND_seed )
  1205.         p_RAND_seed(buf,num);
  1206. }
  1207.  
  1208. void
  1209. ck_sk_free(STACK * s)
  1210. {
  1211.     if ( p_sk_free )
  1212.         p_sk_free(s);
  1213. }
  1214.  
  1215. char *
  1216. ck_sk_value(const STACK * s, int n)
  1217. {
  1218.     if ( p_sk_value )
  1219.         return(p_sk_value(s,n));
  1220.     else
  1221.         return(NULL);
  1222. }
  1223.  
  1224. int
  1225. ck_sk_num(const STACK * s)
  1226. {
  1227.     if ( p_sk_num )
  1228.         return(p_sk_num(s));
  1229.     else
  1230.         return(-1);
  1231. }
  1232.  
  1233. #ifdef ZLIB
  1234. COMP_METHOD *
  1235. ck_COMP_zlib(void )
  1236. {
  1237.     if ( p_COMP_zlib )
  1238.         return(p_COMP_zlib());
  1239.     else
  1240.         return(0);
  1241. }
  1242. #endif /* ZLIB */
  1243.  
  1244. COMP_METHOD *
  1245. ck_COMP_rle(void )
  1246. {
  1247.     if ( p_COMP_rle )
  1248.         return(p_COMP_rle());
  1249.     else
  1250.         return(0);
  1251. }
  1252.  
  1253. unsigned long
  1254. ck_ERR_peek_error(void)
  1255. {
  1256.     if ( p_ERR_peek_error )
  1257.         return p_ERR_peek_error();
  1258.     return(0);
  1259. }
  1260.  
  1261. void
  1262. ck_sk_pop_free(STACK *st, void (*func)(void *))
  1263. {
  1264.     if ( p_sk_pop_free )
  1265.         p_sk_pop_free(st,func);
  1266. }
  1267.  
  1268. X509 *
  1269. ck_PEM_read_bio_X509(BIO *bp, X509** x509, pem_password_cb *cb, void *u)
  1270. {
  1271.     if ( p_PEM_read_bio_X509 )
  1272.         return p_PEM_read_bio_X509(bp,x509,cb,u);
  1273.     return(NULL);
  1274. }
  1275.  
  1276. unsigned long
  1277. ck_SSLeay(void)
  1278. {
  1279.     if ( p_SSLeay )
  1280.         return(p_SSLeay());
  1281.     return(0);
  1282. }
  1283.  
  1284. const char *
  1285. ck_SSLeay_version(int t)
  1286. {
  1287.     if ( p_SSLeay_version )
  1288.         return p_SSLeay_version(t);
  1289.     return("function not loaded");
  1290. }
  1291.  
  1292. BIGNUM *
  1293. ck_BN_new(void)
  1294. {
  1295.     if ( p_BN_new )
  1296.         return(p_BN_new());
  1297.     else
  1298.         return NULL;
  1299. }
  1300.  
  1301. int
  1302. ck_BN_bn2bin(const BIGNUM *a, unsigned char *to)
  1303. {
  1304.     if ( p_BN_bn2bin )
  1305.         return(p_BN_bn2bin(a,to));
  1306.     else
  1307.         return(0);
  1308. }
  1309.  
  1310. int
  1311. ck_BN_num_bits(const BIGNUM *a)
  1312. {
  1313.     if ( p_BN_num_bits )
  1314.         return p_BN_num_bits(a);
  1315.     else
  1316.         return(0);
  1317. }
  1318.  
  1319. int
  1320. ck_BN_cmp(const BIGNUM *a, const BIGNUM *b)
  1321. {
  1322.     if ( p_BN_cmp )
  1323.         return p_BN_cmp(a,b);
  1324.     else
  1325.         return(0);
  1326. }
  1327.  
  1328. int
  1329. ck_BN_add_word(BIGNUM *a, BN_ULONG w)
  1330. {
  1331.     if ( p_BN_add_word )
  1332.         return p_BN_add_word(a,w);
  1333.     else
  1334.         return(0);
  1335. }
  1336. int
  1337. ck_BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
  1338. {
  1339.     if ( p_BN_lshift )
  1340.         return p_BN_lshift(r,a,n);
  1341.     else
  1342.         return(0);
  1343. }
  1344.  
  1345. int
  1346. ck_BN_set_word(BIGNUM *a, BN_ULONG w)
  1347. {
  1348.     if ( p_BN_set_word )
  1349.         return p_BN_set_word(a,w);
  1350.     else
  1351.         return(0);
  1352. }
  1353.  
  1354. int
  1355. ck_BN_dec2bn(BIGNUM **a, const char *str)
  1356. {
  1357.     if ( p_BN_dec2bn )
  1358.         return p_BN_dec2bn(a,str);
  1359.     else
  1360.         return(0);
  1361. }
  1362.  
  1363. char *
  1364. ck_BN_bn2dec(const BIGNUM *a)
  1365. {
  1366.     if ( p_BN_bn2dec )
  1367.         return p_BN_bn2dec(a);
  1368.     else
  1369.         return NULL;
  1370. }
  1371.  
  1372. BIGNUM *
  1373. ck_BN_copy(BIGNUM *a, const BIGNUM *b)
  1374. {
  1375.     if ( p_BN_copy )
  1376.         return p_BN_copy(a,b);
  1377.     else
  1378.         return NULL;
  1379. }
  1380.  
  1381. void
  1382. ck_BN_CTX_free(BN_CTX *c)
  1383. {
  1384.     if ( p_BN_CTX_free )
  1385.         p_BN_CTX_free(c);
  1386. }
  1387.  
  1388. int
  1389. ck_BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,BN_CTX *ctx)
  1390. {
  1391.     if ( p_BN_div )
  1392.         return p_BN_div(dv,rem,m,d,ctx);
  1393.     else
  1394.         return 0;
  1395. }
  1396.  
  1397. int
  1398. ck_BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  1399. {
  1400.     if ( p_BN_sub )
  1401.         return p_BN_sub(r,a,b);
  1402.     else
  1403.         return 0;
  1404. }
  1405.  
  1406. const BIGNUM *
  1407. ck_BN_value_one(void)
  1408. {
  1409.     if ( p_BN_value_one )
  1410.         return p_BN_value_one();
  1411.     return NULL;
  1412. }
  1413.  
  1414. BN_CTX *
  1415. ck_BN_CTX_new(void)
  1416. {
  1417.     if ( p_BN_CTX_new )
  1418.         return p_BN_CTX_new();
  1419.     else
  1420.         return NULL;
  1421. }
  1422.  
  1423. void
  1424. ck_BN_CTX_start(BN_CTX *ctx)
  1425. {
  1426.     if ( p_BN_CTX_start )
  1427.         p_BN_CTX_start(ctx);
  1428. }
  1429.  
  1430. BIGNUM *
  1431. ck_BN_CTX_get(BN_CTX *ctx)
  1432. {
  1433.     if ( p_BN_CTX_get )
  1434.         return(p_BN_CTX_get(ctx));
  1435.     else
  1436.         return(NULL);
  1437. }
  1438.  
  1439. void
  1440. ck_BN_CTX_end(BN_CTX *ctx)
  1441. {
  1442.     if ( p_BN_CTX_end )
  1443.         p_BN_CTX_end(ctx);
  1444. }
  1445.  
  1446. void
  1447. ck_BN_free(BIGNUM *a)
  1448. {
  1449.     if ( p_BN_free )
  1450.         p_BN_free(a);
  1451. }
  1452.  
  1453. int
  1454. ck_BN_hex2bn(BIGNUM **a, const char *str)
  1455. {
  1456.     if ( p_BN_hex2bn )
  1457.         return p_BN_hex2bn(a,str);
  1458.     else
  1459.         return 0;
  1460. }
  1461.  
  1462. int
  1463. ck_BN_is_bit_set(const BIGNUM *a, int n)
  1464. {
  1465.     if ( p_BN_is_bit_set )
  1466.         return p_BN_is_bit_set(a,n);
  1467.     else
  1468.         return 0;
  1469. }
  1470.  
  1471. int
  1472. ck_BN_rand(BIGNUM *rnd, int bits, int top,int bottom)
  1473. {
  1474.     if ( p_BN_rand )
  1475.         return p_BN_rand(rnd,bits,top,bottom);
  1476.     else
  1477.         return 0;
  1478. }
  1479.  
  1480. char *
  1481. ck_BN_bn2hex(const BIGNUM *a)
  1482. {
  1483.     if ( p_BN_bn2hex )
  1484.         return(p_BN_bn2hex(a));
  1485.     else
  1486.         return NULL;
  1487. }
  1488.  
  1489. int
  1490. ck_BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  1491. {
  1492.     if ( p_BN_add )
  1493.         return(p_BN_add(r,a,b));
  1494.     else
  1495.         return 0;
  1496. }
  1497.  
  1498. int
  1499. ck_BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
  1500. {
  1501.     if ( p_BN_mul )
  1502.         return(p_BN_mul(r,a,b,ctx));
  1503.     else
  1504.         return 0;
  1505. }
  1506.  
  1507. int
  1508. ck_BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
  1509. {
  1510.     if ( p_BN_mod )
  1511.         return(p_BN_mod(rem,m,d,ctx));
  1512.     else if ( p_BN_div )
  1513.         return(p_BN_div(NULL,rem,m,d,ctx));
  1514.     else
  1515.         return 0;
  1516. }
  1517.  
  1518. BN_ULONG
  1519. ck_BN_mod_word(const BIGNUM *a, BN_ULONG w)
  1520. {
  1521.     if ( p_BN_mod_word )
  1522.         return(p_BN_mod_word(a,w));
  1523.     else
  1524.         return 0;
  1525. }
  1526.  
  1527. int
  1528. ck_BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
  1529. {
  1530.     if ( p_BN_mod_mul )
  1531.         return(p_BN_mod_mul(ret,a,b,m,ctx));
  1532.     else
  1533.         return 0;
  1534. }
  1535.  
  1536. int
  1537. ck_BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,const BIGNUM *m,BN_CTX *ctx)
  1538. {
  1539.     if ( p_BN_mod_exp )
  1540.         return(p_BN_mod_exp(r,a,p,m,ctx));
  1541.     else
  1542.         return 0;
  1543. }
  1544.  
  1545. int
  1546. ck_BN_is_prime(const BIGNUM *p,int nchecks,void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg)
  1547. {
  1548.     if ( p_BN_is_prime )
  1549.         return(p_BN_is_prime(p,nchecks,callback,ctx,cb_arg));
  1550.     else
  1551.         return 0;
  1552. }
  1553.  
  1554. int
  1555. ck_BN_ucmp(const BIGNUM *a, const BIGNUM *b)
  1556. {
  1557.     if ( p_BN_ucmp )
  1558.         return(p_BN_ucmp(a,b));
  1559.     else
  1560.         return 0;
  1561. }
  1562.  
  1563. int
  1564. ck_BN_mul_word(BIGNUM *a, BN_ULONG w)
  1565. {
  1566.     if ( p_BN_mul_word )
  1567.         return(p_BN_mul_word(a,w));
  1568.     else
  1569.         return 0;
  1570. }
  1571.  
  1572. int
  1573. ck_BN_rshift1(BIGNUM *r, const BIGNUM *a)
  1574. {
  1575.     if ( p_BN_rshift1 )
  1576.         return(p_BN_rshift1(r,a));
  1577.     else
  1578.         return 0;
  1579. }
  1580.  
  1581. BIGNUM *
  1582. ck_BN_dup(const BIGNUM *a)
  1583. {
  1584.     if ( p_BN_dup )
  1585.         return p_BN_dup(a);
  1586.     else
  1587.         return NULL;
  1588. }
  1589.  
  1590. int
  1591. ck_MD5_Init(MD5_CTX *c)
  1592. {
  1593.     if ( p_MD5_Init )
  1594.         return p_MD5_Init(c);
  1595.     else
  1596.         return 0;
  1597. }
  1598.  
  1599. int
  1600. ck_MD5_Update(MD5_CTX *c, const void *data, unsigned long len)
  1601. {
  1602.     if ( p_MD5_Update )
  1603.         return p_MD5_Update(c,data,len);
  1604.     else
  1605.         return 0;
  1606. }
  1607.  
  1608. int
  1609. ck_MD5_Final(unsigned char *md, MD5_CTX *c)
  1610. {
  1611.     if ( p_MD5_Final )
  1612.         return p_MD5_Final(md,c);
  1613.     else
  1614.         return 0;
  1615. }
  1616.  
  1617. unsigned char *
  1618. ck_MD5(const unsigned char *d, unsigned long n, unsigned char *md)
  1619. {
  1620.     if ( p_MD5 )
  1621.         return p_MD5(d,n,md);
  1622.     else
  1623.         return NULL;
  1624. }
  1625.  
  1626. int
  1627. ck_EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  1628. {
  1629.     if ( p_EVP_DigestInit )
  1630.         return p_EVP_DigestInit(ctx,type);
  1631.     return 0;
  1632. }
  1633.  
  1634. int
  1635. ck_EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
  1636.                     unsigned int cnt)
  1637. {
  1638.     if ( p_EVP_DigestUpdate )
  1639.         return p_EVP_DigestUpdate(ctx,d,cnt);
  1640.     return 0;
  1641. }
  1642. int
  1643. ck_EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s)
  1644. {
  1645.     if ( p_EVP_DigestFinal )
  1646.         return p_EVP_DigestFinal(ctx,md,s);
  1647.     return 0;
  1648. }
  1649.  
  1650. const EVP_MD *
  1651. ck_EVP_sha1(void)
  1652. {
  1653.     if ( p_EVP_sha1 )
  1654.         return p_EVP_sha1();
  1655.     return NULL;
  1656. }
  1657.  
  1658. const EVP_MD *
  1659. ck_EVP_md5(void)
  1660. {
  1661.     if ( p_EVP_md5 )
  1662.         return p_EVP_md5();
  1663.     return NULL;
  1664. }
  1665.  
  1666. const EVP_CIPHER *
  1667. ck_EVP_des_ede3_cbc(void)
  1668. {
  1669.     if ( p_EVP_des_ede3_cbc )
  1670.         return p_EVP_des_ede3_cbc();
  1671.     return NULL;
  1672. }
  1673.  
  1674. const EVP_MD *
  1675. ck_EVP_ripemd160(void)
  1676. {
  1677.     if ( p_EVP_ripemd160 )
  1678.         return p_EVP_ripemd160();
  1679.     return NULL;
  1680. }
  1681.  
  1682. const EVP_MD *
  1683. ck_EVP_get_digestbyname(const char *name)
  1684. {
  1685.     if ( p_EVP_get_digestbyname )
  1686.         return p_EVP_get_digestbyname(name);
  1687.     return NULL;
  1688. }
  1689.  
  1690. RSA *
  1691. ck_EVP_PKEY_get1_RSA(EVP_PKEY *pkey)
  1692. {
  1693.     if ( p_EVP_PKEY_get1_RSA )
  1694.         return p_EVP_PKEY_get1_RSA(pkey);
  1695.     return NULL;
  1696.  
  1697. }
  1698.  
  1699. DSA *
  1700. ck_EVP_PKEY_get1_DSA(EVP_PKEY *pkey)
  1701. {
  1702.     if ( p_EVP_PKEY_get1_DSA )
  1703.         return p_EVP_PKEY_get1_DSA(pkey);
  1704.     return NULL;
  1705. }
  1706.  
  1707. void
  1708. ck_EVP_PKEY_free(EVP_PKEY *pkey)
  1709. {
  1710.     if ( p_EVP_PKEY_free )
  1711.         p_EVP_PKEY_free(pkey);
  1712. }
  1713.  
  1714. RSA *
  1715. ck_RSA_new(void)
  1716. {
  1717.     if ( p_RSA_new )
  1718.         return p_RSA_new();
  1719.     return NULL;
  1720. }
  1721.  
  1722. int
  1723. ck_RSA_public_encrypt(int flen, const unsigned char *from,
  1724.                 unsigned char *to, RSA *rsa,int padding)
  1725. {
  1726.     if ( p_RSA_public_encrypt )
  1727.         return p_RSA_public_encrypt(flen,from,to,rsa,padding);
  1728.     return 0;
  1729. }
  1730.  
  1731. int
  1732. ck_RSA_private_encrypt(int flen, const unsigned char *from,
  1733.                 unsigned char *to, RSA *rsa,int padding)
  1734. {
  1735.     if ( p_RSA_private_encrypt )
  1736.         return p_RSA_private_encrypt(flen,from,to,rsa,padding);
  1737.     return 0;
  1738. }
  1739.  
  1740. int
  1741. ck_RSA_private_decrypt(int flen, const unsigned char *from,
  1742.                 unsigned char *to, RSA *rsa,int padding)
  1743. {
  1744.     if ( p_RSA_private_decrypt )
  1745.         return p_RSA_private_decrypt(flen,from,to,rsa,padding);
  1746.     return 0;
  1747. }
  1748.  
  1749. int     
  1750. ck_RSA_public_decrypt(int flen, const unsigned char *from,
  1751.                 unsigned char *to, RSA *rsa,int padding)
  1752. {
  1753.     if ( p_RSA_public_decrypt )
  1754.         return p_RSA_public_decrypt(flen, from, to, rsa, padding);
  1755.     return 0;
  1756. }
  1757.  
  1758. int
  1759. ck_RSA_size(const RSA * rsa)
  1760. {
  1761.     if ( p_RSA_size )
  1762.         return p_RSA_size(rsa);
  1763.     return 0;
  1764. }
  1765.  
  1766. int
  1767. ck_RSA_sign(int type, const unsigned char *m, unsigned int m_len,
  1768.         unsigned char *sigret, unsigned int *siglen, RSA *rsa)
  1769. {
  1770.     if ( p_RSA_sign )
  1771.         return p_RSA_sign(type,m,m_len,sigret,siglen,rsa);
  1772.     return 0;
  1773. }
  1774.  
  1775. int
  1776. ck_RSA_verify(int type, const unsigned char *m, unsigned int m_len,
  1777.         unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
  1778. {
  1779.     if ( p_RSA_verify )
  1780.         return p_RSA_verify(type,m,m_len,sigbuf,siglen,rsa);
  1781.     return 0;
  1782. }
  1783.  
  1784. DSA *
  1785. ck_DSA_new(void)
  1786. {
  1787.     if ( p_DSA_new )
  1788.         return p_DSA_new();
  1789.     return NULL;
  1790. }
  1791.  
  1792. DSA_SIG *
  1793. ck_DSA_SIG_new(void)
  1794. {
  1795.     if ( p_DSA_new )
  1796.         return p_DSA_SIG_new();
  1797.     return NULL;
  1798. }
  1799.  
  1800. void
  1801. ck_DSA_SIG_free(DSA_SIG *a)
  1802. {
  1803.     if ( p_DSA_SIG_free )
  1804.         p_DSA_SIG_free(a);
  1805. }
  1806.  
  1807. DSA_SIG *
  1808. ck_DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa)
  1809. {
  1810.     if ( p_DSA_do_sign )
  1811.         return p_DSA_do_sign(dgst,dlen,dsa);
  1812.     return NULL;
  1813. }
  1814.  
  1815. int
  1816. ck_DSA_do_verify(const unsigned char *dgst,int dgst_len,
  1817.                   DSA_SIG *sig,DSA *dsa)
  1818. {
  1819.     if ( p_DSA_do_verify )
  1820.         return p_DSA_do_verify(dgst,dgst_len,sig,dsa);
  1821.     return 0;
  1822. }
  1823.  
  1824. void
  1825. ck_HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
  1826.                const EVP_MD *md)
  1827. {
  1828.     if ( p_HMAC_Init )
  1829.         p_HMAC_Init(ctx,key,len,md);
  1830. }
  1831.  
  1832. void
  1833. ck_HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len)
  1834. {
  1835.     if ( p_HMAC_Update )
  1836.         p_HMAC_Update(ctx,data,len);
  1837. }
  1838.  
  1839. void
  1840. ck_HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
  1841. {
  1842.     if ( p_HMAC_Final )
  1843.         p_HMAC_Final(ctx,md,len);
  1844. }
  1845.  
  1846. void
  1847. ck_HMAC_cleanup(HMAC_CTX *ctx)
  1848. {
  1849.     if ( p_HMAC_cleanup )
  1850.         p_HMAC_cleanup(ctx);
  1851. }
  1852.  
  1853. void
  1854. ck_HMAC_CTX_cleanup(HMAC_CTX *ctx)
  1855. {
  1856.     if ( p_HMAC_CTX_cleanup )
  1857.         p_HMAC_CTX_cleanup(ctx);
  1858. }
  1859.  
  1860. void
  1861. ck_RAND_add(const void *buf,int num,double entropy)
  1862. {
  1863.     if ( p_RAND_add )
  1864.         p_RAND_add(buf,num,entropy);
  1865. }
  1866.  
  1867. int
  1868. ck_RAND_bytes(unsigned char *buf,int num)
  1869. {
  1870.     if ( p_RAND_bytes )
  1871.         return p_RAND_bytes(buf,num);
  1872.     return 0;
  1873. }
  1874.  
  1875. int
  1876. ck_des_set_key(const_des_cblock *k,des_key_schedule s)
  1877. {
  1878.     if ( p_des_set_key )
  1879.         return p_des_set_key(k,s);
  1880.     return 0;
  1881. }
  1882.  
  1883. void
  1884. ck_des_ncbc_encrypt(const unsigned char *input,unsigned char *output,
  1885.                      long length,des_key_schedule schedule,des_cblock *ivec,
  1886.                      int enc)
  1887. {
  1888.     if ( p_des_ncbc_encrypt )
  1889.         p_des_ncbc_encrypt(input,output,length,schedule,ivec,enc);
  1890. }
  1891.  
  1892. void
  1893. ck_des_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output,
  1894.                          long length,
  1895.                          des_key_schedule ks1,des_key_schedule ks2,
  1896.                          des_key_schedule ks3,des_cblock *ivec,int enc)
  1897. {
  1898.     if ( p_des_ede3_cbc_encrypt )
  1899.         p_des_ede3_cbc_encrypt(input,output,length,ks1,ks2,ks3,ivec,enc);
  1900. }
  1901.  
  1902. void
  1903. ck_BF_set_key(BF_KEY *key, int len, const unsigned char *data)
  1904. {
  1905.     if ( p_BF_set_key )
  1906.         p_BF_set_key(key,len,data);
  1907. }
  1908.  
  1909. void
  1910. ck_BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
  1911.         const BF_KEY *schedule, unsigned char *ivec, int enc)
  1912. {
  1913.     if ( p_BF_cbc_encrypt )
  1914.         p_BF_cbc_encrypt(in,out,length,schedule,ivec,enc);
  1915. }
  1916.  
  1917. void
  1918. ck_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
  1919. {
  1920.     if ( p_RC4_set_key )
  1921.         p_RC4_set_key(key,len,data);
  1922. }
  1923.  
  1924. void
  1925. ck_RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
  1926.         unsigned char *outdata)
  1927. {
  1928.     if ( p_RC4 )
  1929.         p_RC4(key,len,indata,outdata);
  1930. }
  1931.  
  1932. void
  1933. ck_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data)
  1934. {
  1935.     if ( p_CAST_set_key )
  1936.         p_CAST_set_key(key,len,data);
  1937. }
  1938.  
  1939. void
  1940. ck_CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
  1941.                      CAST_KEY *ks, unsigned char *iv, int enc)
  1942. {
  1943.     if ( p_CAST_cbc_encrypt )
  1944.         p_CAST_cbc_encrypt(in,out,length,ks,iv,enc);
  1945. }
  1946.  
  1947. int
  1948. ck_DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh)
  1949. {
  1950.     if ( p_DH_compute_key )
  1951.         return p_DH_compute_key(key,pub_key,dh);
  1952.     return 0;
  1953. }
  1954.  
  1955. int
  1956. ck_DH_size(const DH *dh)
  1957. {
  1958.     if ( p_DH_size )
  1959.         return p_DH_size(dh);
  1960.     return 0;
  1961. }
  1962.  
  1963. const char *
  1964. ck_OBJ_nid2sn(int n)
  1965. {
  1966.     if ( p_OBJ_nid2sn )
  1967.         return p_OBJ_nid2sn(n);
  1968.     return NULL;
  1969. }
  1970.  
  1971. int
  1972. ck_OBJ_create(const char *oid,const char *sn,const char *ln)
  1973. {
  1974.     if ( p_OBJ_create )
  1975.         return p_OBJ_create(oid,sn,ln);
  1976.     return 0;
  1977. }
  1978.  
  1979. void
  1980. ck_ERR_load_crypto_strings(void)
  1981. {
  1982.     if ( p_ERR_load_crypto_strings )
  1983.         p_ERR_load_crypto_strings();
  1984. }
  1985.  
  1986. void
  1987. ck_BN_clear_free(BIGNUM *a)
  1988. {
  1989.     if ( p_BN_clear_free )
  1990.         p_BN_clear_free(a);
  1991. }
  1992.  
  1993. void
  1994. ck_BN_clear(BIGNUM *a)
  1995. {
  1996.     if ( p_BN_clear )
  1997.         p_BN_clear(a);
  1998. }
  1999.  
  2000. void
  2001. ck_CRYPTO_free(void * p)
  2002. {
  2003.     if ( p_CRYPTO_free )
  2004.         p_CRYPTO_free(p);
  2005. }
  2006.  
  2007. int
  2008. ck_PEM_write_DSAPrivateKey(FILE *fp, char *x,
  2009.              const EVP_CIPHER *enc, unsigned char *kstr, int klen,
  2010.              pem_password_cb *callback, void *u)
  2011. {
  2012.     if ( p_PEM_write_DSAPrivateKey )
  2013.         return p_PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,callback,u);
  2014.     return 0;
  2015. }
  2016.  
  2017. int
  2018. ck_PEM_write_RSAPrivateKey(FILE *fp, char *x,
  2019.              const EVP_CIPHER *enc, unsigned char *kstr, int klen,
  2020.              pem_password_cb *callback, void *u)
  2021. {
  2022.     if ( p_PEM_write_RSAPrivateKey )
  2023.         return p_PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,callback,u);
  2024.     return 0;
  2025. }
  2026.  
  2027. int
  2028. ck_PEM_write_bio_X509(BIO *a, X509 *x)
  2029. {
  2030.     if ( p_PEM_write_bio_X509 )
  2031.         return p_PEM_write_bio_X509(a,x);
  2032.     return 0;
  2033. }
  2034.  
  2035. EVP_PKEY *
  2036. ck_PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x, pem_password_cb *cb, void *u)
  2037. {
  2038.     if ( p_PEM_read_PrivateKey )
  2039.         return p_PEM_read_PrivateKey(fp,x,cb,u);
  2040.     return NULL;
  2041. }
  2042.  
  2043. const char *
  2044. ck_X509_get_default_cert_dir_env(void)
  2045. {
  2046.     if ( p_X509_get_default_cert_dir_env )
  2047.         return(p_X509_get_default_cert_dir_env());
  2048.     return("SSL_CERT_DIR");
  2049. }
  2050.  
  2051. const char *
  2052. ck_X509_get_default_cert_file_env(void)
  2053. {
  2054.     if ( p_X509_get_default_cert_file_env )
  2055.         return(p_X509_get_default_cert_file_env());
  2056.     return("SSL_CERT_FILE");
  2057. }
  2058.  
  2059. void
  2060. ck_SHA1_Init(SHA_CTX *c)
  2061. {
  2062.     if ( p_SHA1_Init )
  2063.         p_SHA1_Init(c);
  2064. }
  2065.  
  2066. void
  2067. ck_SHA1_Update(SHA_CTX *c, const void *data, unsigned long len)
  2068. {
  2069.     if ( p_SHA1_Update )
  2070.         p_SHA1_Update(c,data,len);
  2071. }
  2072.  
  2073. void
  2074. ck_SHA1_Final(unsigned char *md, SHA_CTX *c)
  2075. {
  2076.     if ( p_SHA1_Final )
  2077.         p_SHA1_Final(md,c);
  2078. }
  2079.  
  2080. void 
  2081. ck_OpenSSL_add_all_ciphers(void)
  2082. {
  2083.     if ( p_OpenSSL_add_all_ciphers )
  2084.         p_OpenSSL_add_all_ciphers();
  2085. }
  2086.  
  2087. void 
  2088. ck_OpenSSL_add_all_digests(void)
  2089. {
  2090.     if ( p_OpenSSL_add_all_digests )
  2091.         p_OpenSSL_add_all_digests();
  2092. }
  2093.  
  2094. void 
  2095. ck_OPENSSL_add_all_algorithms_noconf(void)
  2096. {
  2097.     if ( p_OPENSSL_add_all_algorithms_noconf )
  2098.         p_OPENSSL_add_all_algorithms_noconf();
  2099. }
  2100.  
  2101. void 
  2102. ck_OPENSSL_add_all_algorithms_conf(void)
  2103. {
  2104.     if ( p_OPENSSL_add_all_algorithms_conf )
  2105.         p_OPENSSL_add_all_algorithms_conf();
  2106. }
  2107.  
  2108. int 
  2109. ck_RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
  2110. {
  2111.     if ( p_RSA_blinding_on )
  2112.         return p_RSA_blinding_on(rsa,ctx);
  2113.     return -1;
  2114. }
  2115.  
  2116. const EVP_CIPHER *
  2117. ck_EVP_aes_256_cbc(void)
  2118. {
  2119.     if ( p_EVP_aes_256_cbc )
  2120.         return p_EVP_aes_256_cbc();
  2121.     return NULL;
  2122. }
  2123.  
  2124. const EVP_CIPHER *
  2125. ck_EVP_aes_192_cbc(void)
  2126. {
  2127.     if ( p_EVP_aes_192_cbc )
  2128.         return p_EVP_aes_192_cbc();
  2129.     return NULL;
  2130. }
  2131.  
  2132. const EVP_CIPHER *
  2133. ck_EVP_aes_128_cbc(void)
  2134. {
  2135.     if ( p_EVP_aes_128_cbc )
  2136.         return p_EVP_aes_128_cbc();
  2137.     return NULL;
  2138. }
  2139.  
  2140. const EVP_CIPHER *
  2141. ck_EVP_rc4(void)
  2142. {
  2143.     if ( p_EVP_rc4 )
  2144.         return p_EVP_rc4();
  2145.     return NULL;
  2146. }
  2147.  
  2148. const EVP_CIPHER *
  2149. ck_EVP_cast5_cbc(void)
  2150. {
  2151.     if ( p_EVP_cast5_cbc )
  2152.         return p_EVP_cast5_cbc();
  2153.     return NULL;
  2154. }
  2155.  
  2156. const EVP_CIPHER *
  2157. ck_EVP_bf_cbc(void)
  2158. {
  2159.     if ( p_EVP_bf_cbc )
  2160.         return p_EVP_bf_cbc();
  2161.     return NULL;
  2162. }
  2163.  
  2164. const EVP_CIPHER *
  2165. ck_EVP_des_cbc(void)
  2166. {
  2167.     if ( p_EVP_des_cbc )
  2168.         return p_EVP_des_cbc();
  2169.     return NULL;
  2170. }
  2171.  
  2172. const EVP_CIPHER *
  2173. ck_EVP_enc_null(void)
  2174. {
  2175.     if ( p_EVP_enc_null )
  2176.         return p_EVP_enc_null();
  2177.     return NULL;
  2178. }
  2179.  
  2180. int
  2181. ck_EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
  2182.                   const unsigned char *key,const unsigned char *iv,
  2183.                   int enc)
  2184. {
  2185.     if ( p_EVP_CipherInit )
  2186.         return p_EVP_CipherInit(ctx,cipher,key,iv,enc);
  2187.     return -1;
  2188. }
  2189.  
  2190. void 
  2191. ck_EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a)
  2192. {
  2193.     if ( p_EVP_CIPHER_CTX_init )
  2194.         p_EVP_CIPHER_CTX_init(a);
  2195. }       
  2196.  
  2197. int  
  2198. ck_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a)
  2199. {
  2200.     if (p_EVP_CIPHER_CTX_cleanup)
  2201.         return p_EVP_CIPHER_CTX_cleanup(a);
  2202.     return -1;
  2203. }
  2204.  
  2205. int  
  2206. ck_EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen)
  2207. {
  2208.     if (p_EVP_CIPHER_CTX_set_key_length)
  2209.         return p_EVP_CIPHER_CTX_set_key_length(x,keylen);
  2210.     return -1;
  2211. }
  2212.  
  2213. int  
  2214. ck_EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx)
  2215. {
  2216.     if (p_EVP_CIPHER_CTX_key_length)
  2217.         return p_EVP_CIPHER_CTX_key_length(ctx);
  2218.     return -1;
  2219. }    
  2220.  
  2221.  
  2222. int  
  2223. ck_EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out,
  2224.            const unsigned char *in, unsigned int inl)
  2225. {
  2226.     if (p_EVP_Cipher)
  2227.         return p_EVP_Cipher(c, out, in, inl);
  2228.     return -1;
  2229. }
  2230.  
  2231. int  
  2232. ck_EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx)
  2233. {
  2234.     if (p_EVP_CIPHER_CTX_iv_length)
  2235.         return p_EVP_CIPHER_CTX_iv_length(ctx);
  2236.     return -1;
  2237. }
  2238.  
  2239. void *
  2240. ck_EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
  2241. {
  2242.     if (p_EVP_CIPHER_CTX_get_app_data)
  2243.         return p_EVP_CIPHER_CTX_get_app_data(ctx);
  2244.     return NULL;
  2245. }
  2246.  
  2247. void 
  2248. ck_EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data)
  2249. {
  2250.     if (p_EVP_CIPHER_CTX_set_app_data)
  2251.         p_EVP_CIPHER_CTX_set_app_data(ctx, data);
  2252. }
  2253.  
  2254. int  
  2255. ck_EVP_MD_size(const EVP_MD *md)
  2256. {
  2257.     if ( p_EVP_MD_size )
  2258.         return(p_EVP_MD_size(md));
  2259.     else
  2260.         return(-1);
  2261. }
  2262.  
  2263. int
  2264. ck_crypto_loaddll_eh(void)
  2265. {
  2266. #ifdef NT
  2267.     if ( hCRYPTO ) {
  2268.         FreeLibrary(hCRYPTO);
  2269.         hCRYPTO = NULL;
  2270.     }
  2271. #endif  /* NT */
  2272.  
  2273.     p_ERR_print_errors=NULL;
  2274.     p_ERR_print_errors_fp=NULL;
  2275.     p_ERR_get_error=NULL;
  2276.     p_ERR_error_string=NULL;
  2277.  
  2278.     p_BIO_printf=NULL;
  2279.     p_BIO_ctrl=NULL;
  2280.     p_BIO_new=NULL;
  2281.     p_BIO_s_file=NULL;
  2282.     p_BIO_s_mem=NULL;
  2283.     p_BIO_s_null=NULL;
  2284.     p_BIO_read = NULL;
  2285.     p_BIO_write = NULL;
  2286.     p_BIO_free = NULL;
  2287.     p_BIO_free_all = NULL;
  2288.     p_BIO_new_file = NULL;
  2289.  
  2290.     p_X509_get_issuer_name=NULL;
  2291.     p_X509_verify_cert_error_string=NULL;
  2292.     p_X509_NAME_oneline=NULL;
  2293.     p_X509_NAME_print_ex=NULL;
  2294.     p_X509_NAME_get_text_by_NID=NULL;
  2295.     p_X509_get_subject_name=NULL;
  2296.     p_X509_STORE_CTX_get_current_cert=NULL;
  2297.     p_X509_STORE_CTX_get_error=NULL;
  2298.     p_X509_STORE_CTX_get_error_depth=NULL;
  2299.     p_X509_free=NULL;
  2300.     p_X509_get_default_cert_dir=NULL;
  2301.     p_X509_print_ex=NULL;
  2302.  
  2303.     p_RSA_free=NULL;
  2304.     p_RSA_generate_key=NULL;
  2305.     p_DH_free=NULL;
  2306.     p_DH_generate_parameters=NULL;
  2307.     p_DH_generate_key=NULL;
  2308.     p_DH_new=NULL;
  2309.     p_DSA_free=NULL;
  2310.     p_DSA_generate_parameters=NULL;
  2311.     p_DSA_generate_key=NULL;
  2312.  
  2313. #ifdef COMMENT
  2314.  
  2315.     p_PEM_read_bio_DHparams=NULL;
  2316. #endif
  2317.     p_d2i_DHparams=NULL;
  2318.     p_PEM_ASN1_read_bio=NULL;
  2319.     p_BN_bin2bn=NULL;
  2320.  
  2321.     p_ASN1_TIME_print=NULL;
  2322.  
  2323.     p_sk_GENERAL_NAME_free=NULL;
  2324.     p_X509V3_EXT_cleanup=NULL;
  2325.     p_sk_GENERAL_NAME_value=NULL;
  2326.     p_sk_GENERAL_NAME_num=NULL;
  2327.     p_X509V3_EXT_d2i=NULL;
  2328.     p_X509V3_add_standard_extensions=NULL;
  2329.     p_X509_get_ext=NULL;
  2330.     p_X509_get_ext_by_NID=NULL;
  2331.     p_ASN1_INTEGER_get=NULL;
  2332.     p_ASN1_INTEGER_cmp=NULL;
  2333.     p_ASN1_STRING_cmp=NULL;
  2334.     p_X509_get_serialNumber=NULL;
  2335.     p_sk_X509_REVOKED_value=NULL;
  2336.     p_sk_X509_REVOKED_num=NULL;
  2337.     p_X509_cmp_current_time=NULL;
  2338.     p_X509_OBJECT_free_contents=NULL;
  2339.     p_X509_STORE_CTX_set_error=NULL;
  2340.     p_X509_CRL_verify=NULL;
  2341.     p_X509_get_pubkey=NULL;
  2342.     p_X509_STORE_CTX_new=NULL;
  2343.     p_X509_STORE_CTX_free=NULL;
  2344.     p_X509_STORE_CTX_cleanup=NULL;
  2345.     p_X509_STORE_get_by_subject=NULL;
  2346.     p_X509_STORE_CTX_init=NULL;
  2347.     p_PEM_read_X509=NULL;
  2348.     p_X509_LOOKUP_hash_dir=NULL;
  2349.     p_X509_LOOKUP_ctrl=NULL;
  2350.     p_X509_STORE_add_lookup=NULL;
  2351.     p_X509_LOOKUP_file=NULL;
  2352.     p_X509_STORE_new=NULL;
  2353.     p_X509_STORE_free=NULL;
  2354.     p_X509_STORE_load_locations=NULL;
  2355.     p_X509_STORE_set_default_paths=NULL;
  2356.     p_X509_subject_name_hash=NULL;
  2357.     p_X509_issuer_name_hash=NULL;
  2358.     p_CRYPTO_set_mem_functions=NULL;
  2359.     p_CRYPTO_set_locking_callback=NULL;
  2360.     p_CRYPTO_set_dynlock_create_callback=NULL;
  2361.     p_CRYPTO_set_dynlock_lock_callback=NULL;
  2362.     p_CRYPTO_set_dynlock_destroy_callback=NULL;
  2363.     p_RAND_screen=NULL;
  2364.     p_CRYPTO_num_locks=NULL;
  2365.     p_RAND_status=NULL;
  2366.     p_RAND_file_name=NULL;
  2367.     p_RAND_egd=NULL;
  2368.     p_RAND_load_file=NULL;
  2369.     p_RAND_write_file=NULL;
  2370.     p_RAND_seed = NULL;
  2371.  
  2372.     p_sk_num = NULL;
  2373.     p_sk_value = NULL;
  2374.     p_sk_free = NULL;
  2375.  
  2376. #ifdef ZLIB
  2377.     p_COMP_zlib=NULL;
  2378. #endif /* ZLIB */
  2379.     p_COMP_rle=NULL;
  2380.     p_ERR_peek_error=NULL;
  2381.     p_sk_pop_free=NULL;
  2382.     p_PEM_read_bio_X509=NULL;
  2383.     p_SSLeay = NULL;
  2384.     p_SSLeay_version = NULL;
  2385.  
  2386.     p_BN_new                = NULL;
  2387.     p_BN_bn2bin             = NULL;
  2388.     p_BN_num_bits           = NULL;
  2389.     p_BN_cmp                = NULL;
  2390.     p_BN_add_word           = NULL;
  2391.     p_BN_lshift             = NULL;
  2392.     p_BN_set_word           = NULL;
  2393.     p_BN_dec2bn             = NULL;
  2394.     p_BN_bn2dec             = NULL;
  2395.     p_BN_copy               = NULL;
  2396.     p_BN_CTX_free           = NULL;
  2397.     p_BN_div                = NULL;
  2398.     p_BN_sub                = NULL;
  2399.     p_BN_value_one          = NULL;
  2400.     p_BN_CTX_new            = NULL;
  2401.     p_BN_CTX_get            = NULL;
  2402.     p_BN_CTX_start          = NULL;
  2403.     p_BN_CTX_end            = NULL;
  2404.     p_BN_free               = NULL;
  2405.     p_BN_hex2bn             = NULL;
  2406.     p_BN_is_bit_set         = NULL;
  2407.     p_BN_rand               = NULL;
  2408.     p_BN_bn2hex             = NULL;
  2409.     p_BN_add                = NULL;
  2410.     p_BN_mul                = NULL;
  2411.     p_BN_mod                = NULL;
  2412.     p_BN_mod_word           = NULL;
  2413.     p_BN_mod_mul            = NULL;
  2414.     p_BN_mod_exp            = NULL;
  2415.     p_BN_is_prime           = NULL;
  2416.     p_BN_ucmp               = NULL;
  2417.     p_BN_mul_word           = NULL;
  2418.     p_MD5_Final             = NULL;
  2419.     p_MD5_Update            = NULL;
  2420.     p_MD5_Init              = NULL;
  2421.     p_BN_clear_free         = NULL;
  2422.     p_BN_clear              = NULL;
  2423.     p_BN_rshift1            = NULL;
  2424.     p_BN_dup                = NULL;
  2425.  
  2426.     p_EVP_DigestFinal       = NULL;
  2427.     p_EVP_DigestUpdate      = NULL;
  2428.     p_EVP_DigestInit        = NULL;
  2429.     p_EVP_sha1              = NULL;
  2430.     p_EVP_md5               = NULL;
  2431.     p_EVP_des_ede3_cbc      = NULL;
  2432.     p_EVP_PKEY_free         = NULL;
  2433.     p_EVP_PKEY_get1_DSA     = NULL;
  2434.     p_EVP_PKEY_get1_RSA     = NULL;
  2435.     p_EVP_get_digestbyname  = NULL;
  2436.     p_EVP_ripemd160         = NULL;
  2437.     p_RSA_new               = NULL;
  2438.     p_RSA_public_encrypt    = NULL;
  2439.     p_RSA_private_encrypt   = NULL;
  2440.     p_RSA_private_decrypt   = NULL;
  2441.     p_RSA_public_decrypt    = NULL;
  2442.     p_RSA_sign              = NULL;
  2443.     p_RSA_size              = NULL;
  2444.     p_RSA_verify            = NULL;
  2445.     p_DSA_new               = NULL;
  2446.     p_DSA_SIG_free          = NULL;
  2447.     p_DSA_do_sign           = NULL;
  2448.     p_DSA_do_verify         = NULL;
  2449.     p_DSA_SIG_new           = NULL;
  2450.     p_HMAC_cleanup          = NULL;
  2451.     p_HMAC_CTX_cleanup      = NULL;
  2452.     p_HMAC_Final            = NULL;
  2453.     p_HMAC_Update           = NULL;
  2454.     p_HMAC_Init             = NULL;
  2455.     p_RAND_add              = NULL;
  2456.     p_RAND_bytes            = NULL;
  2457.     p_des_set_key           = NULL;
  2458.     p_des_ncbc_encrypt      = NULL;
  2459.     p_des_ede3_cbc_encrypt  = NULL;
  2460.     p_BF_set_key            = NULL;
  2461.     p_BF_cbc_encrypt        = NULL;
  2462.     p_RC4_set_key           = NULL;
  2463.     p_RC4                   = NULL;
  2464.     p_CAST_set_key          = NULL;
  2465.     p_CAST_cbc_encrypt      = NULL;
  2466.     p_OBJ_nid2sn            = NULL;
  2467.     p_OBJ_create            = NULL;
  2468.     p_DH_compute_key        = NULL;
  2469.     p_DH_size               = NULL;
  2470.     p_ERR_load_crypto_strings    = NULL;
  2471.     p_CRYPTO_free = NULL;
  2472.     p_PEM_write_DSAPrivateKey = NULL;
  2473.     p_PEM_write_RSAPrivateKey = NULL;
  2474.     p_PEM_write_bio_X509 = NULL;
  2475.     p_PEM_read_PrivateKey = NULL;
  2476.     p_X509_get_default_cert_dir_env = NULL;
  2477.     p_X509_get_default_cert_file_env = NULL;
  2478.     p_SHA1_Init = NULL;
  2479.     p_SHA1_Update = NULL;
  2480.     p_SHA1_Final = NULL;
  2481.     p_OpenSSL_add_all_ciphers = NULL;
  2482.     p_OpenSSL_add_all_digests = NULL;
  2483.     p_OPENSSL_add_all_algorithms_noconf = NULL;
  2484.     p_OPENSSL_add_all_algorithms_conf = NULL;
  2485.  
  2486.     p_RSA_blinding_on                 = NULL;
  2487.     p_EVP_aes_256_cbc                 = NULL;
  2488.     p_EVP_aes_192_cbc                 = NULL;
  2489.     p_EVP_aes_128_cbc                 = NULL;
  2490.     p_EVP_rc4                         = NULL;
  2491.     p_EVP_cast5_cbc                   = NULL;
  2492.     p_EVP_bf_cbc                      = NULL;
  2493.     p_EVP_des_cbc                     = NULL;
  2494.     p_EVP_enc_null                    = NULL;
  2495.     p_EVP_CipherInit                  = NULL;
  2496.     p_EVP_CIPHER_CTX_set_key_length   = NULL;
  2497.     p_EVP_CIPHER_CTX_init             = NULL;
  2498.     p_EVP_CIPHER_CTX_cleanup          = NULL;
  2499.     p_EVP_CIPHER_CTX_key_length       = NULL;
  2500.     p_EVP_Cipher                      = NULL;
  2501.     p_EVP_CIPHER_CTX_iv_length        = NULL;
  2502.     p_EVP_CIPHER_CTX_get_app_data     = NULL;
  2503.     p_EVP_CIPHER_CTX_set_app_data     = NULL;
  2504.     p_EVP_MD_size = NULL;
  2505.  
  2506.     return(1);
  2507. }
  2508.  
  2509. int
  2510. ck_crypto_loaddll( void )
  2511. {
  2512.     ULONG rc = 0 ;
  2513.     extern unsigned long startflags;
  2514.     int load_error = 0;
  2515. #ifdef OS2ONLY
  2516.     CHAR *exe_path;
  2517.     CHAR path[256];
  2518.     CHAR * dllname = "SSLEAY2";
  2519.     CHAR errbuf[256];
  2520. #endif /* OS2ONLY */
  2521.  
  2522.     if ( crypto_dll_loaded )
  2523.         return(1);
  2524.  
  2525.     if ( startflags & 8 )       /* do not load if we are not supposed to */
  2526.         return(0);
  2527.  
  2528. #ifdef NT
  2529.     hCRYPTO = LoadLibrary("LIBEAY32");
  2530.     if ( !hCRYPTO ) {
  2531.         rc = GetLastError() ;
  2532.         debug(F111, "OpenSSL LoadLibrary failed","LIBEAY32",rc) ;
  2533.         return(0);
  2534.     } else {
  2535.         if (((FARPROC) p_ERR_print_errors =
  2536.               GetProcAddress( hCRYPTO, "ERR_print_errors" )) == NULL )
  2537.         {
  2538.             rc = GetLastError() ;
  2539.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_print_errors",rc);
  2540.             load_error = 1;
  2541.         }
  2542.         if (((FARPROC) p_ERR_print_errors_fp =
  2543.               GetProcAddress( hCRYPTO, "ERR_print_errors_fp" )) == NULL )
  2544.         {
  2545.             rc = GetLastError() ;
  2546.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_print_errors_fp",rc);
  2547.             load_error = 1;
  2548.         }
  2549.         if (((FARPROC) p_ERR_get_error =
  2550.               GetProcAddress( hCRYPTO, "ERR_get_error" )) == NULL )
  2551.         {
  2552.             rc = GetLastError() ;
  2553.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_get_error",rc);
  2554.             load_error = 1;
  2555.         }
  2556.         if (((FARPROC) p_ERR_error_string =
  2557.               GetProcAddress( hCRYPTO, "ERR_error_string" )) == NULL )
  2558.         {
  2559.             rc = GetLastError() ;
  2560.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_error_string",rc);
  2561.             load_error = 1;
  2562.         }
  2563.         if (((FARPROC) p_BIO_printf =
  2564.               GetProcAddress( hCRYPTO, "BIO_printf" )) == NULL )
  2565.         {
  2566.             rc = GetLastError() ;
  2567.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_printf",rc);
  2568.             load_error = 1;
  2569.         }
  2570.         if (((FARPROC) p_BIO_ctrl =
  2571.               GetProcAddress( hCRYPTO, "BIO_ctrl" )) == NULL )
  2572.         {
  2573.             rc = GetLastError() ;
  2574.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_ctrl",rc);
  2575.             load_error = 1;
  2576.         }
  2577.         if (((FARPROC) p_BIO_new =
  2578.               GetProcAddress( hCRYPTO, "BIO_new" )) == NULL )
  2579.         {
  2580.             rc = GetLastError() ;
  2581.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_new",rc);
  2582.             load_error = 1;
  2583.         }
  2584.         if (((FARPROC) p_BIO_s_file =
  2585.               GetProcAddress( hCRYPTO, "BIO_s_file" )) == NULL )
  2586.         {
  2587.             rc = GetLastError() ;
  2588.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_file",rc);
  2589.             load_error = 1;
  2590.         }
  2591.         if (((FARPROC) p_BIO_s_mem =
  2592.               GetProcAddress( hCRYPTO, "BIO_s_mem" )) == NULL )
  2593.         {
  2594.             rc = GetLastError() ;
  2595.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_mem",rc);
  2596.             load_error = 1;
  2597.         }
  2598.         if (((FARPROC) p_BIO_s_null =
  2599.               GetProcAddress( hCRYPTO, "BIO_s_null" )) == NULL )
  2600.         {
  2601.             rc = GetLastError() ;
  2602.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_null",rc);
  2603.             load_error = 1;
  2604.         }
  2605.         if (((FARPROC) p_BIO_read =
  2606.               GetProcAddress( hCRYPTO, "BIO_read" )) == NULL )
  2607.         {
  2608.             rc = GetLastError() ;
  2609.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_read",rc);
  2610.             load_error = 1;
  2611.         }
  2612.         if (((FARPROC) p_BIO_write =
  2613.               GetProcAddress( hCRYPTO, "BIO_write" )) == NULL )
  2614.         {
  2615.             rc = GetLastError() ;
  2616.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_write",rc);
  2617.             load_error = 1;
  2618.         }
  2619.         if (((FARPROC) p_BIO_free =
  2620.               GetProcAddress( hCRYPTO, "BIO_free" )) == NULL )
  2621.         {
  2622.             rc = GetLastError() ;
  2623.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_free",rc);
  2624.             load_error = 1;
  2625.         }
  2626.         if (((FARPROC) p_BIO_free_all =
  2627.               GetProcAddress( hCRYPTO, "BIO_free_all" )) == NULL )
  2628.         {
  2629.             rc = GetLastError() ;
  2630.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_free_all",rc);
  2631.             load_error = 1;
  2632.         }
  2633.         if (((FARPROC) p_BIO_new_file =
  2634.               GetProcAddress( hCRYPTO, "BIO_new_file" )) == NULL )
  2635.         {
  2636.             rc = GetLastError() ;
  2637.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_new_file",rc);
  2638.             load_error = 1;
  2639.         }
  2640.         if (((FARPROC) p_X509_get_issuer_name =
  2641.               GetProcAddress( hCRYPTO, "X509_get_issuer_name" )) == NULL )
  2642.         {
  2643.             rc = GetLastError() ;
  2644.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_issuer_name",rc);
  2645.             load_error = 1;
  2646.         }
  2647.         if (((FARPROC) p_X509_print_ex =
  2648.               GetProcAddress( hCRYPTO, "X509_print_ex" )) == NULL )
  2649.         {
  2650.             rc = GetLastError() ;
  2651.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_print_ex",rc);
  2652.         }
  2653.         if (((FARPROC) p_X509_verify_cert_error_string =
  2654.               GetProcAddress( hCRYPTO, "X509_verify_cert_error_string" )) == NULL )
  2655.         {
  2656.             rc = GetLastError() ;
  2657.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_verify_cert_error_string",rc);
  2658.             load_error = 1;
  2659.         }
  2660.         if (((FARPROC) p_X509_NAME_oneline =
  2661.               GetProcAddress( hCRYPTO, "X509_NAME_oneline" )) == NULL )
  2662.         {
  2663.             rc = GetLastError() ;
  2664.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_oneline",rc);
  2665.             load_error = 1;
  2666.         }
  2667.         if (((FARPROC) p_X509_NAME_print_ex =
  2668.               GetProcAddress( hCRYPTO, "X509_NAME_print_ex" )) == NULL )
  2669.         {
  2670.             rc = GetLastError() ;
  2671.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_print_ex",rc);
  2672.             load_error = 1;
  2673.         }
  2674.         if (((FARPROC) p_X509_NAME_get_text_by_NID =
  2675.               GetProcAddress( hCRYPTO, "X509_NAME_get_text_by_NID" )) == NULL )
  2676.         {
  2677.             rc = GetLastError() ;
  2678.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_get_text_by_NID",rc);
  2679.             load_error = 1;
  2680.         }
  2681.         if (((FARPROC) p_X509_get_subject_name =
  2682.               GetProcAddress( hCRYPTO, "X509_get_subject_name" )) == NULL )
  2683.         {
  2684.             rc = GetLastError() ;
  2685.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_subject_name",rc);
  2686.             load_error = 1;
  2687.         }
  2688.         if (((FARPROC) p_X509_STORE_CTX_new =
  2689.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_new" )) == NULL )
  2690.         {
  2691.             /* New to 0.9.5 */
  2692.             rc = GetLastError() ;
  2693.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2694.                    "X509_STORE_CTX_new",rc);
  2695.         }
  2696.         if (((FARPROC) p_X509_STORE_CTX_free =
  2697.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_free" )) == NULL )
  2698.         {
  2699.             /* New to 0.9.5 */
  2700.             rc = GetLastError() ;
  2701.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2702.                    "X509_STORE_CTX_free",rc);
  2703.         }
  2704.         if (((FARPROC) p_X509_STORE_CTX_get_current_cert =
  2705.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_get_current_cert" )) == NULL )
  2706.         {
  2707.             rc = GetLastError() ;
  2708.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2709.                    "X509_STORE_CTX_get_current_cert",rc);
  2710.             load_error = 1;
  2711.         }
  2712.         if (((FARPROC) p_X509_STORE_CTX_get_error =
  2713.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_get_error" )) == NULL )
  2714.         {
  2715.             rc = GetLastError() ;
  2716.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2717.                    "X509_STORE_CTX_get_error",rc);
  2718.             load_error = 1;
  2719.         }
  2720.         if (((FARPROC) p_X509_STORE_CTX_get_error_depth =
  2721.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_get_error_depth" )) == NULL )
  2722.         {
  2723.             rc = GetLastError() ;
  2724.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2725.                    "X509_STORE_CTX_get_error_depth",rc);
  2726.             load_error = 1;
  2727.         }
  2728.         if (((FARPROC) p_X509_free =
  2729.               GetProcAddress( hCRYPTO, "X509_free" )) == NULL )
  2730.         {
  2731.             rc = GetLastError() ;
  2732.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_free",rc);
  2733.             load_error = 1;
  2734.         }
  2735.         if (((FARPROC) p_X509_get_default_cert_dir =
  2736.               GetProcAddress( hCRYPTO, "X509_get_default_cert_dir" )) == NULL )
  2737.         {
  2738.             rc = GetLastError() ;
  2739.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_default_cert_dir",rc);
  2740.             load_error = 1;
  2741.         }
  2742.         if (((FARPROC) p_RSA_free =
  2743.               GetProcAddress( hCRYPTO, "RSA_free" )) == NULL )
  2744.         {
  2745.             rc = GetLastError() ;
  2746.             debug(F111,"OpenSSL Crypto GetProcAddress failed","RSA_free",rc);
  2747.         }
  2748.         if (((FARPROC) p_RSA_generate_key =
  2749.               GetProcAddress( hCRYPTO, "RSA_generate_key" )) == NULL )
  2750.         {
  2751.             rc = GetLastError() ;
  2752.             debug(F111,"OpenSSL Crypto GetProcAddress failed","RSA_generate_key",rc);
  2753.         }
  2754.         if (((FARPROC) p_DH_new =
  2755.               GetProcAddress( hCRYPTO, "DH_new" )) == NULL )
  2756.         {
  2757.             rc = GetLastError() ;
  2758.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_new",rc);
  2759.             load_error = 1;
  2760.         }
  2761.         if (((FARPROC) p_DH_free =
  2762.               GetProcAddress( hCRYPTO, "DH_free" )) == NULL )
  2763.         {
  2764.             rc = GetLastError() ;
  2765.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_free",rc);
  2766.             load_error = 1;
  2767.         }
  2768.         if (((FARPROC) p_DH_generate_parameters =
  2769.               GetProcAddress( hCRYPTO, "DH_generate_parameters" )) == NULL )
  2770.         {
  2771.             rc = GetLastError() ;
  2772.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_generate_parameters",rc);
  2773.             load_error = 1;
  2774.         }
  2775.         if (((FARPROC) p_DH_generate_key =
  2776.               GetProcAddress( hCRYPTO, "DH_generate_key" )) == NULL )
  2777.         {
  2778.             rc = GetLastError() ;
  2779.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_generate_key",rc);
  2780.             load_error = 1;
  2781.         }
  2782.         if (((FARPROC) p_DSA_free =
  2783.               GetProcAddress( hCRYPTO, "DSA_free" )) == NULL )
  2784.         {
  2785.             rc = GetLastError() ;
  2786.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_free",rc);
  2787.             load_error = 1;
  2788.         }
  2789.         if (((FARPROC) p_DSA_generate_parameters =
  2790.               GetProcAddress( hCRYPTO, "DSA_generate_parameters" )) == NULL )
  2791.         {
  2792.             rc = GetLastError() ;
  2793.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_generate_parameters",rc);
  2794.             load_error = 1;
  2795.         }
  2796.         if (((FARPROC) p_DSA_generate_key =
  2797.               GetProcAddress( hCRYPTO, "DSA_generate_key" )) == NULL )
  2798.         {
  2799.             rc = GetLastError() ;
  2800.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_generate_key",rc);
  2801.             load_error = 1;
  2802.         }
  2803.         if (((FARPROC) p_d2i_DHparams =
  2804.               GetProcAddress( hCRYPTO, "d2i_DHparams" )) == NULL )
  2805.         {
  2806.             rc = GetLastError() ;
  2807.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2808.                    "d2i_DHparams",rc);
  2809.             load_error = 1;
  2810.         }
  2811.         if (((FARPROC) p_PEM_ASN1_read_bio =
  2812.               GetProcAddress( hCRYPTO, "PEM_ASN1_read_bio" )) == NULL )
  2813.         {
  2814.             rc = GetLastError() ;
  2815.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2816.                    "PEM_ASN1_read_bio",rc);
  2817.             load_error = 1;
  2818.         }
  2819.         if (((FARPROC) p_BN_bin2bn =
  2820.               GetProcAddress( hCRYPTO, "BN_bin2bn" )) == NULL )
  2821.         {
  2822.             rc = GetLastError() ;
  2823.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2824.                    "BN_bin2bn",rc);
  2825.             load_error = 1;
  2826.         }
  2827.         if (((FARPROC) p_ASN1_TIME_print =
  2828.               GetProcAddress( hCRYPTO, "ASN1_TIME_print" )) == NULL )
  2829.         {
  2830.             rc = GetLastError() ;
  2831.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2832.                    "ASN1_TIME_print",rc);
  2833.             load_error = 1;
  2834.         }
  2835.  
  2836.         if (((FARPROC) p_sk_GENERAL_NAME_free =
  2837.               GetProcAddress( hCRYPTO, "sk_GENERAL_NAME_free" )) == NULL )
  2838.         {
  2839.             rc = GetLastError() ;
  2840.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2841.                    "sk_GENERAL_NAME_free",rc);
  2842.             /* no longer exported in 0.9.6 */
  2843.         }
  2844.         if (((FARPROC) p_X509V3_EXT_cleanup =
  2845.               GetProcAddress( hCRYPTO, "X509V3_EXT_cleanup" )) == NULL )
  2846.         {
  2847.             rc = GetLastError() ;
  2848.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2849.                    "X509V3_EXT_cleanup",rc);
  2850.             load_error = 1;
  2851.         }
  2852.         if (((FARPROC) p_sk_GENERAL_NAME_value =
  2853.               GetProcAddress( hCRYPTO, "sk_GENERAL_NAME_value" )) == NULL )
  2854.         {
  2855.             rc = GetLastError() ;
  2856.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2857.                    "sk_GENERAL_NAME_value",rc);
  2858.             /* no longer exported in 0.9.6 */
  2859.         }
  2860.         if (((FARPROC) p_sk_GENERAL_NAME_num =
  2861.               GetProcAddress( hCRYPTO, "sk_GENERAL_NAME_num" )) == NULL )
  2862.         {
  2863.             rc = GetLastError() ;
  2864.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2865.                    "sk_GENERAL_NAME_num",rc);
  2866.             /* no longer exported in 0.9.6 */
  2867.         }
  2868.         if (((FARPROC) p_X509V3_EXT_d2i =
  2869.               GetProcAddress( hCRYPTO, "X509V3_EXT_d2i" )) == NULL )
  2870.         {
  2871.             rc = GetLastError() ;
  2872.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2873.                    "X509V3_EXT_d2i",rc);
  2874.             load_error = 1;
  2875.         }
  2876.         if (((FARPROC) p_X509V3_add_standard_extensions =
  2877.               GetProcAddress( hCRYPTO, "X509V3_add_standard_extensions" )) == NULL )
  2878.         {
  2879.             rc = GetLastError() ;
  2880.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2881.                    "X509V3_add_standard_extensions",rc);
  2882.             load_error = 1;
  2883.         }
  2884.         if (((FARPROC) p_X509_get_ext =
  2885.               GetProcAddress( hCRYPTO, "X509_get_ext" )) == NULL )
  2886.         {
  2887.             rc = GetLastError() ;
  2888.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2889.                    "X509_get_ext",rc);
  2890.             load_error = 1;
  2891.         }
  2892.         if (((FARPROC) p_X509_get_ext_by_NID =
  2893.               GetProcAddress( hCRYPTO, "X509_get_ext_by_NID" )) == NULL )
  2894.         {
  2895.             rc = GetLastError() ;
  2896.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2897.                    "X509_get_ext_by_NID",rc);
  2898.             load_error = 1;
  2899.         }
  2900.         if (((FARPROC) p_ASN1_INTEGER_get =
  2901.               GetProcAddress( hCRYPTO, "ASN1_INTEGER_get" )) == NULL )
  2902.         {
  2903.             rc = GetLastError() ;
  2904.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2905.                    "ASN1_INTEGER_get",rc);
  2906.             load_error = 1;
  2907.         }
  2908.         if (((FARPROC) p_ASN1_INTEGER_cmp =
  2909.               GetProcAddress( hCRYPTO, "ASN1_INTEGER_cmp" )) == NULL )
  2910.         {
  2911.             /* New to OpenSSL 0.9.5 */
  2912.             rc = GetLastError() ;
  2913.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2914.                    "ASN1_INTEGER_cmp",rc);
  2915.         }
  2916.         if (((FARPROC) p_ASN1_STRING_cmp =
  2917.               GetProcAddress( hCRYPTO, "ASN1_STRING_cmp" )) == NULL )
  2918.         {
  2919.             rc = GetLastError() ;
  2920.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2921.                    "ASN1_STRING_cmp",rc);
  2922.             load_error = 1;
  2923.         }
  2924.         if (((FARPROC) p_X509_get_serialNumber =
  2925.               GetProcAddress( hCRYPTO, "X509_get_serialNumber" )) == NULL )
  2926.         {
  2927.             rc = GetLastError() ;
  2928.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2929.                    "X509_get_serialNumber",rc);
  2930.             load_error = 1;
  2931.         }
  2932.         if (((FARPROC) p_sk_X509_REVOKED_value =
  2933.               GetProcAddress( hCRYPTO, "sk_X509_REVOKED_value" )) == NULL )
  2934.         {
  2935.             rc = GetLastError() ;
  2936.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2937.                    "sk_X509_REVOKED_value",rc);
  2938.             /* no longer exported in 0.9.6 */
  2939.         }
  2940.         if (((FARPROC) p_sk_X509_REVOKED_num =
  2941.               GetProcAddress( hCRYPTO, "sk_X509_REVOKED_num" )) == NULL )
  2942.         {
  2943.             rc = GetLastError() ;
  2944.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2945.                    "sk_X509_REVOKED_num",rc);
  2946.             /* no longer exported in 0.9.6 */
  2947.         }
  2948.         if (((FARPROC) p_X509_cmp_current_time =
  2949.               GetProcAddress( hCRYPTO, "X509_cmp_current_time" )) == NULL )
  2950.         {
  2951.             rc = GetLastError() ;
  2952.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2953.                    "X509_cmp_current_time",rc);
  2954.             load_error = 1;
  2955.         }
  2956.         if (((FARPROC) p_X509_OBJECT_free_contents =
  2957.               GetProcAddress( hCRYPTO, "X509_OBJECT_free_contents" )) == NULL )
  2958.         {
  2959.             rc = GetLastError() ;
  2960.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2961.                    "X509_OBJECT_free_contents",rc);
  2962.             load_error = 1;
  2963.         }
  2964.         if (((FARPROC) p_X509_STORE_CTX_set_error =
  2965.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_set_error" )) == NULL )
  2966.         {
  2967.             rc = GetLastError() ;
  2968.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2969.                    "X509_STORE_CTX_set_error",rc);
  2970.             load_error = 1;
  2971.         }
  2972.         if (((FARPROC) p_X509_CRL_verify =
  2973.               GetProcAddress( hCRYPTO, "X509_CRL_verify" )) == NULL )
  2974.         {
  2975.             rc = GetLastError() ;
  2976.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2977.                    "X509_CRL_verify",rc);
  2978.             load_error = 1;
  2979.         }
  2980.         if (((FARPROC) p_X509_get_pubkey =
  2981.               GetProcAddress( hCRYPTO, "X509_get_pubkey" )) == NULL )
  2982.         {
  2983.             rc = GetLastError() ;
  2984.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2985.                    "X509_get_pubkey",rc);
  2986.             load_error = 1;
  2987.         }
  2988.         if (((FARPROC) p_X509_STORE_CTX_cleanup =
  2989.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_cleanup" )) == NULL )
  2990.         {
  2991.             rc = GetLastError() ;
  2992.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  2993.                    "X509_STORE_CTX_cleanup",rc);
  2994.             load_error = 1;
  2995.         }
  2996.         if (((FARPROC) p_X509_STORE_get_by_subject =
  2997.               GetProcAddress( hCRYPTO, "X509_STORE_get_by_subject" )) == NULL )
  2998.         {
  2999.             rc = GetLastError() ;
  3000.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3001.                    "X509_STORE_get_by_subject",rc);
  3002.             load_error = 1;
  3003.         }
  3004.         if (((FARPROC) p_X509_STORE_CTX_init =
  3005.               GetProcAddress( hCRYPTO, "X509_STORE_CTX_init" )) == NULL )
  3006.         {
  3007.             rc = GetLastError() ;
  3008.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3009.                    "X509_STORE_CTX_init",rc);
  3010.             load_error = 1;
  3011.         }
  3012.         if (((FARPROC) p_PEM_read_X509 =
  3013.               GetProcAddress( hCRYPTO, "PEM_read_X509" )) == NULL )
  3014.         {
  3015.             rc = GetLastError() ;
  3016.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3017.                    "PEM_read_X509",rc);
  3018.             load_error = 1;
  3019.         }
  3020.         if (((FARPROC) p_X509_LOOKUP_hash_dir =
  3021.               GetProcAddress( hCRYPTO, "X509_LOOKUP_hash_dir" )) == NULL )
  3022.         {
  3023.             rc = GetLastError() ;
  3024.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3025.                    "X509_LOOKUP_hash_dir",rc);
  3026.             load_error = 1;
  3027.         }
  3028.         if (((FARPROC) p_X509_LOOKUP_ctrl =
  3029.               GetProcAddress( hCRYPTO, "X509_LOOKUP_ctrl" )) == NULL )
  3030.         {
  3031.             rc = GetLastError() ;
  3032.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3033.                    "X509_LOOKUP_ctrl",rc);
  3034.             load_error = 1;
  3035.         }
  3036.         if (((FARPROC) p_X509_STORE_add_lookup =
  3037.               GetProcAddress( hCRYPTO, "X509_STORE_add_lookup" )) == NULL )
  3038.         {
  3039.             rc = GetLastError() ;
  3040.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3041.                    "X509_STORE_add_lookup",rc);
  3042.             load_error = 1;
  3043.         }
  3044.         if (((FARPROC) p_X509_LOOKUP_file =
  3045.               GetProcAddress( hCRYPTO, "X509_LOOKUP_file" )) == NULL )
  3046.         {
  3047.             rc = GetLastError() ;
  3048.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3049.                    "X509_LOOKUP_file",rc);
  3050.             load_error = 1;
  3051.         }
  3052.         if (((FARPROC) p_X509_STORE_new =
  3053.               GetProcAddress( hCRYPTO, "X509_STORE_new" )) == NULL )
  3054.         {
  3055.             rc = GetLastError() ;
  3056.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3057.                    "X509_STORE_new",rc);
  3058.             load_error = 1;
  3059.         }
  3060.         if (((FARPROC) p_X509_STORE_free =
  3061.               GetProcAddress( hCRYPTO, "X509_STORE_free" )) == NULL )
  3062.         {
  3063.             rc = GetLastError() ;
  3064.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3065.                    "X509_STORE_free",rc);
  3066.             load_error = 1;
  3067.         }
  3068.         if (((FARPROC) p_X509_STORE_load_locations =
  3069.               GetProcAddress( hCRYPTO, "X509_STORE_load_locations" )) == NULL )
  3070.         {
  3071.             rc = GetLastError() ;
  3072.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3073.                    "X509_STORE_load_locations",rc);
  3074.             load_error = 1;
  3075.         }
  3076.         if (((FARPROC) p_X509_STORE_set_default_paths =
  3077.               GetProcAddress( hCRYPTO, "X509_STORE_set_default_paths" )) == NULL )
  3078.         {
  3079.             rc = GetLastError() ;
  3080.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3081.                    "X509_STORE_set_default_paths",rc);
  3082.             load_error = 1;
  3083.         }
  3084.         if (((FARPROC) p_X509_subject_name_hash =
  3085.               GetProcAddress( hCRYPTO, "X509_subject_name_hash" )) == NULL )
  3086.         {
  3087.             rc = GetLastError() ;
  3088.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3089.                    "X509_subject_name_hash",rc);
  3090.             load_error = 1;
  3091.         }
  3092.         if (((FARPROC) p_X509_issuer_name_hash =
  3093.               GetProcAddress( hCRYPTO, "X509_issuer_name_hash" )) == NULL )
  3094.         {
  3095.             rc = GetLastError() ;
  3096.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3097.                    "X509_issuer_name_hash",rc);
  3098.             load_error = 1;
  3099.         }
  3100.         if (((FARPROC) p_CRYPTO_set_mem_functions =
  3101.               GetProcAddress( hCRYPTO, "CRYPTO_set_mem_functions" )) == NULL )
  3102.         {
  3103.             rc = GetLastError() ;
  3104.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3105.                    "CRYPTO_set_mem_functions",rc);
  3106.             load_error = 1;
  3107.         }
  3108.         if (((FARPROC) p_CRYPTO_set_locking_callback =
  3109.               GetProcAddress( hCRYPTO, "CRYPTO_set_locking_callback" )) == NULL )
  3110.         {
  3111.             rc = GetLastError() ;
  3112.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3113.                    "CRYPTO_set_locking_callback",rc);
  3114.             load_error = 1;
  3115.         }
  3116.         if (((FARPROC) p_CRYPTO_set_dynlock_destroy_callback =
  3117.               GetProcAddress( hCRYPTO, "CRYPTO_set_dynlock_destroy_callback" )) == NULL )
  3118.         {
  3119.             rc = GetLastError() ;
  3120.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3121.                    "CRYPTO_set_dynlock_destroy_callback",rc);
  3122.             load_error = 1;
  3123.         }
  3124.         if (((FARPROC) p_CRYPTO_set_dynlock_create_callback =
  3125.               GetProcAddress( hCRYPTO, "CRYPTO_set_dynlock_create_callback" )) == NULL )
  3126.         {
  3127.             rc = GetLastError() ;
  3128.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3129.                    "CRYPTO_set_dynlock_create_callback",rc);
  3130.             load_error = 1;
  3131.         }
  3132.         if (((FARPROC) p_CRYPTO_set_dynlock_lock_callback =
  3133.               GetProcAddress( hCRYPTO, "CRYPTO_set_dynlock_lock_callback" )) == NULL )
  3134.         {
  3135.             rc = GetLastError() ;
  3136.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3137.                    "CRYPTO_set_dynlock_lock_callback",rc);
  3138.             load_error = 1;
  3139.         }
  3140.         if (((FARPROC) p_CRYPTO_num_locks =
  3141.               GetProcAddress( hCRYPTO, "CRYPTO_num_locks" )) == NULL )
  3142.         {
  3143.             rc = GetLastError() ;
  3144.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3145.                    "CRYPTO_num_locks",rc);
  3146.         }
  3147.         if (((FARPROC) p_RAND_screen =
  3148.               GetProcAddress( hCRYPTO, "RAND_screen" )) == NULL )
  3149.         {
  3150.             rc = GetLastError() ;
  3151.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3152.                    "RAND_screen",rc);
  3153.         }
  3154.         if (((FARPROC) p_RAND_status =
  3155.               GetProcAddress( hCRYPTO, "RAND_status" )) == NULL )
  3156.         {
  3157.             rc = GetLastError() ;
  3158.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3159.                    "RAND_status",rc);
  3160.         }
  3161.         if (((FARPROC) p_RAND_file_name =
  3162.               GetProcAddress( hCRYPTO, "RAND_file_name" )) == NULL )
  3163.         {
  3164.             rc = GetLastError() ;
  3165.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3166.                    "RAND_file_name",rc);
  3167.         }
  3168.         if (((FARPROC) p_RAND_egd =
  3169.               GetProcAddress( hCRYPTO, "RAND_egd" )) == NULL )
  3170.         {
  3171.             rc = GetLastError() ;
  3172.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3173.                    "RAND_egd",rc);
  3174.         }
  3175.         if (((FARPROC) p_RAND_load_file =
  3176.               GetProcAddress( hCRYPTO, "RAND_load_file" )) == NULL )
  3177.         {
  3178.             rc = GetLastError() ;
  3179.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3180.                    "RAND_load_file",rc);
  3181.         }
  3182.         if (((FARPROC) p_RAND_write_file =
  3183.               GetProcAddress( hCRYPTO, "RAND_write_file" )) == NULL )
  3184.         {
  3185.             rc = GetLastError() ;
  3186.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3187.                    "RAND_write_file",rc);
  3188.         }
  3189.         if (((FARPROC) p_RAND_seed =
  3190.               GetProcAddress( hCRYPTO, "RAND_seed" )) == NULL )
  3191.         {
  3192.             rc = GetLastError() ;
  3193.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3194.                    "RAND_seed",rc);
  3195.         }
  3196.         if (((FARPROC) p_sk_num =
  3197.               GetProcAddress( hCRYPTO, "sk_num" )) == NULL )
  3198.         {
  3199.             rc = GetLastError() ;
  3200.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3201.                    "sk_num",rc);
  3202.         }
  3203.         if (((FARPROC) p_sk_value =
  3204.               GetProcAddress( hCRYPTO, "sk_value" )) == NULL )
  3205.         {
  3206.             rc = GetLastError() ;
  3207.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3208.                    "sk_value",rc);
  3209.         }
  3210.         if (((FARPROC) p_sk_free =
  3211.               GetProcAddress( hCRYPTO, "sk_free" )) == NULL )
  3212.         {
  3213.             rc = GetLastError() ;
  3214.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3215.                    "sk_free",rc);
  3216.         }
  3217. #ifdef ZLIB
  3218.         if (((FARPROC) p_COMP_zlib =
  3219.               GetProcAddress( hCRYPTO, "COMP_zlib" )) == NULL )
  3220.         {
  3221.             rc = GetLastError() ;
  3222.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3223.                    "COMP_zlib",rc);
  3224.         }
  3225. #endif /* ZLIB */
  3226.         if (((FARPROC) p_COMP_rle =
  3227.               GetProcAddress( hCRYPTO, "COMP_rle" )) == NULL )
  3228.         {
  3229.             rc = GetLastError() ;
  3230.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3231.                    "COMP_rle",rc);
  3232.         }
  3233.         if (((FARPROC) p_ERR_peek_error =
  3234.               GetProcAddress( hCRYPTO, "ERR_peek_error" )) == NULL )
  3235.         {
  3236.             rc = GetLastError() ;
  3237.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3238.                    "ERR_peek_error",rc);
  3239.         }
  3240.         if (((FARPROC) p_sk_pop_free =
  3241.               GetProcAddress( hCRYPTO, "sk_pop_free" )) == NULL )
  3242.         {
  3243.             rc = GetLastError() ;
  3244.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3245.                    "sk_pop_free",rc);
  3246.         }
  3247.         if (((FARPROC) p_PEM_read_bio_X509 =
  3248.               GetProcAddress( hCRYPTO, "PEM_read_bio_X509" )) == NULL )
  3249.         {
  3250.             rc = GetLastError() ;
  3251.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3252.                    "PEM_read_bio_X509",rc);
  3253.         }
  3254.         if (((FARPROC) p_SSLeay =
  3255.               GetProcAddress( hCRYPTO, "SSLeay" )) == NULL )
  3256.         {
  3257.             rc = GetLastError() ;
  3258.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3259.                    "SSLeay",rc);
  3260.             load_error = 1;
  3261.         }
  3262.         if (((FARPROC) p_SSLeay_version =
  3263.               GetProcAddress( hCRYPTO, "SSLeay_version" )) == NULL )
  3264.         {
  3265.             rc = GetLastError() ;
  3266.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3267.                    "SSLeay_version",rc);
  3268.             load_error = 1;
  3269.         }
  3270.  
  3271.         if (((FARPROC) p_SHA1_Init =
  3272.               GetProcAddress( hCRYPTO, "SHA1_Init" )) == NULL )
  3273.         {
  3274.             rc = GetLastError() ;
  3275.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3276.                    "SHA1_Init",rc);
  3277.             load_error = 1;
  3278.         }
  3279.         if (((FARPROC) p_SHA1_Update =
  3280.               GetProcAddress( hCRYPTO, "SHA1_Update" )) == NULL )
  3281.         {
  3282.             rc = GetLastError() ;
  3283.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3284.                    "SHA1_Update",rc);
  3285.             load_error = 1;
  3286.         }
  3287.         if (((FARPROC) p_SHA1_Final =
  3288.               GetProcAddress( hCRYPTO, "SHA1_Final" )) == NULL )
  3289.         {
  3290.             rc = GetLastError() ;
  3291.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3292.                    "SHA1_Final",rc);
  3293.             load_error = 1;
  3294.         }
  3295.  
  3296.         if (((FARPROC) p_BN_new =
  3297.               GetProcAddress( hCRYPTO, "BN_new" )) == NULL )
  3298.         {
  3299.             rc = GetLastError() ;
  3300.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3301.                    "BN_new",rc);
  3302.             load_error = 1;
  3303.         }
  3304.         if (((FARPROC) p_BN_dup =
  3305.               GetProcAddress( hCRYPTO, "BN_dup" )) == NULL )
  3306.         {
  3307.             rc = GetLastError() ;
  3308.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3309.                    "BN_dup",rc);
  3310.             load_error = 1;
  3311.         }
  3312.         if (((FARPROC) p_BN_bn2bin =
  3313.               GetProcAddress( hCRYPTO, "BN_bn2bin" )) == NULL )
  3314.         {
  3315.             rc = GetLastError() ;
  3316.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3317.                    "BN_bn2bin",rc);
  3318.             load_error = 1;
  3319.         }
  3320.         if (((FARPROC) p_BN_num_bits =
  3321.               GetProcAddress( hCRYPTO, "BN_num_bits" )) == NULL )
  3322.         {
  3323.             rc = GetLastError() ;
  3324.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3325.                    "BN_num_bits",rc);
  3326.             load_error = 1;
  3327.         }
  3328.         if (((FARPROC) p_BN_cmp =
  3329.               GetProcAddress( hCRYPTO, "BN_cmp" )) == NULL )
  3330.         {
  3331.             rc = GetLastError() ;
  3332.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3333.                    "BN_cmp",rc);
  3334.             load_error = 1;
  3335.         }
  3336.         if (((FARPROC) p_BN_ucmp =
  3337.               GetProcAddress( hCRYPTO, "BN_ucmp" )) == NULL )
  3338.         {
  3339.             rc = GetLastError() ;
  3340.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3341.                    "BN_ucmp",rc);
  3342.             load_error = 1;
  3343.         }
  3344.         if (((FARPROC) p_BN_add_word =
  3345.               GetProcAddress( hCRYPTO, "BN_add_word" )) == NULL )
  3346.         {
  3347.             rc = GetLastError() ;
  3348.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3349.                    "BN_add_word",rc);
  3350.             load_error = 1;
  3351.         }
  3352.         if (((FARPROC) p_BN_mul_word =
  3353.               GetProcAddress( hCRYPTO, "BN_mul_word" )) == NULL )
  3354.         {
  3355.             rc = GetLastError() ;
  3356.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3357.                    "BN_mul_word",rc);
  3358.             load_error = 1;
  3359.         }
  3360.         if (((FARPROC) p_BN_lshift =
  3361.               GetProcAddress( hCRYPTO, "BN_lshift" )) == NULL )
  3362.         {
  3363.             rc = GetLastError() ;
  3364.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3365.                    "BN_lshift",rc);
  3366.             load_error = 1;
  3367.         }
  3368.         if (((FARPROC) p_BN_set_word =
  3369.               GetProcAddress( hCRYPTO, "BN_set_word" )) == NULL )
  3370.         {
  3371.             rc = GetLastError() ;
  3372.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3373.                    "BN_set_word",rc);
  3374.             load_error = 1;
  3375.         }
  3376.         if (((FARPROC) p_BN_dec2bn =
  3377.               GetProcAddress( hCRYPTO, "BN_dec2bn" )) == NULL )
  3378.         {
  3379.             rc = GetLastError() ;
  3380.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3381.                    "BN_dec2bn",rc);
  3382.             load_error = 1;
  3383.         }
  3384.         if (((FARPROC) p_BN_bn2dec =
  3385.               GetProcAddress( hCRYPTO, "BN_bn2dec" )) == NULL )
  3386.         {
  3387.             rc = GetLastError() ;
  3388.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3389.                    "BN_bn2dec",rc);
  3390.             load_error = 1;
  3391.         }
  3392.         if (((FARPROC) p_BN_copy =
  3393.               GetProcAddress( hCRYPTO, "BN_copy" )) == NULL )
  3394.         {
  3395.             rc = GetLastError() ;
  3396.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3397.                    "BN_copy",rc);
  3398.             load_error = 1;
  3399.         }
  3400.         if (((FARPROC) p_BN_CTX_free =
  3401.               GetProcAddress( hCRYPTO, "BN_CTX_free" )) == NULL )
  3402.         {
  3403.             rc = GetLastError() ;
  3404.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3405.                    "BN_CTX_free",rc);
  3406.             load_error = 1;
  3407.         }
  3408.         if (((FARPROC) p_BN_div =
  3409.               GetProcAddress( hCRYPTO, "BN_div" )) == NULL )
  3410.         {
  3411.             rc = GetLastError() ;
  3412.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3413.                    "BN_div",rc);
  3414.             load_error = 1;
  3415.         }
  3416.         if (((FARPROC) p_BN_sub =
  3417.               GetProcAddress( hCRYPTO, "BN_sub" )) == NULL )
  3418.         {
  3419.             rc = GetLastError() ;
  3420.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3421.                    "BN_sub",rc);
  3422.             load_error = 1;
  3423.         }
  3424.         if (((FARPROC) p_BN_value_one =
  3425.               GetProcAddress( hCRYPTO, "BN_value_one" )) == NULL )
  3426.         {
  3427.             rc = GetLastError() ;
  3428.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3429.                    "BN_value_one",rc);
  3430.             load_error = 1;
  3431.         }
  3432.         if (((FARPROC) p_BN_CTX_new =
  3433.               GetProcAddress( hCRYPTO, "BN_CTX_new" )) == NULL )
  3434.         {
  3435.             rc = GetLastError() ;
  3436.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3437.                    "BN_CTX_new",rc);
  3438.             load_error = 1;
  3439.         }
  3440.         if (((FARPROC) p_BN_CTX_get =
  3441.               GetProcAddress( hCRYPTO, "BN_CTX_get" )) == NULL )
  3442.         {
  3443.             rc = GetLastError() ;
  3444.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3445.                    "BN_CTX_get",rc);
  3446.             load_error = 1;
  3447.         }
  3448.         if (((FARPROC) p_BN_CTX_start =
  3449.               GetProcAddress( hCRYPTO, "BN_CTX_start" )) == NULL )
  3450.         {
  3451.             rc = GetLastError() ;
  3452.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3453.                    "BN_CTX_start",rc);
  3454.             load_error = 1;
  3455.         }
  3456.         if (((FARPROC) p_BN_CTX_end =
  3457.               GetProcAddress( hCRYPTO, "BN_CTX_end" )) == NULL )
  3458.         {
  3459.             rc = GetLastError() ;
  3460.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3461.                    "BN_CTX_end",rc);
  3462.             load_error = 1;
  3463.         }
  3464.         if (((FARPROC) p_BN_free =
  3465.               GetProcAddress( hCRYPTO, "BN_free" )) == NULL )
  3466.         {
  3467.             rc = GetLastError() ;
  3468.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3469.                    "BN_free",rc);
  3470.             load_error = 1;
  3471.         }
  3472.         if (((FARPROC) p_BN_hex2bn =
  3473.               GetProcAddress( hCRYPTO, "BN_hex2bn" )) == NULL )
  3474.         {
  3475.             rc = GetLastError() ;
  3476.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3477.                    "BN_hex2bn",rc);
  3478.             load_error = 1;
  3479.         }
  3480.         if (((FARPROC) p_BN_is_bit_set =
  3481.               GetProcAddress( hCRYPTO, "BN_is_bit_set" )) == NULL )
  3482.         {
  3483.             rc = GetLastError() ;
  3484.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3485.                    "BN_is_bit_set",rc);
  3486.             load_error = 1;
  3487.         }
  3488.         if (((FARPROC) p_BN_rand =
  3489.               GetProcAddress( hCRYPTO, "BN_rand" )) == NULL )
  3490.         {
  3491.             rc = GetLastError() ;
  3492.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3493.                    "BN_rand",rc);
  3494.             load_error = 1;
  3495.         }
  3496.         if (((FARPROC) p_BN_bn2hex =
  3497.               GetProcAddress( hCRYPTO, "BN_bn2hex" )) == NULL )
  3498.         {
  3499.             rc = GetLastError() ;
  3500.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3501.                    "BN_bn2hex",rc);
  3502.             load_error = 1;
  3503.         }
  3504.         if (((FARPROC) p_BN_add =
  3505.               GetProcAddress( hCRYPTO, "BN_add" )) == NULL )
  3506.         {
  3507.             rc = GetLastError() ;
  3508.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3509.                    "BN_add",rc);
  3510.             load_error = 1;
  3511.         }
  3512.         if (((FARPROC) p_BN_mul =
  3513.               GetProcAddress( hCRYPTO, "BN_mul" )) == NULL )
  3514.         {
  3515.             rc = GetLastError() ;
  3516.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3517.                    "BN_mul",rc);
  3518.             load_error = 1;
  3519.         }
  3520.         if (((FARPROC) p_BN_mod =
  3521.               GetProcAddress( hCRYPTO, "BN_mod" )) == NULL )
  3522.         {
  3523.             rc = GetLastError() ;
  3524.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3525.                    "BN_mod",rc);
  3526.         }
  3527.         if (((FARPROC) p_BN_mod_word =
  3528.               GetProcAddress( hCRYPTO, "BN_mod_word" )) == NULL )
  3529.         {
  3530.             rc = GetLastError() ;
  3531.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3532.                    "BN_mod_word",rc);
  3533.             load_error = 1;
  3534.         }
  3535.         if (((FARPROC) p_BN_mod_mul =
  3536.               GetProcAddress( hCRYPTO, "BN_mod_mul" )) == NULL )
  3537.         {
  3538.             rc = GetLastError() ;
  3539.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3540.                    "BN_mod_mul",rc);
  3541.             load_error = 1;
  3542.         }
  3543.         if (((FARPROC) p_BN_mod_exp =
  3544.               GetProcAddress( hCRYPTO, "BN_mod_exp" )) == NULL )
  3545.         {
  3546.             rc = GetLastError() ;
  3547.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3548.                    "BN_mod_exp",rc);
  3549.             load_error = 1;
  3550.         }
  3551.         if (((FARPROC) p_BN_is_prime =
  3552.               GetProcAddress( hCRYPTO, "BN_is_prime" )) == NULL )
  3553.         {
  3554.             rc = GetLastError() ;
  3555.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3556.                    "BN_is_prime",rc);
  3557.             load_error = 1;
  3558.         }
  3559.  
  3560.         if (((FARPROC) p_MD5_Final =
  3561.               GetProcAddress( hCRYPTO, "MD5_Final" )) == NULL )
  3562.         {
  3563.             rc = GetLastError() ;
  3564.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3565.                    "MD5_Final",rc);
  3566.             load_error = 1;
  3567.         }
  3568.         if (((FARPROC) p_MD5_Update =
  3569.               GetProcAddress( hCRYPTO, "MD5_Update" )) == NULL )
  3570.         {
  3571.             rc = GetLastError() ;
  3572.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3573.                    "MD5_Update",rc);
  3574.             load_error = 1;
  3575.         }
  3576.         if (((FARPROC) p_MD5_Init =
  3577.               GetProcAddress( hCRYPTO, "MD5_Init" )) == NULL )
  3578.         {
  3579.             rc = GetLastError() ;
  3580.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3581.                    "MD5_Init",rc);
  3582.             load_error = 1;
  3583.         }
  3584.         if (((FARPROC) p_BN_clear_free =
  3585.               GetProcAddress( hCRYPTO, "BN_clear_free" )) == NULL )
  3586.         {
  3587.             rc = GetLastError() ;
  3588.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3589.                    "BN_clear_free",rc);
  3590.             load_error = 1;
  3591.         }
  3592.         if (((FARPROC) p_BN_rshift1 =
  3593.               GetProcAddress( hCRYPTO, "BN_rshift1" )) == NULL )
  3594.         {
  3595.             rc = GetLastError() ;
  3596.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3597.                    "BN_rshift1",rc);
  3598.             load_error = 1;
  3599.         }
  3600.         if (((FARPROC) p_BN_clear =
  3601.               GetProcAddress( hCRYPTO, "BN_clear" )) == NULL )
  3602.         {
  3603.             rc = GetLastError() ;
  3604.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3605.                    "BN_clear",rc);
  3606.             load_error = 1;
  3607.         }
  3608.         if (((FARPROC) p_EVP_DigestFinal =
  3609.               GetProcAddress( hCRYPTO, "EVP_DigestFinal" )) == NULL )
  3610.         {
  3611.             rc = GetLastError() ;
  3612.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3613.                    "EVP_DigestFinal",rc);
  3614.             load_error = 1;
  3615.         }
  3616.         if (((FARPROC) p_EVP_DigestUpdate =
  3617.               GetProcAddress( hCRYPTO, "EVP_DigestUpdate" )) == NULL )
  3618.         {
  3619.             rc = GetLastError() ;
  3620.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3621.                    "EVP_DigestUpdate",rc);
  3622.             load_error = 1;
  3623.         }
  3624.         if (((FARPROC) p_EVP_DigestInit =
  3625.               GetProcAddress( hCRYPTO, "EVP_DigestInit" )) == NULL )
  3626.         {
  3627.             rc = GetLastError() ;
  3628.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3629.                    "EVP_DigestInit",rc);
  3630.             load_error = 1;
  3631.         }
  3632.         if (((FARPROC) p_EVP_sha1 =
  3633.               GetProcAddress( hCRYPTO, "EVP_sha1" )) == NULL )
  3634.         {
  3635.             rc = GetLastError() ;
  3636.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3637.                    "EVP_sha1",rc);
  3638.             load_error = 1;
  3639.         }
  3640.         if (((FARPROC) p_EVP_md5 =
  3641.               GetProcAddress( hCRYPTO, "EVP_md5" )) == NULL )
  3642.         {
  3643.             rc = GetLastError() ;
  3644.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3645.                    "EVP_md5",rc);
  3646.             load_error = 1;
  3647.         }
  3648.         if (((FARPROC) p_EVP_des_ede3_cbc =
  3649.               GetProcAddress( hCRYPTO, "EVP_des_ede3_cbc" )) == NULL )
  3650.         {
  3651.             rc = GetLastError() ;
  3652.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3653.                    "EVP_des_ede3_cbc",rc);
  3654.             load_error = 1;
  3655.         }
  3656.         if (((FARPROC) p_EVP_PKEY_free =
  3657.               GetProcAddress( hCRYPTO, "EVP_PKEY_free" )) == NULL )
  3658.         {
  3659.             rc = GetLastError() ;
  3660.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3661.                    "EVP_PKEY_free",rc);
  3662.             load_error = 1;
  3663.         }
  3664.         if (((FARPROC) p_EVP_PKEY_get1_DSA =
  3665.               GetProcAddress( hCRYPTO, "EVP_PKEY_get1_DSA" )) == NULL )
  3666.         {
  3667.             rc = GetLastError() ;
  3668.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3669.                    "EVP_PKEY_get1_DSA",rc);
  3670.             load_error = 1;
  3671.         }
  3672.         if (((FARPROC) p_EVP_PKEY_get1_RSA =
  3673.               GetProcAddress( hCRYPTO, "EVP_PKEY_get1_RSA" )) == NULL )
  3674.         {
  3675.             rc = GetLastError() ;
  3676.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3677.                    "EVP_PKEY_get1_RSA",rc);
  3678.             load_error = 1;
  3679.         }
  3680.         if (((FARPROC) p_EVP_get_digestbyname =
  3681.               GetProcAddress( hCRYPTO, "EVP_get_digestbyname" )) == NULL )
  3682.         {
  3683.             rc = GetLastError() ;
  3684.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3685.                    "EVP_get_digestbyname",rc);
  3686.             load_error = 1;
  3687.         }
  3688.         if (((FARPROC) p_EVP_ripemd160 =
  3689.               GetProcAddress( hCRYPTO, "EVP_ripemd160" )) == NULL )
  3690.         {
  3691.             rc = GetLastError() ;
  3692.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3693.                    "EVP_ripemd160",rc);
  3694.             load_error = 1;
  3695.         }
  3696.         if (((FARPROC) p_RSA_new =
  3697.               GetProcAddress( hCRYPTO, "RSA_new" )) == NULL )
  3698.         {
  3699.             rc = GetLastError() ;
  3700.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3701.                    "RSA_new",rc);
  3702.             load_error = 1;
  3703.         }
  3704.         if (((FARPROC) p_RSA_public_encrypt =
  3705.               GetProcAddress( hCRYPTO, "RSA_public_encrypt" )) == NULL )
  3706.         {
  3707.             rc = GetLastError() ;
  3708.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3709.                    "RSA_public_encrypt",rc);
  3710.             load_error = 1;
  3711.         }
  3712.         if (((FARPROC) p_RSA_public_decrypt =
  3713.               GetProcAddress( hCRYPTO, "RSA_public_decrypt" )) == NULL )
  3714.         {
  3715.             rc = GetLastError() ;
  3716.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3717.                    "RSA_public_decrypt",rc);
  3718.             load_error = 1;
  3719.         }
  3720.         if (((FARPROC) p_RSA_private_encrypt =
  3721.               GetProcAddress( hCRYPTO, "RSA_private_encrypt" )) == NULL )
  3722.         {
  3723.             rc = GetLastError() ;
  3724.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3725.                    "RSA_private_encrypt",rc);
  3726.             load_error = 1;
  3727.         }
  3728.         if (((FARPROC) p_RSA_private_decrypt =
  3729.               GetProcAddress( hCRYPTO, "RSA_private_decrypt" )) == NULL )
  3730.         {
  3731.             rc = GetLastError() ;
  3732.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3733.                    "RSA_private_decrypt",rc);
  3734.             load_error = 1;
  3735.         }
  3736.         if (((FARPROC) p_RSA_sign =
  3737.               GetProcAddress( hCRYPTO, "RSA_sign" )) == NULL )
  3738.         {
  3739.             rc = GetLastError() ;
  3740.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3741.                    "RSA_sign",rc);
  3742.             load_error = 1;
  3743.         }
  3744.         if (((FARPROC) p_RSA_size =
  3745.               GetProcAddress( hCRYPTO, "RSA_size" )) == NULL )
  3746.         {
  3747.             rc = GetLastError() ;
  3748.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3749.                    "RSA_size",rc);
  3750.             load_error = 1;
  3751.         }
  3752.         if (((FARPROC) p_RSA_verify =
  3753.               GetProcAddress( hCRYPTO, "RSA_verify" )) == NULL )
  3754.         {
  3755.             rc = GetLastError() ;
  3756.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3757.                    "RSA_verify",rc);
  3758.             load_error = 1;
  3759.         }
  3760.         if (((FARPROC) p_DSA_new =
  3761.               GetProcAddress( hCRYPTO, "DSA_new" )) == NULL )
  3762.         {
  3763.             rc = GetLastError() ;
  3764.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3765.                    "DSA_new",rc);
  3766.             load_error = 1;
  3767.         }
  3768.         if (((FARPROC) p_DSA_SIG_free =
  3769.               GetProcAddress( hCRYPTO, "DSA_SIG_free" )) == NULL )
  3770.         {
  3771.             rc = GetLastError() ;
  3772.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3773.                    "DSA_SIG_free",rc);
  3774.             load_error = 1;
  3775.         }
  3776.         if (((FARPROC) p_DSA_do_sign =
  3777.               GetProcAddress( hCRYPTO, "DSA_do_sign" )) == NULL )
  3778.         {
  3779.             rc = GetLastError() ;
  3780.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3781.                    "DSA_do_sign",rc);
  3782.             load_error = 1;
  3783.         }
  3784.         if (((FARPROC) p_DSA_do_verify =
  3785.               GetProcAddress( hCRYPTO, "DSA_do_verify" )) == NULL )
  3786.         {
  3787.             rc = GetLastError() ;
  3788.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3789.                    "DSA_do_verify",rc);
  3790.             load_error = 1;
  3791.         }
  3792.         if (((FARPROC) p_DSA_SIG_new =
  3793.               GetProcAddress( hCRYPTO, "DSA_SIG_new" )) == NULL )
  3794.         {
  3795.             rc = GetLastError() ;
  3796.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3797.                    "DSA_SIG_new",rc);
  3798.             load_error = 1;
  3799.         }
  3800.         if (((FARPROC) p_HMAC_cleanup =
  3801.               GetProcAddress( hCRYPTO, "HMAC_cleanup" )) == NULL )
  3802.         {
  3803.             rc = GetLastError() ;
  3804.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3805.                    "HMAC_cleanup",rc);
  3806.         }
  3807.         if (((FARPROC) p_HMAC_CTX_cleanup =
  3808.               GetProcAddress( hCRYPTO, "HMAC_CTX_cleanup" )) == NULL )
  3809.         {
  3810.             rc = GetLastError() ;
  3811.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3812.                    "HMAC_CTX_cleanup",rc);
  3813.         }
  3814.         if (((FARPROC) p_HMAC_Final =
  3815.               GetProcAddress( hCRYPTO, "HMAC_Final" )) == NULL )
  3816.         {
  3817.             rc = GetLastError() ;
  3818.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3819.                    "HMAC_Final",rc);
  3820.             load_error = 1;
  3821.         }
  3822.         if (((FARPROC) p_HMAC_Update =
  3823.               GetProcAddress( hCRYPTO, "HMAC_Update" )) == NULL )
  3824.         {
  3825.             rc = GetLastError() ;
  3826.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3827.                    "HMAC_Update",rc);
  3828.             load_error = 1;
  3829.         }
  3830.         if (((FARPROC) p_HMAC_Init =
  3831.               GetProcAddress( hCRYPTO, "HMAC_Init" )) == NULL )
  3832.         {
  3833.             rc = GetLastError() ;
  3834.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3835.                    "HMAC_Init",rc);
  3836.             load_error = 1;
  3837.         }
  3838.         if (((FARPROC) p_RAND_add =
  3839.               GetProcAddress( hCRYPTO, "RAND_add" )) == NULL )
  3840.         {
  3841.             rc = GetLastError() ;
  3842.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3843.                    "RAND_add",rc);
  3844.             load_error = 1;
  3845.         }
  3846.         if (((FARPROC) p_RAND_bytes =
  3847.               GetProcAddress( hCRYPTO, "RAND_bytes" )) == NULL )
  3848.         {
  3849.             rc = GetLastError() ;
  3850.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3851.                    "RAND_bytes",rc);
  3852.             load_error = 1;
  3853.         }
  3854.         if (((FARPROC) p_des_set_key =
  3855.               GetProcAddress( hCRYPTO, "des_set_key" )) == NULL )
  3856.         {
  3857.             rc = GetLastError() ;
  3858.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3859.                    "des_set_key",rc);
  3860.             if (((FARPROC) p_des_set_key =
  3861.                   GetProcAddress( hCRYPTO, "_ossl_old_des_set_key" )) == NULL )
  3862.             {
  3863.                 rc = GetLastError() ;
  3864.                 debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3865.                        "_ossl_old_des_set_key",rc);
  3866.                 load_error = 1;
  3867.             }
  3868.         }
  3869.         if (((FARPROC) p_des_ncbc_encrypt =
  3870.               GetProcAddress( hCRYPTO, "des_ncbc_encrypt" )) == NULL )
  3871.         {
  3872.             rc = GetLastError() ;
  3873.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3874.                    "des_ncbc_encrypt",rc);
  3875.             if (((FARPROC) p_des_ncbc_encrypt =
  3876.                   GetProcAddress( hCRYPTO, "_ossl_old_des_ncbc_encrypt" )) == NULL )
  3877.             {
  3878.                 rc = GetLastError() ;
  3879.                 debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3880.                        "_ossl_old_des_ncbc_encrypt",rc);
  3881.                 load_error = 1;
  3882.             }
  3883.         }
  3884.         if (((FARPROC) p_des_ede3_cbc_encrypt =
  3885.               GetProcAddress( hCRYPTO, "des_ede3_cbc_encrypt" )) == NULL )
  3886.         {
  3887.             rc = GetLastError() ;
  3888.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3889.                    "des_ede3_cbc_encrypt",rc);
  3890.             if (((FARPROC) p_des_ede3_cbc_encrypt =
  3891.                   GetProcAddress( hCRYPTO, "_ossl_old_des_ede3_cbc_encrypt" )) == NULL )
  3892.             {
  3893.                 rc = GetLastError() ;
  3894.                 debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3895.                        "_ossl_old_des_ede3_cbc_encrypt",rc);
  3896.                 load_error = 1;
  3897.             }
  3898.         }
  3899.         if (((FARPROC) p_BF_set_key =
  3900.               GetProcAddress( hCRYPTO, "BF_set_key" )) == NULL )
  3901.         {
  3902.             rc = GetLastError() ;
  3903.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3904.                    "BF_set_key",rc);
  3905.             load_error = 1;
  3906.         }
  3907.         if (((FARPROC) p_BF_cbc_encrypt =
  3908.               GetProcAddress( hCRYPTO, "BF_cbc_encrypt" )) == NULL )
  3909.         {
  3910.             rc = GetLastError() ;
  3911.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3912.                    "BF_cbc_encrypt",rc);
  3913.             load_error = 1;
  3914.         }
  3915.         if (((FARPROC) p_RC4_set_key =
  3916.               GetProcAddress( hCRYPTO, "RC4_set_key" )) == NULL )
  3917.         {
  3918.             rc = GetLastError() ;
  3919.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3920.                    "RC4_set_key",rc);
  3921.             load_error = 1;
  3922.         }
  3923.         if (((FARPROC) p_RC4 =
  3924.               GetProcAddress( hCRYPTO, "RC4" )) == NULL )
  3925.         {
  3926.             rc = GetLastError() ;
  3927.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3928.                    "RC4",rc);
  3929.             load_error = 1;
  3930.         }
  3931.         if (((FARPROC) p_CAST_set_key =
  3932.               GetProcAddress( hCRYPTO, "CAST_set_key" )) == NULL )
  3933.         {
  3934.             rc = GetLastError() ;
  3935.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3936.                    "CAST_set_key",rc);
  3937.             load_error = 1;
  3938.         }
  3939.         if (((FARPROC) p_CAST_cbc_encrypt =
  3940.               GetProcAddress( hCRYPTO, "CAST_cbc_encrypt" )) == NULL )
  3941.         {
  3942.             rc = GetLastError() ;
  3943.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3944.                    "CAST_cbc_encrypt",rc);
  3945.             load_error = 1;
  3946.         }
  3947.         if (((FARPROC) p_OBJ_nid2sn =
  3948.               GetProcAddress( hCRYPTO, "OBJ_nid2sn" )) == NULL )
  3949.         {
  3950.             rc = GetLastError() ;
  3951.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3952.                    "OBJ_nid2sn",rc);
  3953.             load_error = 1;
  3954.         }
  3955.         if (((FARPROC) p_OBJ_create =
  3956.               GetProcAddress( hCRYPTO, "OBJ_create" )) == NULL )
  3957.         {
  3958.             rc = GetLastError() ;
  3959.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3960.                    "OBJ_create",rc);
  3961.         }
  3962.         if (((FARPROC) p_DH_compute_key =
  3963.               GetProcAddress( hCRYPTO, "DH_compute_key" )) == NULL )
  3964.         {
  3965.             rc = GetLastError() ;
  3966.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3967.                    "DH_compute_key",rc);
  3968.             load_error = 1;
  3969.         }
  3970.         if (((FARPROC) p_DH_size =
  3971.               GetProcAddress( hCRYPTO, "DH_size" )) == NULL )
  3972.         {
  3973.             rc = GetLastError() ;
  3974.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3975.                    "DH_size",rc);
  3976.             load_error = 1;
  3977.         }
  3978.         if (((FARPROC) p_ERR_load_crypto_strings =
  3979.               GetProcAddress( hCRYPTO, "ERR_load_crypto_strings" )) == NULL )
  3980.         {
  3981.             rc = GetLastError() ;
  3982.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3983.                    "ERR_load_crypto_strings",rc);
  3984.             load_error = 1;
  3985.         }
  3986.         if (((FARPROC) p_CRYPTO_free =
  3987.               GetProcAddress( hCRYPTO, "CRYPTO_free" )) == NULL )
  3988.         {
  3989.             rc = GetLastError() ;
  3990.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3991.                    "CRYPTO_free",rc);
  3992.             load_error = 1;
  3993.         }
  3994.         if (((FARPROC) p_PEM_write_DSAPrivateKey =
  3995.               GetProcAddress( hCRYPTO, "PEM_write_DSAPrivateKey" )) == NULL )
  3996.         {
  3997.             rc = GetLastError() ;
  3998.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  3999.                    "PEM_write_DSAPrivateKey",rc);
  4000.             load_error = 1;
  4001.         }
  4002.         if (((FARPROC) p_PEM_write_RSAPrivateKey =
  4003.               GetProcAddress( hCRYPTO, "PEM_write_RSAPrivateKey" )) == NULL )
  4004.         {
  4005.             rc = GetLastError() ;
  4006.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4007.                    "PEM_write_RSAPrivateKey",rc);
  4008.             load_error = 1;
  4009.         }
  4010.         if (((FARPROC) p_PEM_write_bio_X509 =
  4011.               GetProcAddress( hCRYPTO, "PEM_write_bio_X509" )) == NULL )
  4012.         {
  4013.             rc = GetLastError() ;
  4014.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4015.                    "PEM_write_bio_X509",rc);
  4016.             load_error = 1;
  4017.         }
  4018.         if (((FARPROC) p_PEM_read_PrivateKey =
  4019.               GetProcAddress( hCRYPTO, "PEM_read_PrivateKey" )) == NULL )
  4020.         {
  4021.             rc = GetLastError() ;
  4022.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4023.                    "PEM_read_PrivateKey",rc);
  4024.             load_error = 1;
  4025.         }
  4026.         if (((FARPROC) p_X509_get_default_cert_dir_env =
  4027.               GetProcAddress( hCRYPTO, "X509_get_default_cert_dir_env" )) == NULL )
  4028.         {
  4029.             rc = GetLastError() ;
  4030.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4031.                    "X509_get_default_cert_dir_env",rc);
  4032.         }
  4033.         if (((FARPROC) p_X509_get_default_cert_file_env =
  4034.               GetProcAddress( hCRYPTO, "X509_get_default_cert_file_env" )) == NULL )
  4035.         {
  4036.             rc = GetLastError() ;
  4037.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4038.                    "X509_get_default_cert_file_env",rc);
  4039.         }
  4040.         if (((FARPROC) p_OpenSSL_add_all_ciphers =
  4041.               GetProcAddress( hCRYPTO, "OpenSSL_add_all_ciphers" )) == NULL )
  4042.         {
  4043.             rc = GetLastError() ;
  4044.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4045.                    "OpenSSL_add_all_ciphers",rc);
  4046.         }
  4047.         if (((FARPROC) p_OpenSSL_add_all_digests =
  4048.               GetProcAddress( hCRYPTO, "OpenSSL_add_all_digests" )) == NULL )
  4049.         {
  4050.             rc = GetLastError() ;
  4051.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4052.                    "OpenSSL_add_all_digests",rc);
  4053.         }
  4054.         if (((FARPROC) p_OPENSSL_add_all_algorithms_noconf =
  4055.               GetProcAddress( hCRYPTO, "OPENSSL_add_all_algorithms_noconf" )) == NULL )
  4056.         {
  4057.             rc = GetLastError() ;
  4058.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4059.                    "OPENSSL_add_all_algorithms_noconf",rc);
  4060.         }
  4061.         if (((FARPROC) p_OPENSSL_add_all_algorithms_conf =
  4062.               GetProcAddress( hCRYPTO, "OPENSSL_add_all_algorithms_conf" )) == NULL )
  4063.         {
  4064.             rc = GetLastError() ;
  4065.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4066.                    "OPENSSL_add_all_algorithms_conf",rc);
  4067.         }
  4068.  
  4069.         if (((FARPROC) p_RSA_blinding_on =
  4070.               GetProcAddress( hCRYPTO, "RSA_blinding_on" )) == NULL )
  4071.         {
  4072.             rc = GetLastError() ;
  4073.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4074.                    "RSA_blinding_on",rc);
  4075.             load_error = 1;
  4076.         }
  4077.         if (((FARPROC) p_EVP_aes_256_cbc =
  4078.               GetProcAddress( hCRYPTO, "EVP_aes_256_cbc" )) == NULL )
  4079.         {
  4080.             rc = GetLastError() ;
  4081.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4082.                    "EVP_aes_256_cbc",rc);
  4083.         }
  4084.         if (((FARPROC) p_EVP_aes_192_cbc =
  4085.               GetProcAddress( hCRYPTO, "EVP_aes_192_cbc" )) == NULL )
  4086.         {
  4087.             rc = GetLastError() ;
  4088.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4089.                    "EVP_aes_192_cbc",rc);
  4090.         }
  4091.         if (((FARPROC) p_EVP_aes_128_cbc =
  4092.               GetProcAddress( hCRYPTO, "EVP_aes_128_cbc" )) == NULL )
  4093.         {
  4094.             rc = GetLastError() ;
  4095.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4096.                    "EVP_aes_128_cbc",rc);
  4097.         }
  4098.         if (((FARPROC) p_EVP_rc4 =
  4099.               GetProcAddress( hCRYPTO, "EVP_rc4" )) == NULL )
  4100.         {
  4101.             rc = GetLastError() ;
  4102.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4103.                    "EVP_rc4",rc);
  4104.             load_error = 1;
  4105.         }
  4106.         if (((FARPROC) p_EVP_cast5_cbc =
  4107.               GetProcAddress( hCRYPTO, "EVP_cast5_cbc" )) == NULL )
  4108.         {
  4109.             rc = GetLastError() ;
  4110.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4111.                    "EVP_cast5_cbc",rc);
  4112.             load_error = 1;
  4113.         }
  4114.         if (((FARPROC) p_EVP_bf_cbc =
  4115.               GetProcAddress( hCRYPTO, "EVP_bf_cbc" )) == NULL )
  4116.         {
  4117.             rc = GetLastError() ;
  4118.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4119.                    "EVP_bf_cbc",rc);
  4120.             load_error = 1;
  4121.         }
  4122.         if (((FARPROC) p_EVP_des_cbc =
  4123.               GetProcAddress( hCRYPTO, "EVP_des_cbc" )) == NULL )
  4124.         {
  4125.             rc = GetLastError() ;
  4126.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4127.                    "EVP_des_cbc",rc);
  4128.             load_error = 1;
  4129.         }
  4130.         if (((FARPROC) p_EVP_enc_null =
  4131.               GetProcAddress( hCRYPTO, "EVP_enc_null" )) == NULL )
  4132.         {
  4133.             rc = GetLastError() ;
  4134.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4135.                    "EVP_enc_null",rc);
  4136.             load_error = 1;
  4137.         }
  4138.         if (((FARPROC) p_EVP_CipherInit =
  4139.               GetProcAddress( hCRYPTO, "EVP_CipherInit" )) == NULL )
  4140.         {
  4141.             rc = GetLastError() ;
  4142.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4143.                    "EVP_CipherInit",rc);
  4144.             load_error = 1;
  4145.         }
  4146.         if (((FARPROC) p_EVP_CIPHER_CTX_init =
  4147.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_init" )) == NULL )
  4148.         {
  4149.             rc = GetLastError() ;
  4150.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4151.                    "EVP_CIPHER_CTX_init",rc);
  4152.             load_error = 1;
  4153.         }
  4154.         if (((FARPROC) p_EVP_CIPHER_CTX_cleanup =
  4155.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_cleanup" )) == NULL )
  4156.         {
  4157.             rc = GetLastError() ;
  4158.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4159.                    "EVP_CIPHER_CTX_cleanup",rc);
  4160.             load_error = 1;
  4161.         }
  4162.         if (((FARPROC) p_EVP_CIPHER_CTX_set_key_length =
  4163.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_set_key_length" )) == NULL )
  4164.         {
  4165.             rc = GetLastError() ;
  4166.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4167.                    "EVP_CIPHER_CTX_set_key_length",rc);
  4168.             load_error = 1;
  4169.         }
  4170.  
  4171.         if (((FARPROC) p_EVP_CIPHER_CTX_key_length =
  4172.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_key_length" )) == NULL )
  4173.         {
  4174.             rc = GetLastError() ;
  4175.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4176.                    "EVP_CIPHER_CTX_key_length",rc);
  4177.             load_error = 1;
  4178.         }
  4179.  
  4180.         if (((FARPROC) p_EVP_Cipher =
  4181.               GetProcAddress( hCRYPTO, "EVP_Cipher" )) == NULL )
  4182.         {
  4183.             rc = GetLastError() ;
  4184.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4185.                    "EVP_Cipher",rc);
  4186.             load_error = 1;
  4187.         }
  4188.  
  4189.         if (((FARPROC) p_EVP_CIPHER_CTX_iv_length =
  4190.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_iv_length" )) == NULL )
  4191.         {
  4192.             rc = GetLastError() ;
  4193.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4194.                    "EVP_CIPHER_CTX_iv_length",rc);
  4195.             load_error = 1;
  4196.         }
  4197.  
  4198.         if (((FARPROC) p_EVP_CIPHER_CTX_get_app_data =
  4199.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_get_app_data" )) == NULL )
  4200.         {
  4201.             rc = GetLastError() ;
  4202.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4203.                    "EVP_CIPHER_CTX_get_app_data",rc);
  4204.             load_error = 1;
  4205.         }
  4206.  
  4207.         if (((FARPROC) p_EVP_CIPHER_CTX_set_app_data =
  4208.               GetProcAddress( hCRYPTO, "EVP_CIPHER_CTX_set_app_data" )) == NULL )
  4209.         {
  4210.             rc = GetLastError() ;
  4211.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4212.                    "EVP_CIPHER_CTX_set_app_data",rc);
  4213.             load_error = 1;
  4214.         }
  4215.  
  4216.         if ( load_error ) {
  4217.             ck_crypto_loaddll_eh();
  4218.             return 0;
  4219.         }
  4220.     }
  4221.     if (((FARPROC) p_EVP_MD_size =
  4222.       GetProcAddress( hCRYPTO, "EVP_MD_size" )) == NULL )
  4223.     {
  4224.     rc = GetLastError() ;
  4225.     debug(F111,"OpenSSL SSL GetProcAddress failed",
  4226.            "EVP_MD_size",rc);
  4227.     }
  4228. #else /* NT */
  4229.     exe_path = GetLoadPath();
  4230.     sprintf(path, "%.*s%s.DLL", (int)get_dir_len(exe_path), exe_path,dllname);
  4231.     rc = DosLoadModule(errbuf, 256, path, &hCRYPTO);
  4232.     if (rc) {
  4233.         debug(F111, "OpenSSL LoadLibrary failed",path,rc) ;
  4234.         rc = DosLoadModule(errbuf, 256, dllname, &hCRYPTO);
  4235.     }
  4236.     if ( rc ) {
  4237.         debug(F111, "OpenSSL LoadLibrary failed",errbuf,rc) ;
  4238.         return(0);
  4239.     } else {
  4240.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ERR_print_errors",
  4241.                                   (PFN*) &p_ERR_print_errors) )
  4242.         {
  4243.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_print_errors",rc);
  4244.             load_error = 1;
  4245.         }
  4246.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ERR_print_errors_fp",
  4247.                                   (PFN*) &p_ERR_print_errors_fp) )
  4248.         {
  4249.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_print_errors_fp",rc);
  4250.             load_error = 1;
  4251.         }
  4252.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ERR_get_error",
  4253.                                   (PFN*) &p_ERR_get_error) )
  4254.         {
  4255.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_get_error",rc);
  4256.             load_error = 1;
  4257.         }
  4258.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ERR_error_string",
  4259.                                   (PFN*) &p_ERR_error_string) )
  4260.         {
  4261.             debug(F111,"OpenSSL Crypto GetProcAddress failed","ERR_error_string",rc);
  4262.             load_error = 1;
  4263.         }
  4264.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_printf",
  4265.                                   (PFN*) &p_BIO_printf) )
  4266.         {
  4267.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_printf",rc);
  4268.             load_error = 1;
  4269.         }
  4270.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_ctrl",
  4271.                                   (PFN*) &p_BIO_ctrl) )
  4272.         {
  4273.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_ctrl",rc);
  4274.             load_error = 1;
  4275.         }
  4276.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_new",
  4277.                                   (PFN*) &p_BIO_new) )
  4278.         {
  4279.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_new",rc);
  4280.             load_error = 1;
  4281.         }
  4282.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_s_file",
  4283.                                   (PFN*) &p_BIO_s_file) )
  4284.         {
  4285.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_file",rc);
  4286.             load_error = 1;
  4287.         }
  4288.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_s_mem",
  4289.                                   (PFN*) &p_BIO_s_mem) )
  4290.         {
  4291.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_mem",rc);
  4292.             load_error = 1;
  4293.         }
  4294.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_s_null",
  4295.                                   (PFN*) &p_BIO_s_null) )
  4296.         {
  4297.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_s_null",rc);
  4298.             load_error = 1;
  4299.         }
  4300.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_read",
  4301.                                   (PFN*) &p_BIO_read) )
  4302.         {
  4303.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_read",rc);
  4304.             load_error = 1;
  4305.         }
  4306.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_write",
  4307.                                   (PFN*) &p_BIO_write) )
  4308.         {
  4309.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_write",rc);
  4310.             load_error = 1;
  4311.         }
  4312.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_free",
  4313.                                   (PFN*) &p_BIO_free) )
  4314.         {
  4315.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_free",rc);
  4316.             load_error = 1;
  4317.         }
  4318.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_free_all",
  4319.                                   (PFN*) &p_BIO_free_all) )
  4320.         {
  4321.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_free_all",rc);
  4322.             load_error = 1;
  4323.         }
  4324.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BIO_new_file",
  4325.                                   (PFN*) &p_BIO_new_file) )
  4326.         {
  4327.             debug(F111,"OpenSSL Crypto GetProcAddress failed","BIO_new_file",rc);
  4328.             load_error = 1;
  4329.         }
  4330.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_issuer_name",
  4331.                                   (PFN*) &p_X509_get_issuer_name) )
  4332.         {
  4333.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_issuer_name",rc);
  4334.             load_error = 1;
  4335.         }
  4336.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_print_ex",
  4337.                                   (PFN*) &p_X509_print_ex) )
  4338.         {
  4339.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_print_ex",rc);
  4340.         }
  4341.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_verify_cert_error_string",
  4342.                                   (PFN*) &p_X509_verify_cert_error_string) )
  4343.         {
  4344.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_verify_cert_error_string",rc);
  4345.             load_error = 1;
  4346.         }
  4347.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_NAME_oneline",
  4348.                                   (PFN*) &p_X509_NAME_oneline) )
  4349.         {
  4350.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_oneline",rc);
  4351.             load_error = 1;
  4352.         }
  4353.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_NAME_print_ex",
  4354.                                   (PFN*) &p_X509_NAME_print_ex) )
  4355.         {
  4356.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_print_ex",rc);
  4357.             load_error = 1;
  4358.         }
  4359.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_NAME_get_text_by_NID",
  4360.                                   (PFN*) &p_X509_NAME_get_text_by_NID) )
  4361.         {
  4362.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_NAME_get_text_by_NID",rc);
  4363.             load_error = 1;
  4364.         }
  4365.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_subject_name",
  4366.                                   (PFN*) &p_X509_get_subject_name) )
  4367.         {
  4368.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_subject_name",rc);
  4369.             load_error = 1;
  4370.         }
  4371.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_new",
  4372.                                   (PFN*) &p_X509_STORE_CTX_new) )
  4373.         {
  4374.             /* New to 0.9.5 */
  4375.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4376.                    "X509_STORE_CTX_new",rc);
  4377.         }
  4378.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_free",
  4379.                                   (PFN*) &p_X509_STORE_CTX_free) )
  4380.         {
  4381.             /* New to 0.9.5 */
  4382.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4383.                    "X509_STORE_CTX_free",rc);
  4384.         }
  4385.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_get_current_cert",
  4386.                                   (PFN*) &p_X509_STORE_CTX_get_current_cert) )
  4387.         {
  4388.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4389.                    "X509_STORE_CTX_get_current_cert",rc);
  4390.             load_error = 1;
  4391.         }
  4392.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_get_error",
  4393.                                   (PFN*) &p_X509_STORE_CTX_get_error) )
  4394.         {
  4395.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4396.                    "X509_STORE_CTX_get_error",rc);
  4397.             load_error = 1;
  4398.         }
  4399.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_get_error_depth",
  4400.                                   (PFN*) &p_X509_STORE_CTX_get_error_depth) )
  4401.         {
  4402.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4403.                    "X509_STORE_CTX_get_error_depth",rc);
  4404.             load_error = 1;
  4405.         }
  4406.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_free",
  4407.                                   (PFN*) &p_X509_free) )
  4408.         {
  4409.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_free",rc);
  4410.             load_error = 1;
  4411.         }
  4412.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_default_cert_dir",
  4413.                                   (PFN*) &p_X509_get_default_cert_dir) )
  4414.         {
  4415.             debug(F111,"OpenSSL Crypto GetProcAddress failed","X509_get_default_cert_dir",rc);
  4416.             load_error = 1;
  4417.         }
  4418.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "RSA_free",
  4419.                                   (PFN*) &p_RSA_free) )
  4420.         {
  4421.             debug(F111,"OpenSSL Crypto GetProcAddress failed","RSA_free",rc);
  4422.         }
  4423.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "RSA_generate_key",
  4424.                                   (PFN*) &p_RSA_generate_key) )
  4425.         {
  4426.             debug(F111,"OpenSSL Crypto GetProcAddress failed","RSA_generate_key",rc);
  4427.         }
  4428.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DH_new",
  4429.                                   (PFN*) &p_DH_new) )
  4430.         {
  4431.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_new",rc);
  4432.             load_error = 1;
  4433.         }
  4434.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DH_free",
  4435.                                   (PFN*) &p_DH_free) )
  4436.         {
  4437.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_free",rc);
  4438.             load_error = 1;
  4439.         }
  4440.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DH_generate_parameters",
  4441.                                   (PFN*) &p_DH_generate_parameters) )
  4442.         {
  4443.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_generate_parameters",rc);
  4444.             load_error = 1;
  4445.         }
  4446.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DH_generate_key",
  4447.                                   (PFN*) &p_DH_generate_key) )
  4448.         {
  4449.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DH_generate_key",rc);
  4450.             load_error = 1;
  4451.         }
  4452.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DSA_free",
  4453.                                   (PFN*) &p_DSA_free) )
  4454.         {
  4455.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_free",rc);
  4456.             load_error = 1;
  4457.         }
  4458.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DSA_generate_parameters",
  4459.                                   (PFN*) &p_DSA_generate_parameters) )
  4460.         {
  4461.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_generate_parameters",rc);
  4462.             load_error = 1;
  4463.         }
  4464.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "DSA_generate_key",
  4465.                                   (PFN*) &p_DSA_generate_key) )
  4466.         {
  4467.             debug(F111,"OpenSSL Crypto GetProcAddress failed","DSA_generate_key",rc);
  4468.             load_error = 1;
  4469.         }
  4470.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "d2i_DHparams",
  4471.                                   (PFN*) &p_d2i_DHparams) )
  4472.         {
  4473.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4474.                    "d2i_DHparams",rc);
  4475.             load_error = 1;
  4476.         }
  4477.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "PEM_ASN1_read_bio",
  4478.                                   (PFN*) &p_PEM_ASN1_read_bio) )
  4479.         {
  4480.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4481.                    "PEM_ASN1_read_bio",rc);
  4482.             load_error = 1;
  4483.         }
  4484.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "BN_bin2bn",
  4485.                                   (PFN*) &p_BN_bin2bn) )
  4486.         {
  4487.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4488.                    "BN_bin2bn",rc);
  4489.             load_error = 1;
  4490.         }
  4491.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ASN1_TIME_print",
  4492.                                   (PFN*) &p_ASN1_TIME_print) )
  4493.         {
  4494.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4495.                    "ASN1_TIME_print",rc);
  4496.             load_error = 1;
  4497.         }
  4498.  
  4499.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "sk_GENERAL_NAME_free",
  4500.                                   (PFN*) &p_sk_GENERAL_NAME_free) )
  4501.         {
  4502.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4503.                    "sk_GENERAL_NAME_free",rc);
  4504.             load_error = 1;
  4505.         }
  4506.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509V3_EXT_cleanup",
  4507.                                   (PFN*) &p_X509V3_EXT_cleanup) )
  4508.         {
  4509.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4510.                    "X509V3_EXT_cleanup",rc);
  4511.             load_error = 1;
  4512.         }
  4513.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "sk_GENERAL_NAME_value",
  4514.                                   (PFN*) &p_sk_GENERAL_NAME_value) )
  4515.         {
  4516.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4517.                    "sk_GENERAL_NAME_value",rc);
  4518.             load_error = 1;
  4519.         }
  4520.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "sk_GENERAL_NAME_num",
  4521.                                   (PFN*) &p_sk_GENERAL_NAME_num) )
  4522.         {
  4523.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4524.                    "sk_GENERAL_NAME_num",rc);
  4525.             load_error = 1;
  4526.         }
  4527.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509V3_EXT_d2i",
  4528.                                   (PFN*) &p_X509V3_EXT_d2i) )
  4529.         {
  4530.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4531.                    "X509V3_EXT_d2i",rc);
  4532.             load_error = 1;
  4533.         }
  4534.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509V3_add_standard_extensions",
  4535.                                   (PFN*) &p_X509V3_add_standard_extensions) )
  4536.         {
  4537.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4538.                    "X509V3_add_standard_extensions",rc);
  4539.             load_error = 1;
  4540.         }
  4541.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_ext",
  4542.                                   (PFN*) &p_X509_get_ext) )
  4543.         {
  4544.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4545.                    "X509_get_ext",rc);
  4546.             load_error = 1;
  4547.         }
  4548.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_ext_by_NID",
  4549.                                   (PFN*) &p_X509_get_ext_by_NID) )
  4550.         {
  4551.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4552.                    "X509_get_ext_by_NID",rc);
  4553.             load_error = 1;
  4554.         }
  4555.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ASN1_INTEGER_get",
  4556.                                   (PFN*) &p_ASN1_INTEGER_get) )
  4557.         {
  4558.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4559.                    "ASN1_INTEGER_get",rc);
  4560.             load_error = 1;
  4561.         }
  4562.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ASN1_INTEGER_cmp",
  4563.                                   (PFN*) &p_ASN1_INTEGER_cmp) )
  4564.         {
  4565.             /* New to OpenSSL 0.9.5 */
  4566.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4567.                    "ASN1_INTEGER_cmp",rc);
  4568.         }
  4569.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "ASN1_STRING_cmp",
  4570.                                   (PFN*) &p_ASN1_STRING_cmp) )
  4571.         {
  4572.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4573.                    "ASN1_STRING_cmp",rc);
  4574.             load_error = 1;
  4575.         }
  4576.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_serialNumber",
  4577.                                   (PFN*) &p_X509_get_serialNumber) )
  4578.         {
  4579.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4580.                    "X509_get_serialNumber",rc);
  4581.             load_error = 1;
  4582.         }
  4583.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "sk_X509_REVOKED_value",
  4584.                                   (PFN*) &p_sk_X509_REVOKED_value) )
  4585.         {
  4586.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4587.                    "sk_X509_REVOKED_value",rc);
  4588.             load_error = 1;
  4589.         }
  4590.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "sk_X509_REVOKED_num",
  4591.                                   (PFN*) &p_sk_X509_REVOKED_num) )
  4592.         {
  4593.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4594.                    "sk_X509_REVOKED_num",rc);
  4595.             load_error = 1;
  4596.         }
  4597.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_cmp_current_time",
  4598.                                   (PFN*) &p_X509_cmp_current_time) )
  4599.         {
  4600.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4601.                    "X509_cmp_current_time",rc);
  4602.             load_error = 1;
  4603.         }
  4604.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_OBJECT_free_contents",
  4605.                                   (PFN*) &p_X509_OBJECT_free_contents) )
  4606.         {
  4607.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4608.                    "X509_OBJECT_free_contents",rc);
  4609.             load_error = 1;
  4610.         }
  4611.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_set_error",
  4612.                                   (PFN*) &p_X509_STORE_CTX_set_error) )
  4613.         {
  4614.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4615.                    "X509_STORE_CTX_set_error",rc);
  4616.             load_error = 1;
  4617.         }
  4618.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_CRL_verify",
  4619.                                   (PFN*) &p_X509_CRL_verify) )
  4620.         {
  4621.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4622.                    "X509_CRL_verify",rc);
  4623.             load_error = 1;
  4624.         }
  4625.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_get_pubkey",
  4626.                                   (PFN*) &p_X509_get_pubkey) )
  4627.         {
  4628.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4629.                    "X509_get_pubkey",rc);
  4630.             load_error = 1;
  4631.         }
  4632.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_cleanup",
  4633.                                   (PFN*) &p_X509_STORE_CTX_cleanup) )
  4634.         {
  4635.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4636.                    "X509_STORE_CTX_cleanup",rc);
  4637.             load_error = 1;
  4638.         }
  4639.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_get_by_subject",
  4640.                                   (PFN*) &p_X509_STORE_get_by_subject) )
  4641.         {
  4642.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4643.                    "X509_STORE_get_by_subject",rc);
  4644.             load_error = 1;
  4645.         }
  4646.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_CTX_init",
  4647.                                   (PFN*) &p_X509_STORE_CTX_init) )
  4648.         {
  4649.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4650.                    "X509_STORE_CTX_init",rc);
  4651.             load_error = 1;
  4652.         }
  4653.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "PEM_read_X509",
  4654.                                   (PFN*) &p_PEM_read_X509) )
  4655.         {
  4656.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4657.                    "PEM_read_X509",rc);
  4658.             load_error = 1;
  4659.         }
  4660.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_LOOKUP_hash_dir",
  4661.                                   (PFN*) &p_X509_LOOKUP_hash_dir) )
  4662.         {
  4663.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4664.                    "X509_LOOKUP_hash_dir",rc);
  4665.             load_error = 1;
  4666.         }
  4667.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_LOOKUP_ctrl",
  4668.                                   (PFN*) &p_X509_LOOKUP_ctrl) )
  4669.         {
  4670.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4671.                    "X509_LOOKUP_ctrl",rc);
  4672.             load_error = 1;
  4673.         }
  4674.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_add_lookup",
  4675.                                   (PFN*) &p_X509_STORE_add_lookup) )
  4676.         {
  4677.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4678.                    "X509_STORE_add_lookup",rc);
  4679.             load_error = 1;
  4680.         }
  4681.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_LOOKUP_file",
  4682.                                   (PFN*) &p_X509_LOOKUP_file) )
  4683.         {
  4684.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4685.                    "X509_LOOKUP_file",rc);
  4686.             load_error = 1;
  4687.         }
  4688.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_new",
  4689.                                   (PFN*) &p_X509_STORE_new) )
  4690.         {
  4691.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4692.                    "X509_STORE_new",rc);
  4693.             load_error = 1;
  4694.         }
  4695.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_free",
  4696.                                   (PFN*) &p_X509_STORE_free) )
  4697.         {
  4698.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4699.                    "X509_STORE_free",rc);
  4700.             load_error = 1;
  4701.         }
  4702.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_load_locations",
  4703.                                   (PFN*) &p_X509_STORE_load_locations) )
  4704.         {
  4705.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4706.                    "X509_STORE_load_locations",rc);
  4707.             load_error = 1;
  4708.         }
  4709.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_STORE_set_default_paths",
  4710.                                   (PFN*) &p_X509_STORE_set_default_paths) )
  4711.         {
  4712.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4713.                    "X509_STORE_set_default_paths",rc);
  4714.             load_error = 1;
  4715.         }
  4716.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_subject_name_hash",
  4717.                                   (PFN*) &p_X509_subject_name_hash) )
  4718.         {
  4719.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4720.                    "X509_subject_name_hash",rc);
  4721.             load_error = 1;
  4722.         }
  4723.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "X509_issuer_name_hash",
  4724.                                   (PFN*) &p_X509_issuer_name_hash) )
  4725.         {
  4726.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4727.                    "X509_issuer_name_hash",rc);
  4728.             load_error = 1;
  4729.         }
  4730.         if (rc = DosQueryProcAddr( hCRYPTO, 0, "CRYPTO_set_mem_functions",
  4731.                                   (PFN*) &p_CRYPTO_set_mem_functions) )
  4732.         {
  4733.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4734.                    "CRYPTO_set_mem_functions",rc);
  4735.             load_error = 1;
  4736.         }
  4737.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4738.                                   "CRYPTO_set_locking_callback",
  4739.                                   (PFN*) &p_CRYPTO_set_locking_callback) )
  4740.         {
  4741.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4742.                    "CRYPTO_set_locking_callback",rc);
  4743.             load_error = 1;
  4744.         }
  4745.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4746.                                   "CRYPTO_set_dynlock_create_callback",
  4747.                                   (PFN*) &p_CRYPTO_set_dynlock_create_callback) )
  4748.         {
  4749.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4750.                    "CRYPTO_set_dynlock_create_callback",rc);
  4751.             load_error = 1;
  4752.         }
  4753.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4754.                                   "CRYPTO_set_dynlock_lock_callback",
  4755.                                   (PFN*) &p_CRYPTO_set_dynlock_lock_callback) )
  4756.         {
  4757.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4758.                    "CRYPTO_set_dynlock_lock_callback",rc);
  4759.             load_error = 1;
  4760.         }
  4761.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4762.                                   "CRYPTO_set_dynlock_destroy_callback",
  4763.                                   (PFN*) &p_CRYPTO_set_dynlock_destroy_callback) )
  4764.         {
  4765.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4766.                    "CRYPTO_set_dynlock_destroy_callback",rc);
  4767.             load_error = 1;
  4768.         }
  4769.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4770.                                   "CRYPTO_num_locks",
  4771.                                   (PFN*) &p_CRYPTO_num_locks) )
  4772.         {
  4773.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4774.                    "CRYPTO_num_locks",rc);
  4775.         }
  4776.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4777.                                   "RAND_screen",
  4778.                                   (PFN*) &p_RAND_screen) )
  4779.         {
  4780.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4781.                    "RAND_screen",rc);
  4782.         }
  4783.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4784.                                   "RAND_status",
  4785.                                   (PFN*) &p_RAND_status) )
  4786.         {
  4787.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4788.                    "RAND_status",rc);
  4789.         }
  4790.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4791.                                   "RAND_file_name",
  4792.                                   (PFN*) &p_RAND_file_name) )
  4793.         {
  4794.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4795.                    "RAND_file_name",rc);
  4796.         }
  4797.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4798.                                   "RAND_egd",
  4799.                                   (PFN*) &p_RAND_egd) )
  4800.         {
  4801.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4802.                    "RAND_egd",rc);
  4803.         }
  4804.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4805.                                   "RAND_load_file",
  4806.                                   (PFN*) &p_RAND_load_file) )
  4807.         {
  4808.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4809.                    "RAND_load_file",rc);
  4810.         }
  4811.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4812.                                   "RAND_write_file",
  4813.                                   (PFN*) &p_RAND_write_file) )
  4814.         {
  4815.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4816.                    "RAND_write_file",rc);
  4817.         }
  4818.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4819.                                   "RAND_seed",
  4820.                                   (PFN*) &p_RAND_seed) )
  4821.         {
  4822.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4823.                    "RAND_seed",rc);
  4824.         }
  4825.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4826.                                   "sk_num",
  4827.                                   (PFN*) &p_sk_num) )
  4828.         {
  4829.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4830.                    "sk_num",rc);
  4831.         }
  4832.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4833.                                   "sk_value",
  4834.                                   (PFN*) &p_sk_value) )
  4835.         {
  4836.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4837.                    "sk_value",rc);
  4838.         }
  4839.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4840.                                   "sk_free",
  4841.                                   (PFN*) &p_sk_free) )
  4842.         {
  4843.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4844.                    "sk_free",rc);
  4845.         }
  4846. #ifdef ZLIB
  4847.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4848.                                   "COMP_zlib",
  4849.                                   (PFN*) &p_COMP_zlib) )
  4850.         {
  4851.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4852.                    "COMP_zlib",rc);
  4853.         }
  4854. #endif /* ZLIB */
  4855.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4856.                                   "COMP_rle",
  4857.                                   (PFN*) &p_COMP_rle) )
  4858.         {
  4859.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4860.                    "COMP_rle",rc);
  4861.         }
  4862.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4863.                                   "ERR_peek_error",
  4864.                                   (PFN*) &p_ERR_peek_error) )
  4865.         {
  4866.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4867.                    "ERR_peek_error",rc);
  4868.         }
  4869.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4870.                                   "sk_pop_free",
  4871.                                   (PFN*) &p_sk_pop_free) )
  4872.         {
  4873.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4874.                    "sk_pop_free",rc);
  4875.         }
  4876.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4877.                                   "PEM_read_bio_X509",
  4878.                                   (PFN*) &p_PEM_read_bio_X509) )
  4879.         {
  4880.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4881.                    "PEM_read_bio_X509",rc);
  4882.         }
  4883.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4884.                                   "SSLeay",
  4885.                                   (PFN*) &p_SSLeay) )
  4886.         {
  4887.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4888.                    "SSLeay",rc);
  4889.             load_error = 1;
  4890.         }
  4891.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4892.                                   "SSLeay_version",
  4893.                                   (PFN*) &p_SSLeay_version) )
  4894.         {
  4895.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4896.                    "SSLeay_version",rc);
  4897.             load_error = 1;
  4898.         }
  4899.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4900.                                   "X509_get_default_cert_dir_env",
  4901.                                   (PFN*) &p_X509_get_default_cert_dir_env) )
  4902.         {
  4903.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4904.                    "X509_get_default_cert_dir_env",rc);
  4905.         }
  4906.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4907.                                   "X509_get_default_cert_file_env",
  4908.                                   (PFN*) &p_X509_get_default_cert_file_env) )
  4909.         {
  4910.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4911.                    "X509_get_default_cert_file_env",rc);
  4912.         }
  4913.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4914.                                   "OpenSSL_add_all_ciphers",
  4915.                                   (PFN*) &p_OpenSSL_add_all_ciphers) )
  4916.         {
  4917.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4918.                    "OpenSSL_add_all_ciphers",rc);
  4919.         }
  4920.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4921.                                   "OpenSSL_add_all_digests",
  4922.                                   (PFN*) &p_OpenSSL_add_all_digests) )
  4923.         {
  4924.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4925.                    "OpenSSL_add_all_digests",rc);
  4926.         }
  4927.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4928.                                   "OPENSSL_add_all_algorithms_noconf",
  4929.                                   (PFN*) &p_OPENSSL_add_all_algorithms_noconf) )
  4930.         {
  4931.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4932.                    "OPENSSL_add_all_algorithms_noconf",rc);
  4933.         }
  4934.         if (rc = DosQueryProcAddr( hCRYPTO, 0,
  4935.                                   "OPENSSL_add_all_algorithms_conf",
  4936.                                   (PFN*) &p_OPENSSL_add_all_algorithms_conf) )
  4937.         {
  4938.             debug(F111,"OpenSSL Crypto GetProcAddress failed",
  4939.                    "OPENSSL_add_all_algorithms_conf",rc);
  4940.         }
  4941.  
  4942.         if ( load_error ) {
  4943.             ck_crypto_loaddll_eh();
  4944.             return 0;
  4945.         }
  4946.     }
  4947. #endif /* NT */
  4948.  
  4949.     crypto_dll_loaded = 1;
  4950.     if ( deblog ) {
  4951.         printf("OpenSSL Crypto DLL Loaded\n");
  4952.         debug(F100,"OpenSSL Crypto DLL Loaded","",0);
  4953.     }
  4954.  
  4955.     /* Initialize memory allocation functions so */
  4956.     /* we do not have RTL incompatibilities      */
  4957.     CRYPTO_set_mem_functions(malloc,realloc,free);
  4958.  
  4959.     /* Initialize multithread support */
  4960.     {
  4961.         int i,n;
  4962.  
  4963.         n = CRYPTO_num_locks();
  4964.  
  4965. #ifdef NT
  4966.         lock_cs = malloc(n * sizeof(HANDLE));
  4967. #else
  4968.         lock_cs = malloc(n * sizeof(HMTX));
  4969. #endif
  4970.         if (lock_cs == NULL)
  4971.             fatal("Unable to malloc memory for CRYPTO_num_locks\n");
  4972.  
  4973.         for (i=0; i<n; i++) {
  4974. #ifdef NT
  4975.             lock_cs[i]=CreateMutex(NULL,FALSE,NULL);
  4976. #else
  4977.             DosCreateMutexSem( NULL, &lock_cs[i], 0, FALSE );
  4978. #endif
  4979.         }
  4980.  
  4981. #ifdef NT
  4982.         CRYPTO_set_locking_callback(win32_locking_callback);
  4983.     CRYPTO_set_dynlock_create_callback(win32_dynlock_create_callback);
  4984.     CRYPTO_set_dynlock_lock_callback(win32_dynlock_lock_callback);
  4985.     CRYPTO_set_dynlock_destroy_callback(win32_dynlock_destroy_callback);
  4986. #else
  4987.         CRYPTO_set_locking_callback((void (*)(int,int,char *,int))os2_locking_callback);
  4988.     CRYPTO_set_dynlock_create_callback(os2_dynlock_create_callback);
  4989.     CRYPTO_set_dynlock_lock_callback(os2_dynlock_lock_callback);
  4990.     CRYPTO_set_dynlock_destroy_callback(os2_dynlock_destroy_callback);
  4991. #endif
  4992.         /* id callback defined */
  4993.     }
  4994.  
  4995.     /* initialize PRNG */
  4996.     RAND_screen();
  4997.     return(1);
  4998. }
  4999.  
  5000. int
  5001. ck_crypto_unloaddll( void )
  5002. {
  5003.     if ( !crypto_dll_loaded )
  5004.         return(1);
  5005.  
  5006.     /* Clean up Semaphores */
  5007.     {
  5008.         int i,n;
  5009.  
  5010.         n = CRYPTO_num_locks();
  5011.  
  5012.     CRYPTO_set_dynlock_create_callback(NULL);
  5013.     CRYPTO_set_dynlock_lock_callback(NULL);
  5014.     CRYPTO_set_dynlock_destroy_callback(NULL);
  5015.         CRYPTO_set_locking_callback(NULL);
  5016.         for (i=0; i<n; i++) {
  5017. #ifdef NT
  5018.             CloseHandle(lock_cs[i]);
  5019. #else
  5020.             DosCloseMutexSem(lock_cs[i]);
  5021. #endif
  5022.         }
  5023.         free(lock_cs);
  5024.         lock_cs = 0;
  5025.     }
  5026.  
  5027.     /* unload dlls */
  5028.     ck_crypto_loaddll_eh();
  5029.  
  5030.     /* success */
  5031.     crypto_dll_loaded = 0;
  5032.     return(1);
  5033. }
  5034. #endif /* SSLDLL */
  5035. #endif /* CK_SSL */
  5036.  
  5037. #undef malloc
  5038. #undef realloc
  5039. #undef free
  5040. #undef strdup
  5041.  
  5042. #ifdef NOT_KERMIT
  5043. static void
  5044. fatal(char *msg) {
  5045.     if (!msg) msg = "";
  5046.  
  5047.     printf(msg);
  5048.     exit(1);        /* Exit indicating failure */
  5049. }
  5050. #endif /* NOT_KERMIT */
  5051.  
  5052. void *
  5053. kmalloc(size_t size)
  5054. {
  5055.     void *ptr;
  5056.  
  5057.     if (size == 0) {
  5058.         fatal("kmalloc: zero size");
  5059.     }
  5060.     ptr = malloc(size);
  5061.     if (ptr == NULL) {
  5062.         fatal("kmalloc: out of memory");
  5063.     }
  5064.     return ptr;
  5065. }
  5066.  
  5067. void *
  5068. krealloc(void *ptr, size_t new_size)
  5069. {
  5070.     void *new_ptr;
  5071.  
  5072.     if (new_size == 0) {
  5073.         fatal("krealloc: zero size");
  5074.     }
  5075.     if (ptr == NULL)
  5076.         new_ptr = malloc(new_size);
  5077.     else
  5078.         new_ptr = realloc(ptr, new_size);
  5079.     if (new_ptr == NULL) {
  5080.         fatal("krealloc: out of memory");
  5081.     }
  5082.     return new_ptr;
  5083. }
  5084.  
  5085. void
  5086. kfree(void *ptr)
  5087. {
  5088.     if (ptr == NULL) {
  5089.         printf("kfree: NULL pointer given as argument");
  5090.         return;
  5091.     }
  5092.     free(ptr);
  5093. }
  5094.  
  5095. char *
  5096. kstrdup(const char *str)
  5097. {
  5098.     size_t len;
  5099.     char *cp;
  5100.  
  5101.     if (str == NULL) {
  5102.         fatal("kstrdup: NULL pointer given as argument");
  5103.     }
  5104.     len = strlen(str) + 1;
  5105.     cp = kmalloc(len);
  5106.     if (cp)
  5107.         memcpy(cp, str, len);
  5108.     return cp;
  5109. }
  5110.  
  5111. #endif /* OS2 */
  5112.