00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef HAVE_CONFIG_H
00020 #include <config.h>
00021 #endif
00022
00023 #ifdef KSSL_HAVE_SSL
00024 #include <openssl/opensslv.h>
00025 #endif
00026
00027 #include <kdebug.h>
00028 #include <kconfig.h>
00029 #include <kstaticdeleter.h>
00030 #include <qregexp.h>
00031
00032
00033 #include <stdio.h>
00034 #include <unistd.h>
00035 #include "kopenssl.h"
00036
00037 extern "C" {
00038 #ifdef KSSL_HAVE_SSL
00039 static int (*K_SSL_connect) (SSL *) = 0L;
00040 static int (*K_SSL_accept) (SSL *) = 0L;
00041 static int (*K_SSL_read) (SSL *, void *, int) = 0L;
00042 static int (*K_SSL_write) (SSL *, const void *, int) = 0L;
00043 static SSL *(*K_SSL_new) (SSL_CTX *) = 0L;
00044 static void (*K_SSL_free) (SSL *) = 0L;
00045 static int (*K_SSL_shutdown) (SSL *) = 0L;
00046 static SSL_CTX *(*K_SSL_CTX_new)(SSL_METHOD *) = 0L;
00047 static void (*K_SSL_CTX_free) (SSL_CTX *) = 0L;
00048 static int (*K_SSL_set_fd) (SSL *, int) = 0L;
00049 static int (*K_SSL_pending) (SSL *) = 0L;
00050 static int (*K_SSL_peek) (SSL *, void *, int) = 0L;
00051 static int (*K_SSL_CTX_set_cipher_list)(SSL_CTX *, const char *) = 0L;
00052 static void (*K_SSL_CTX_set_verify)(SSL_CTX *, int,
00053 int (*)(int, X509_STORE_CTX *)) = 0L;
00054 static int (*K_SSL_use_certificate)(SSL *, X509 *) = 0L;
00055 static SSL_CIPHER *(*K_SSL_get_current_cipher)(SSL *) = 0L;
00056 static long (*K_SSL_ctrl) (SSL *,int, long, char *) = 0L;
00057 static int (*K_RAND_egd) (const char *) = 0L;
00058 static const char* (*K_RAND_file_name) (char *, size_t) = 0L;
00059 static int (*K_RAND_load_file) (const char *, long) = 0L;
00060 static int (*K_RAND_write_file) (const char *) = 0L;
00061 static SSL_METHOD * (*K_TLSv1_client_method) () = 0L;
00062 static SSL_METHOD * (*K_SSLv2_client_method) () = 0L;
00063 static SSL_METHOD * (*K_SSLv3_client_method) () = 0L;
00064 static SSL_METHOD * (*K_SSLv23_client_method) () = 0L;
00065 static X509 * (*K_SSL_get_peer_certificate) (SSL *) = 0L;
00066 static int (*K_SSL_CIPHER_get_bits) (SSL_CIPHER *,int *) = 0L;
00067 static char * (*K_SSL_CIPHER_get_version) (SSL_CIPHER *) = 0L;
00068 static const char * (*K_SSL_CIPHER_get_name) (SSL_CIPHER *) = 0L;
00069 static char * (*K_SSL_CIPHER_description) (SSL_CIPHER *, char *, int) = 0L;
00070 static X509 * (*K_d2i_X509) (X509 **,unsigned char **,long) = 0L;
00071 static int (*K_i2d_X509) (X509 *,unsigned char **) = 0L;
00072 static int (*K_X509_cmp) (X509 *, X509 *) = 0L;
00073 static void (*K_X509_STORE_CTX_free) (X509_STORE_CTX *) = 0L;
00074 static int (*K_X509_verify_cert) (X509_STORE_CTX *) = 0L;
00075 static X509_STORE_CTX *(*K_X509_STORE_CTX_new) (void) = 0L;
00076 static void (*K_X509_STORE_free) (X509_STORE *) = 0L;
00077 static X509_STORE *(*K_X509_STORE_new) (void) = 0L;
00078 static void (*K_X509_free) (X509 *) = 0L;
00079 static char *(*K_X509_NAME_oneline) (X509_NAME *,char *,int) = 0L;
00080 static X509_NAME *(*K_X509_get_subject_name) (X509 *) = 0L;
00081 static X509_NAME *(*K_X509_get_issuer_name) (X509 *) = 0L;
00082 static X509_LOOKUP *(*K_X509_STORE_add_lookup) (X509_STORE *, X509_LOOKUP_METHOD *) = 0L;
00083 static X509_LOOKUP_METHOD *(*K_X509_LOOKUP_file)(void) = 0L;
00084 static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = 0L;
00085 static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int, const char *, long, char **) = 0L;
00086 static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *) = 0L;
00087 static void (*K_CRYPTO_free) (void *) = 0L;
00088 static X509* (*K_X509_dup) (X509 *) = 0L;
00089 static BIO_METHOD *(*K_BIO_s_mem) (void) = 0L;
00090 static BIO* (*K_BIO_new) (BIO_METHOD *) = 0L;
00091 static BIO* (*K_BIO_new_fp) (FILE *, int) = 0L;
00092 static BIO* (*K_BIO_new_mem_buf) (void *, int) = 0L;
00093 static int (*K_BIO_free) (BIO *) = 0L;
00094 static long (*K_BIO_ctrl) (BIO *,int,long,void *) = 0L;
00095 static int (*K_BIO_write) (BIO *b, const void *data, int len) = 0L;
00096 static int (*K_PEM_ASN1_write_bio) (int (*)(),const char *,BIO *,char *,
00097 const EVP_CIPHER *,unsigned char *,int ,
00098 pem_password_cb *, void *) = 0L;
00099 static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
00100 static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,unsigned char *) = 0L;
00101 static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *, unsigned char **) = 0L;
00102 static int (*K_X509_print_fp) (FILE *, X509*) = 0L;
00103 static int (*K_i2d_PKCS12) (PKCS12*, unsigned char**) = 0L;
00104 static int (*K_i2d_PKCS12_fp) (FILE *, PKCS12*) = 0L;
00105 static int (*K_PKCS12_newpass) (PKCS12*, char*, char*) = 0L;
00106 static PKCS12* (*K_d2i_PKCS12_fp) (FILE*, PKCS12**) = 0L;
00107 static PKCS12* (*K_PKCS12_new) (void) = 0L;
00108 static void (*K_PKCS12_free) (PKCS12 *) = 0L;
00109 static int (*K_PKCS12_parse) (PKCS12*, const char *, EVP_PKEY**,
00110 X509**, STACK_OF(X509)**) = 0L;
00111 static void (*K_EVP_PKEY_free) (EVP_PKEY *) = 0L;
00112 static EVP_PKEY* (*K_EVP_PKEY_new) () = 0L;
00113 static void (*K_X509_REQ_free) (X509_REQ *) = 0L;
00114 static X509_REQ* (*K_X509_REQ_new) () = 0L;
00115 static int (*K_SSL_CTX_use_PrivateKey) (SSL_CTX*, EVP_PKEY*) = 0L;
00116 static int (*K_SSL_CTX_use_certificate) (SSL_CTX*, X509*) = 0L;
00117 static int (*K_SSL_get_error) (SSL*, int) = 0L;
00118 static STACK_OF(X509)* (*K_SSL_get_peer_cert_chain) (SSL*) = 0L;
00119 static void (*K_X509_STORE_CTX_set_chain) (X509_STORE_CTX *, STACK_OF(X509)*) = 0L;
00120 static void (*K_X509_STORE_CTX_set_purpose) (X509_STORE_CTX *, int) = 0L;
00121 static void (*K_sk_free) (STACK*) = 0L;
00122 static int (*K_sk_num) (STACK*) = 0L;
00123 static char* (*K_sk_pop) (STACK*) = 0L;
00124 static char* (*K_sk_value) (STACK*, int) = 0L;
00125 static STACK* (*K_sk_new) (int (*)()) = 0L;
00126 static int (*K_sk_push) (STACK*, char*) = 0L;
00127 static STACK* (*K_sk_dup) (STACK *) = 0L;
00128 static char * (*K_i2s_ASN1_INTEGER) (X509V3_EXT_METHOD *, ASN1_INTEGER *) =0L;
00129 static ASN1_INTEGER * (*K_X509_get_serialNumber) (X509 *) = 0L;
00130 static EVP_PKEY *(*K_X509_get_pubkey)(X509 *) = 0L;
00131 static int (*K_i2d_PublicKey)(EVP_PKEY *, unsigned char **) = 0L;
00132 static int (*K_X509_check_private_key)(X509 *, EVP_PKEY *) = 0L;
00133 static char * (*K_BN_bn2hex)(const BIGNUM *) = 0L;
00134 static int (*K_X509_digest)(const X509 *,const EVP_MD *, unsigned char *, unsigned int *) = 0L;
00135 static EVP_MD* (*K_EVP_md5)() = 0L;
00136 static void (*K_ASN1_INTEGER_free)(ASN1_INTEGER *) = 0L;
00137 static int (*K_OBJ_obj2nid)(ASN1_OBJECT *) = 0L;
00138 static const char * (*K_OBJ_nid2ln)(int) = 0L;
00139 static int (*K_X509_get_ext_count)(X509*) = 0L;
00140 static int (*K_X509_get_ext_by_NID)(X509*, int, int) = 0L;
00141 static int (*K_X509_get_ext_by_OBJ)(X509*,ASN1_OBJECT*,int) = 0L;
00142 static X509_EXTENSION *(*K_X509_get_ext)(X509*, int loc) = 0L;
00143 static X509_EXTENSION *(*K_X509_delete_ext)(X509*, int) = 0L;
00144 static int (*K_X509_add_ext)(X509*, X509_EXTENSION*, int) = 0L;
00145 static void *(*K_X509_get_ext_d2i)(X509*, int, int*, int*) = 0L;
00146 static char *(*K_i2s_ASN1_OCTET_STRING)(X509V3_EXT_METHOD*, ASN1_OCTET_STRING*) = 0L;
00147 static int (*K_ASN1_BIT_STRING_get_bit)(ASN1_BIT_STRING*, int) = 0L;
00148 static PKCS7 *(*K_PKCS7_new)() = 0L;
00149 static void (*K_PKCS7_free)(PKCS7*) = 0L;
00150 static void (*K_PKCS7_content_free)(PKCS7*) = 0L;
00151 static int (*K_i2d_PKCS7)(PKCS7*, unsigned char**) = 0L;
00152 static PKCS7 *(*K_d2i_PKCS7)(PKCS7**, unsigned char**,long) = 0L;
00153 static int (*K_i2d_PKCS7_fp)(FILE*,PKCS7*) = 0L;
00154 static PKCS7* (*K_d2i_PKCS7_fp)(FILE*,PKCS7**) = 0L;
00155 static int (*K_i2d_PKCS7_bio)(BIO *bp,PKCS7 *p7) = 0L;
00156 static PKCS7 *(*K_d2i_PKCS7_bio)(BIO *bp,PKCS7 **p7) = 0L;
00157 static PKCS7* (*K_PKCS7_dup)(PKCS7*) = 0L;
00158 static STACK_OF(X509_NAME) *(*K_SSL_load_client_CA_file)(const char*) = 0L;
00159 static STACK_OF(X509_INFO) *(*K_PEM_X509_INFO_read)(FILE*, STACK_OF(X509_INFO)*, pem_password_cb*, void*) = 0L;
00160 static char *(*K_ASN1_d2i_fp)(char *(*)(),char *(*)(),FILE*,unsigned char**) = 0L;
00161 static X509 *(*K_X509_new)() = 0L;
00162 static int (*K_X509_PURPOSE_get_count)() = 0L;
00163 static int (*K_X509_PURPOSE_get_id)(X509_PURPOSE *) = 0L;
00164 static int (*K_X509_check_purpose)(X509*,int,int) = 0L;
00165 static X509_PURPOSE* (*K_X509_PURPOSE_get0)(int) = 0L;
00166 static int (*K_EVP_PKEY_assign)(EVP_PKEY*, int, char*) = 0L;
00167 static int (*K_X509_REQ_set_pubkey)(X509_REQ*, EVP_PKEY*) = 0L;
00168 static RSA *(*K_RSA_generate_key)(int, unsigned long, void (*)(int,int,void *), void *) = 0L;
00169 static int (*K_i2d_X509_REQ_fp)(FILE*, X509_REQ*) = 0L;
00170 static void (*K_ERR_clear_error)() = 0L;
00171 static unsigned long (*K_ERR_get_error)() = 0L;
00172 static void (*K_ERR_print_errors_fp)(FILE*) = 0L;
00173 static PKCS7 *(*K_PKCS7_sign)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int) = 0L;
00174 static int (*K_PKCS7_verify)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int) = 0L;
00175 static STACK_OF(X509) *(*K_PKCS7_get0_signers)(PKCS7 *, STACK_OF(X509) *, int) = 0L;
00176 static PKCS7 *(*K_PKCS7_encrypt)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int) = 0L;
00177 static int (*K_PKCS7_decrypt)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int) = 0L;
00178 static SSL_SESSION* (*K_SSL_get1_session)(SSL*) = 0L;
00179 static void (*K_SSL_SESSION_free)(SSL_SESSION*) = 0L;
00180 static int (*K_SSL_set_session)(SSL*,SSL_SESSION*) = 0L;
00181 static SSL_SESSION* (*K_d2i_SSL_SESSION)(SSL_SESSION**,unsigned char**, long) = 0L;
00182 static int (*K_i2d_SSL_SESSION)(SSL_SESSION*,unsigned char**) = 0L;
00183 static STACK *(*K_X509_get1_email)(X509 *x) = 0L;
00184 static void (*K_X509_email_free)(STACK *sk) = 0L;
00185 static EVP_CIPHER *(*K_EVP_des_ede3_cbc)() = 0L;
00186 static EVP_CIPHER *(*K_EVP_des_cbc)() = 0L;
00187 static EVP_CIPHER *(*K_EVP_rc2_cbc)() = 0L;
00188 static EVP_CIPHER *(*K_EVP_rc2_64_cbc)() = 0L;
00189 static EVP_CIPHER *(*K_EVP_rc2_40_cbc)() = 0L;
00190 static int (*K_i2d_PrivateKey_fp)(FILE*,EVP_PKEY*) = 0L;
00191 static int (*K_i2d_PKCS8PrivateKey_fp)(FILE*, EVP_PKEY*, const EVP_CIPHER*, char*, int, pem_password_cb*, void*) = 0L;
00192 static void (*K_RSA_free)(RSA*) = 0L;
00193 static EVP_CIPHER *(*K_EVP_bf_cbc)() = 0L;
00194 static int (*K_X509_REQ_sign)(X509_REQ*, EVP_PKEY*, const EVP_MD*) = 0L;
00195 static int (*K_X509_NAME_add_entry_by_txt)(X509_NAME*, char*, int, unsigned char*, int, int, int) = 0L;
00196 static X509_NAME *(*K_X509_NAME_new)() = 0L;
00197 static int (*K_X509_REQ_set_subject_name)(X509_REQ*,X509_NAME*) = 0L;
00198 static unsigned char *(*K_ASN1_STRING_data)(ASN1_STRING*) = 0L;
00199 static STACK_OF(SSL_CIPHER) *(*K_SSL_get_ciphers)(const SSL *ssl) = 0L;
00200
00201 #endif
00202 }
00203
00204
00205 bool KOpenSSLProxy::hasLibSSL() const {
00206 return _sslLib != 0L;
00207 }
00208
00209
00210 bool KOpenSSLProxy::hasLibCrypto() const {
00211 return _cryptoLib != 0L;
00212 }
00213
00214
00215 void KOpenSSLProxy::destroy() {
00216 delete this;
00217 _me = 0L;
00218 }
00219
00220 #ifdef __OpenBSD__
00221 #include <qdir.h>
00222 #include <qstring.h>
00223 #include <qstringlist.h>
00224
00225 static QString findMostRecentLib(QString dir, QString name)
00226 {
00227
00228 QString filter = "lib"+name+".so.*";
00229 QDir d(dir, filter);
00230 if (!d.exists())
00231 return 0L;
00232 QStringList l = d.entryList();
00233
00234
00235 int bestmaj = -1;
00236 int bestmin = -1;
00237 QString best = 0L;
00238
00239 uint s = filter.length()-1;
00240 for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
00241 QString numberpart = (*it).mid(s);
00242 uint endmaj = numberpart.find('.');
00243 if (endmaj == -1)
00244 continue;
00245 bool ok;
00246 int maj = numberpart.left(endmaj).toInt(&ok);
00247 if (!ok)
00248 continue;
00249 int min = numberpart.mid(endmaj+1).toInt(&ok);
00250 if (!ok)
00251 continue;
00252 if (maj > bestmaj || (maj == bestmaj && min > bestmin)) {
00253 bestmaj = maj;
00254 bestmin = min;
00255 best = (*it);
00256 }
00257 }
00258 if (best.isNull())
00259 return 0L;
00260 else
00261 return dir+"/"+best;
00262 }
00263 #endif
00264
00265
00266 KOpenSSLProxy::KOpenSSLProxy() {
00267 KLibLoader *ll = KLibLoader::self();
00268 _ok = false;
00269 QStringList libpaths, libnamesc, libnamess;
00270 KConfig *cfg;
00271
00272 _cryptoLib = 0L;
00273 _sslLib = 0L;
00274
00275 cfg = new KConfig("cryptodefaults", false, false);
00276 cfg->setGroup("OpenSSL");
00277 QString upath = cfg->readPathEntry("Path");
00278 if (!upath.isEmpty())
00279 libpaths << upath;
00280
00281 delete cfg;
00282
00283 #ifdef __OpenBSD__
00284 {
00285 QString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto");
00286 if (!libname.isNull())
00287 _cryptoLib = ll->globalLibrary(libname.latin1());
00288 }
00289 #elif defined(__CYGWIN__)
00290 libpaths << "/usr/bin/"
00291 << "/usr/local/bin"
00292 << "/usr/local/openssl/bin"
00293 << "/opt/openssl/bin"
00294 << "/opt/kde3/bin"
00295 << "";
00296
00297 libnamess << "cygssl-0.9.7.dll"
00298 << "cygssl.dll"
00299 << "libssl.dll"
00300 << "";
00301
00302 libnamesc << "cygcrypto.dll"
00303 << "libcrypto.dll"
00304 << "";
00305 #else
00306 libpaths
00307 #ifdef _AIX
00308 << "/opt/freeware/lib/"
00309 #endif
00310 << "/usr/lib" KDELIBSUFF "/"
00311 << "/usr/ssl/lib" KDELIBSUFF "/"
00312 << "/usr/local/lib" KDELIBSUFF "/"
00313 << "/usr/local/openssl/lib" KDELIBSUFF "/"
00314 << "/usr/local/ssl/lib" KDELIBSUFF "/"
00315 << "/opt/openssl/lib" KDELIBSUFF "/"
00316 << "/lib" KDELIBSUFF "/"
00317 << "";
00318
00319
00320 libnamess
00321 #ifdef hpux
00322 << "libssl.sl"
00323 #elif defined(_AIX)
00324 << "libssl.a(libssl.so.0)"
00325 #elif defined(__APPLE__)
00326 << "libssl.dylib"
00327 << "libssl.0.9.dylib"
00328 #else
00329 #ifdef SHLIB_VERSION_NUMBER
00330 << "libssl.so." SHLIB_VERSION_NUMBER
00331 #endif
00332 << "libssl.so"
00333 << "libssl.so.0"
00334 #endif
00335 ;
00336
00337 libnamesc
00338 #ifdef hpux
00339 << "libcrypto.sl"
00340 #elif defined(_AIX)
00341 << "libcrypto.a(libcrypto.so.0)"
00342 #elif defined(__APPLE__)
00343 << "libcrypto.dylib"
00344 << "libcrypto.0.9.dylib"
00345 #else
00346 #ifdef SHLIB_VERSION_NUMBER
00347 << "libcrypto.so." SHLIB_VERSION_NUMBER
00348 #endif
00349 << "libcrypto.so"
00350 << "libcrypto.so.0"
00351 #endif
00352 ;
00353 #endif
00354
00355 for (QStringList::Iterator it = libpaths.begin();
00356 it != libpaths.end();
00357 ++it) {
00358 for (QStringList::Iterator shit = libnamesc.begin();
00359 shit != libnamesc.end();
00360 ++shit) {
00361 QString alib = *it;
00362 if (!alib.isEmpty() && !alib.endsWith("/"))
00363 alib += "/";
00364 alib += *shit;
00365 QString tmpStr(alib.latin1());
00366 tmpStr.replace(QRegExp("\\(.*\\)"), "");
00367 if (!access(tmpStr.latin1(), R_OK))
00368 _cryptoLib = ll->globalLibrary(alib.latin1());
00369 if (_cryptoLib) break;
00370 }
00371 if (_cryptoLib) break;
00372 }
00373
00374 if (_cryptoLib) {
00375 #ifdef KSSL_HAVE_SSL
00376 K_X509_free = (void (*) (X509 *)) _cryptoLib->symbol("X509_free");
00377 K_RAND_egd = (int (*)(const char *)) _cryptoLib->symbol("RAND_egd");
00378 K_RAND_load_file = (int (*)(const char *, long)) _cryptoLib->symbol("RAND_load_file");
00379 K_RAND_file_name = (const char* (*)(char *, size_t)) _cryptoLib->symbol("RAND_file_name");
00380 K_RAND_write_file = (int (*)(const char *)) _cryptoLib->symbol("RAND_write_file");
00381 K_CRYPTO_free = (void (*) (void *)) _cryptoLib->symbol("CRYPTO_free");
00382 K_d2i_X509 = (X509 * (*)(X509 **,unsigned char **,long)) _cryptoLib->symbol("d2i_X509");
00383 K_i2d_X509 = (int (*)(X509 *,unsigned char **)) _cryptoLib->symbol("i2d_X509");
00384 K_X509_cmp = (int (*)(X509 *, X509 *)) _cryptoLib->symbol("X509_cmp");
00385 K_X509_STORE_CTX_new = (X509_STORE_CTX * (*) (void)) _cryptoLib->symbol("X509_STORE_CTX_new");
00386 K_X509_STORE_CTX_free = (void (*) (X509_STORE_CTX *)) _cryptoLib->symbol("X509_STORE_CTX_free");
00387 K_X509_verify_cert = (int (*) (X509_STORE_CTX *)) _cryptoLib->symbol("X509_verify_cert");
00388 K_X509_STORE_new = (X509_STORE * (*) (void)) _cryptoLib->symbol("X509_STORE_new");
00389 K_X509_STORE_free = (void (*) (X509_STORE *)) _cryptoLib->symbol("X509_STORE_free");
00390 K_X509_NAME_oneline = (char * (*) (X509_NAME *,char *,int)) _cryptoLib->symbol("X509_NAME_oneline");
00391 K_X509_get_subject_name = (X509_NAME * (*) (X509 *)) _cryptoLib->symbol("X509_get_subject_name");
00392 K_X509_get_issuer_name = (X509_NAME * (*) (X509 *)) _cryptoLib->symbol("X509_get_issuer_name");
00393 K_X509_STORE_add_lookup = (X509_LOOKUP *(*) (X509_STORE *, X509_LOOKUP_METHOD *)) _cryptoLib->symbol("X509_STORE_add_lookup");
00394 K_X509_LOOKUP_file = (X509_LOOKUP_METHOD *(*)(void)) _cryptoLib->symbol("X509_LOOKUP_file");
00395 K_X509_LOOKUP_free = (void (*)(X509_LOOKUP *)) _cryptoLib->symbol("X509_LOOKUP_free");
00396 K_X509_LOOKUP_ctrl = (int (*)(X509_LOOKUP *, int, const char *, long, char **)) _cryptoLib->symbol("X509_LOOKUP_ctrl");
00397 K_X509_STORE_CTX_init = (void (*)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *)) _cryptoLib->symbol("X509_STORE_CTX_init");
00398 K_X509_dup = (X509* (*)(X509*)) _cryptoLib->symbol("X509_dup");
00399 K_BIO_s_mem = (BIO_METHOD *(*) (void)) _cryptoLib->symbol("BIO_s_mem");
00400 K_BIO_new = (BIO* (*)(BIO_METHOD *)) _cryptoLib->symbol("BIO_new");
00401 K_BIO_new_fp = (BIO* (*)(FILE*, int)) _cryptoLib->symbol("BIO_new_fp");
00402 K_BIO_new_mem_buf = (BIO* (*)(void *, int)) _cryptoLib->symbol("BIO_new_mem_buf");
00403 K_BIO_free = (int (*)(BIO*)) _cryptoLib->symbol("BIO_free");
00404 K_BIO_ctrl = (long (*) (BIO *,int,long,void *)) _cryptoLib->symbol("BIO_ctrl");
00405 K_BIO_write = (int (*) (BIO *b, const void *data, int len)) _cryptoLib->symbol("BIO_write");
00406 K_PEM_ASN1_write_bio = (int (*)(int (*)(), const char *,BIO*, char*, const EVP_CIPHER *, unsigned char *, int, pem_password_cb *, void *)) _cryptoLib->symbol("PEM_ASN1_write_bio");
00407 K_X509_asn1_meth = (ASN1_METHOD* (*)(void)) _cryptoLib->symbol("X509_asn1_meth");
00408 K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_i2d_fp");
00409 K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *, unsigned char **)) _cryptoLib->symbol("i2d_ASN1_HEADER");
00410 K_X509_print_fp = (int (*)(FILE*, X509*)) _cryptoLib->symbol("X509_print_fp");
00411 K_i2d_PKCS12 = (int (*)(PKCS12*, unsigned char**)) _cryptoLib->symbol("i2d_PKCS12");
00412 K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) _cryptoLib->symbol("i2d_PKCS12_fp");
00413 K_PKCS12_newpass = (int (*)(PKCS12*, char*, char*)) _cryptoLib->symbol("PKCS12_newpass");
00414 K_d2i_PKCS12_fp = (PKCS12* (*)(FILE*, PKCS12**)) _cryptoLib->symbol("d2i_PKCS12_fp");
00415 K_PKCS12_new = (PKCS12* (*)()) _cryptoLib->symbol("PKCS12_new");
00416 K_PKCS12_free = (void (*)(PKCS12 *)) _cryptoLib->symbol("PKCS12_free");
00417 K_PKCS12_parse = (int (*)(PKCS12*, const char *, EVP_PKEY**,
00418 X509**, STACK_OF(X509)**)) _cryptoLib->symbol("PKCS12_parse");
00419 K_EVP_PKEY_free = (void (*) (EVP_PKEY *)) _cryptoLib->symbol("EVP_PKEY_free");
00420 K_EVP_PKEY_new = (EVP_PKEY* (*)()) _cryptoLib->symbol("EVP_PKEY_new");
00421 K_X509_REQ_free = (void (*)(X509_REQ*)) _cryptoLib->symbol("X509_REQ_free");
00422 K_X509_REQ_new = (X509_REQ* (*)()) _cryptoLib->symbol("X509_REQ_new");
00423 K_X509_STORE_CTX_set_chain = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) _cryptoLib->symbol("X509_STORE_CTX_set_chain");
00424 K_X509_STORE_CTX_set_purpose = (void (*)(X509_STORE_CTX *, int)) _cryptoLib->symbol("X509_STORE_CTX_set_purpose");
00425 K_sk_free = (void (*) (STACK *)) _cryptoLib->symbol("sk_free");
00426 K_sk_num = (int (*) (STACK *)) _cryptoLib->symbol("sk_num");
00427 K_sk_pop = (char* (*) (STACK *)) _cryptoLib->symbol("sk_pop");
00428 K_sk_value = (char* (*) (STACK *, int)) _cryptoLib->symbol("sk_value");
00429 K_sk_new = (STACK* (*) (int (*)())) _cryptoLib->symbol("sk_new");
00430 K_sk_push = (int (*) (STACK*, char*)) _cryptoLib->symbol("sk_push");
00431 K_sk_dup = (STACK* (*) (STACK *)) _cryptoLib->symbol("sk_dup");
00432 K_i2s_ASN1_INTEGER = (char *(*) (X509V3_EXT_METHOD *, ASN1_INTEGER *)) _cryptoLib->symbol("i2s_ASN1_INTEGER");
00433 K_X509_get_serialNumber = (ASN1_INTEGER * (*) (X509 *)) _cryptoLib->symbol("X509_get_serialNumber");
00434 K_X509_get_pubkey = (EVP_PKEY *(*)(X509 *)) _cryptoLib->symbol("X509_get_pubkey");
00435 K_i2d_PublicKey = (int (*)(EVP_PKEY *, unsigned char **)) _cryptoLib->symbol("i2d_PublicKey");
00436 K_X509_check_private_key = (int (*)(X509 *, EVP_PKEY *)) _cryptoLib->symbol("X509_check_private_key");
00437 K_BN_bn2hex = (char *(*)(const BIGNUM *)) _cryptoLib->symbol("BN_bn2hex");
00438 K_X509_digest = (int (*)(const X509 *,const EVP_MD *, unsigned char *, unsigned int *)) _cryptoLib->symbol("X509_digest");
00439 K_EVP_md5 = (EVP_MD *(*)()) _cryptoLib->symbol("EVP_md5");
00440 K_ASN1_INTEGER_free = (void (*)(ASN1_INTEGER *)) _cryptoLib->symbol("ASN1_INTEGER_free");
00441 K_OBJ_obj2nid = (int (*)(ASN1_OBJECT *)) _cryptoLib->symbol("OBJ_obj2nid");
00442 K_OBJ_nid2ln = (const char *(*)(int)) _cryptoLib->symbol("OBJ_nid2ln");
00443 K_X509_get_ext_count = (int (*)(X509*)) _cryptoLib->symbol("X509_get_ext_count");
00444 K_X509_get_ext_by_NID = (int (*)(X509*,int,int)) _cryptoLib->symbol("X509_get_ext_by_NID");
00445 K_X509_get_ext_by_OBJ = (int (*)(X509*,ASN1_OBJECT*,int)) _cryptoLib->symbol("X509_get_ext_by_OBJ");
00446 K_X509_get_ext = (X509_EXTENSION* (*)(X509*,int)) _cryptoLib->symbol("X509_get_ext");
00447 K_X509_delete_ext = (X509_EXTENSION* (*)(X509*,int)) _cryptoLib->symbol("X509_delete_ext");
00448 K_X509_add_ext = (int (*)(X509*,X509_EXTENSION*,int)) _cryptoLib->symbol("X509_add_ext");
00449 K_X509_get_ext_d2i = (void* (*)(X509*,int,int*,int*)) _cryptoLib->symbol("X509_get_ext_d2i");
00450 K_i2s_ASN1_OCTET_STRING = (char *(*)(X509V3_EXT_METHOD*,ASN1_OCTET_STRING*)) _cryptoLib->symbol("i2s_ASN1_OCTET_STRING");
00451 K_ASN1_BIT_STRING_get_bit = (int (*)(ASN1_BIT_STRING*,int)) _cryptoLib->symbol("ASN1_BIT_STRING_get_bit");
00452 K_PKCS7_new = (PKCS7 *(*)()) _cryptoLib->symbol("PKCS7_new");
00453 K_PKCS7_free = (void (*)(PKCS7*)) _cryptoLib->symbol("PKCS7_free");
00454 K_PKCS7_content_free = (void (*)(PKCS7*)) _cryptoLib->symbol("PKCS7_content_free");
00455 K_i2d_PKCS7 = (int (*)(PKCS7*, unsigned char**)) _cryptoLib->symbol("i2d_PKCS7");
00456 K_i2d_PKCS7_fp = (int (*)(FILE*,PKCS7*)) _cryptoLib->symbol("i2d_PKCS7_fp");
00457 K_i2d_PKCS7_bio = (int (*)(BIO *bp,PKCS7 *p7)) _cryptoLib->symbol("i2d_PKCS7_bio");
00458 K_d2i_PKCS7 = (PKCS7* (*)(PKCS7**,unsigned char**,long)) _cryptoLib->symbol("d2i_PKCS7");
00459 K_d2i_PKCS7_fp = (PKCS7 *(*)(FILE *,PKCS7**)) _cryptoLib->symbol("d2i_PKCS7_fp");
00460 K_d2i_PKCS7_bio = (PKCS7 *(*)(BIO *bp,PKCS7 **p7)) _cryptoLib->symbol("d2i_PKCS7_bio");
00461 K_PKCS7_dup = (PKCS7* (*)(PKCS7*)) _cryptoLib->symbol("PKCS7_dup");
00462 K_PKCS7_sign = (PKCS7 *(*)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int)) _cryptoLib->symbol("PKCS7_sign");
00463 K_PKCS7_verify = (int (*)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int)) _cryptoLib->symbol("PKCS7_verify");
00464 K_PKCS7_get0_signers = (STACK_OF(X509) *(*)(PKCS7 *, STACK_OF(X509) *, int)) _cryptoLib->symbol("PKCS7_get0_signers");
00465 K_PKCS7_encrypt = (PKCS7* (*)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int)) _cryptoLib->symbol("PKCS7_encrypt");
00466 K_PKCS7_decrypt = (int (*)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int)) _cryptoLib->symbol("PKCS7_decrypt");
00467 K_PEM_X509_INFO_read = (STACK_OF(X509_INFO) *(*)(FILE*, STACK_OF(X509_INFO)*, pem_password_cb*, void *)) _cryptoLib->symbol("PEM_X509_INFO_read");
00468 K_ASN1_d2i_fp = (char *(*)(char *(*)(),char *(*)(),FILE*,unsigned char**)) _cryptoLib->symbol("ASN1_d2i_fp");
00469 K_X509_new = (X509 *(*)()) _cryptoLib->symbol("X509_new");
00470 K_X509_PURPOSE_get_count = (int (*)()) _cryptoLib->symbol("X509_PURPOSE_get_count");
00471 K_X509_PURPOSE_get_id = (int (*)(X509_PURPOSE *)) _cryptoLib->symbol("X509_PURPOSE_get_id");
00472 K_X509_check_purpose = (int (*)(X509*,int,int)) _cryptoLib->symbol("X509_check_purpose");
00473 K_X509_PURPOSE_get0 = (X509_PURPOSE *(*)(int)) _cryptoLib->symbol("X509_PURPOSE_get0");
00474 K_EVP_PKEY_assign = (int (*)(EVP_PKEY*, int, char*)) _cryptoLib->symbol("EVP_PKEY_assign");
00475 K_X509_REQ_set_pubkey = (int (*)(X509_REQ*, EVP_PKEY*)) _cryptoLib->symbol("X509_REQ_set_pubkey");
00476 K_RSA_generate_key = (RSA* (*)(int, unsigned long, void (*)(int,int,void *), void *)) _cryptoLib->symbol("RSA_generate_key");
00477 K_i2d_X509_REQ_fp = (int (*)(FILE *, X509_REQ *)) _cryptoLib->symbol("i2d_X509_REQ_fp");
00478 K_ERR_clear_error = (void (*)()) _cryptoLib->symbol("ERR_clear_error");
00479 K_ERR_get_error = (unsigned long (*)()) _cryptoLib->symbol("ERR_get_error");
00480 K_ERR_print_errors_fp = (void (*)(FILE*)) _cryptoLib->symbol("ERR_print_errors_fp");
00481 K_X509_get1_email = (STACK *(*)(X509 *x)) _cryptoLib->symbol("X509_get1_email");
00482 K_X509_email_free = (void (*)(STACK *sk)) _cryptoLib->symbol("X509_email_free");
00483 K_EVP_des_ede3_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_des_ede3_cbc");
00484 K_EVP_des_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_des_cbc");
00485 K_EVP_rc2_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_rc2_cbc");
00486 K_EVP_rc2_64_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_rc2_64_cbc");
00487 K_EVP_rc2_40_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_rc2_40_cbc");
00488 K_i2d_PrivateKey_fp = (int (*)(FILE*,EVP_PKEY*)) _cryptoLib->symbol("i2d_PrivateKey_fp");
00489 K_i2d_PKCS8PrivateKey_fp = (int (*)(FILE*, EVP_PKEY*, const EVP_CIPHER*, char*, int, pem_password_cb*, void*)) _cryptoLib->symbol("i2d_PKCS8PrivateKey_fp");
00490 K_RSA_free = (void (*)(RSA*)) _cryptoLib->symbol("RSA_free");
00491 K_EVP_bf_cbc = (EVP_CIPHER *(*)()) _cryptoLib->symbol("EVP_bf_cbc");
00492 K_X509_REQ_sign = (int (*)(X509_REQ*, EVP_PKEY*, const EVP_MD*)) _cryptoLib->symbol("X509_REQ_sign");
00493 K_X509_NAME_add_entry_by_txt = (int (*)(X509_NAME*, char*, int, unsigned char*, int, int, int)) _cryptoLib->symbol("X509_NAME_add_entry_by_txt");
00494 K_X509_NAME_new = (X509_NAME *(*)()) _cryptoLib->symbol("X509_NAME_new");
00495 K_X509_REQ_set_subject_name = (int (*)(X509_REQ*,X509_NAME*)) _cryptoLib->symbol("X509_REQ_set_subject_name");
00496 K_ASN1_STRING_data = (unsigned char *(*)(ASN1_STRING*)) _cryptoLib->symbol("ASN1_STRING_data");
00497 #endif
00498 }
00499
00500 #ifdef __OpenBSD__
00501 {
00502 QString libname = findMostRecentLib("/usr/lib", "ssl");
00503 if (!libname.isNull())
00504 _sslLib = ll->globalLibrary(libname.latin1());
00505 }
00506 #else
00507 for (QStringList::Iterator it = libpaths.begin();
00508 it != libpaths.end();
00509 ++it) {
00510 for (QStringList::Iterator shit = libnamess.begin();
00511 shit != libnamess.end();
00512 ++shit) {
00513 QString alib = *it;
00514 if (!alib.isEmpty() && !alib.endsWith("/"))
00515 alib += "/";
00516 alib += *shit;
00517 QString tmpStr(alib.latin1());
00518 tmpStr.replace(QRegExp("\\(.*\\)"), "");
00519 if (!access(tmpStr.latin1(), R_OK))
00520 _sslLib = ll->globalLibrary(alib.latin1());
00521 if (_sslLib) break;
00522 }
00523 if (_sslLib) break;
00524 }
00525 #endif
00526
00527 if (_sslLib) {
00528 #ifdef KSSL_HAVE_SSL
00529
00530 K_SSL_connect = (int (*)(SSL *)) _sslLib->symbol("SSL_connect");
00531 K_SSL_accept = (int (*)(SSL *)) _sslLib->symbol("SSL_accept");
00532 K_SSL_read = (int (*)(SSL *, void *, int)) _sslLib->symbol("SSL_read");
00533 K_SSL_write = (int (*)(SSL *, const void *, int))
00534 _sslLib->symbol("SSL_write");
00535 K_SSL_new = (SSL* (*)(SSL_CTX *)) _sslLib->symbol("SSL_new");
00536 K_SSL_free = (void (*)(SSL *)) _sslLib->symbol("SSL_free");
00537 K_SSL_shutdown = (int (*)(SSL *)) _sslLib->symbol("SSL_shutdown");
00538 K_SSL_CTX_new = (SSL_CTX* (*)(SSL_METHOD*)) _sslLib->symbol("SSL_CTX_new");
00539 K_SSL_CTX_free = (void (*)(SSL_CTX*)) _sslLib->symbol("SSL_CTX_free");
00540 K_SSL_set_fd = (int (*)(SSL *, int)) _sslLib->symbol("SSL_set_fd");
00541 K_SSL_pending = (int (*)(SSL *)) _sslLib->symbol("SSL_pending");
00542 K_SSL_CTX_set_cipher_list = (int (*)(SSL_CTX *, const char *))
00543 _sslLib->symbol("SSL_CTX_set_cipher_list");
00544 K_SSL_CTX_set_verify = (void (*)(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*))) _sslLib->symbol("SSL_CTX_set_verify");
00545 K_SSL_use_certificate = (int (*)(SSL*, X509*))
00546 _sslLib->symbol("SSL_CTX_use_certificate");
00547 K_SSL_get_current_cipher = (SSL_CIPHER *(*)(SSL *))
00548 _sslLib->symbol("SSL_get_current_cipher");
00549 K_SSL_ctrl = (long (*)(SSL * ,int, long, char *))
00550 _sslLib->symbol("SSL_ctrl");
00551 K_TLSv1_client_method = (SSL_METHOD *(*)()) _sslLib->symbol("TLSv1_client_method");
00552 K_SSLv2_client_method = (SSL_METHOD *(*)()) _sslLib->symbol("SSLv2_client_method");
00553 K_SSLv3_client_method = (SSL_METHOD *(*)()) _sslLib->symbol("SSLv3_client_method");
00554 K_SSLv23_client_method = (SSL_METHOD *(*)()) _sslLib->symbol("SSLv23_client_method");
00555 K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) _sslLib->symbol("SSL_get_peer_certificate");
00556 K_SSL_CIPHER_get_bits = (int (*)(SSL_CIPHER *,int *)) _sslLib->symbol("SSL_CIPHER_get_bits");
00557 K_SSL_CIPHER_get_version = (char * (*)(SSL_CIPHER *)) _sslLib->symbol("SSL_CIPHER_get_version");
00558 K_SSL_CIPHER_get_name = (const char * (*)(SSL_CIPHER *)) _sslLib->symbol("SSL_CIPHER_get_name");
00559 K_SSL_CIPHER_description = (char * (*)(SSL_CIPHER *, char *, int)) _sslLib->symbol("SSL_CIPHER_description");
00560 K_SSL_CTX_use_PrivateKey = (int (*)(SSL_CTX*, EVP_PKEY*)) _sslLib->symbol("SSL_CTX_use_PrivateKey");
00561 K_SSL_CTX_use_certificate = (int (*)(SSL_CTX*, X509*)) _sslLib->symbol("SSL_CTX_use_certificate");
00562 K_SSL_get_error = (int (*)(SSL*, int)) _sslLib->symbol("SSL_get_error");
00563 K_SSL_get_peer_cert_chain = (STACK_OF(X509)* (*)(SSL*)) _sslLib->symbol("SSL_get_peer_cert_chain");
00564 K_SSL_load_client_CA_file = (STACK_OF(X509_NAME)* (*)(const char *)) _sslLib->symbol("SSL_load_client_CA_file");
00565 K_SSL_peek = (int (*)(SSL*,void*,int)) _sslLib->symbol("SSL_peek");
00566 K_SSL_get1_session = (SSL_SESSION* (*)(SSL*)) _sslLib->symbol("SSL_get1_session");
00567 K_SSL_SESSION_free = (void (*)(SSL_SESSION*)) _sslLib->symbol("SSL_SESSION_free");
00568 K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) _sslLib->symbol("SSL_set_session");
00569 K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,unsigned char**, long)) _sslLib->symbol("d2i_SSL_SESSION");
00570 K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,unsigned char**)) _sslLib->symbol("i2d_SSL_SESSION");
00571 K_SSL_get_ciphers = (STACK *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
00572 #endif
00573
00574
00575
00576 void *x;
00577 x = _sslLib->symbol("SSL_library_init");
00578 if (_cryptoLib) {
00579 if (x) ((int (*)())x)();
00580 x = _cryptoLib->symbol("OpenSSL_add_all_algorithms");
00581 if (!x)
00582 x = _cryptoLib->symbol("OPENSSL_add_all_algorithms");
00583 if (x) {
00584 ((void (*)())x)();
00585 } else {
00586 x = _cryptoLib->symbol("OpenSSL_add_all_algorithms_conf");
00587 if (!x)
00588 x = _cryptoLib->symbol("OPENSSL_add_all_algorithms_conf");
00589 if (x) {
00590 ((void (*)())x)();
00591 } else {
00592 x = _cryptoLib->symbol("OpenSSL_add_all_algorithms_noconf");
00593 if (!x)
00594 x = _cryptoLib->symbol("OPENSSL_add_all_algorithms_noconf");
00595 if (x)
00596 ((void (*)())x)();
00597 }
00598 }
00599 x = _cryptoLib->symbol("OpenSSL_add_all_ciphers");
00600 if (!x)
00601 x = _cryptoLib->symbol("OPENSSL_add_all_ciphers");
00602 if (x) ((void (*)())x)();
00603 x = _cryptoLib->symbol("OpenSSL_add_all_digests");
00604 if (!x)
00605 x = _cryptoLib->symbol("OPENSSL_add_all_digests");
00606 if (x) ((void (*)())x)();
00607 }
00608 }
00609
00610 }
00611
00612
00613 KOpenSSLProxy* KOpenSSLProxy::_me = 0L;
00614 static KStaticDeleter<KOpenSSLProxy> medProxy;
00615
00616
00617
00618 KOpenSSLProxy::~KOpenSSLProxy() {
00619 if (_sslLib) {
00620 _sslLib->unload();
00621 }
00622 if (_cryptoLib) {
00623 _cryptoLib->unload();
00624 }
00625 medProxy.setObject(0);
00626 }
00627
00628
00629
00630
00631 KOpenSSLProxy *KOpenSSLProxy::self() {
00632 #ifdef KSSL_HAVE_SSL
00633 if (!_me) {
00634 _me = medProxy.setObject(_me, new KOpenSSLProxy);
00635 }
00636 #endif
00637 return _me;
00638 }
00639
00640
00641
00642
00643
00644
00645
00646 #ifdef KSSL_HAVE_SSL
00647
00648
00649
00650 int KOpenSSLProxy::SSL_connect(SSL *ssl) {
00651 if (K_SSL_connect) return (K_SSL_connect)(ssl);
00652 return -1;
00653 }
00654
00655
00656 int KOpenSSLProxy::SSL_accept(SSL *ssl) {
00657 if (K_SSL_accept) return (K_SSL_accept)(ssl);
00658 return -1;
00659 }
00660
00661
00662 int KOpenSSLProxy::SSL_read(SSL *ssl, void *buf, int num) {
00663 if (K_SSL_read) return (K_SSL_read)(ssl, buf, num);
00664 return -1;
00665 }
00666
00667
00668 int KOpenSSLProxy::SSL_write(SSL *ssl, const void *buf, int num) {
00669 if (K_SSL_write) return (K_SSL_write)(ssl, buf, num);
00670 return -1;
00671 }
00672
00673
00674 SSL *KOpenSSLProxy::SSL_new(SSL_CTX *ctx) {
00675 if (K_SSL_new) return (K_SSL_new)(ctx);
00676 return 0L;
00677 }
00678
00679
00680 void KOpenSSLProxy::SSL_free(SSL *ssl) {
00681 if (K_SSL_free) (K_SSL_free)(ssl);
00682 }
00683
00684
00685 int KOpenSSLProxy::SSL_shutdown(SSL *ssl) {
00686 if (K_SSL_shutdown) return (K_SSL_shutdown)(ssl);
00687 return -1;
00688 }
00689
00690
00691 SSL_CTX *KOpenSSLProxy::SSL_CTX_new(SSL_METHOD *method) {
00692 if (K_SSL_CTX_new) return (K_SSL_CTX_new)(method);
00693 return 0L;
00694 }
00695
00696
00697 void KOpenSSLProxy::SSL_CTX_free(SSL_CTX *ctx) {
00698 if (K_SSL_CTX_free) (K_SSL_CTX_free)(ctx);
00699 }
00700
00701
00702 int KOpenSSLProxy::SSL_set_fd(SSL *ssl, int fd) {
00703 if (K_SSL_set_fd) return (K_SSL_set_fd)(ssl, fd);
00704 return -1;
00705 }
00706
00707
00708 int KOpenSSLProxy::SSL_pending(SSL *ssl) {
00709 if (K_SSL_pending) return (K_SSL_pending)(ssl);
00710 return -1;
00711 }
00712
00713
00714 int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
00715 if (K_SSL_CTX_set_cipher_list) return (K_SSL_CTX_set_cipher_list)(ctx, str);
00716 return -1;
00717 }
00718
00719
00720 void KOpenSSLProxy::SSL_CTX_set_verify(SSL_CTX *ctx, int mode,
00721 int (*verify_callback)(int, X509_STORE_CTX *)) {
00722 if (K_SSL_CTX_set_verify) (K_SSL_CTX_set_verify)(ctx, mode, verify_callback);
00723 }
00724
00725
00726 int KOpenSSLProxy::SSL_use_certificate(SSL *ssl, X509 *x) {
00727 if (K_SSL_use_certificate) return (K_SSL_use_certificate)(ssl, x);
00728 return -1;
00729 }
00730
00731
00732 SSL_CIPHER *KOpenSSLProxy::SSL_get_current_cipher(SSL *ssl) {
00733 if (K_SSL_get_current_cipher) return (K_SSL_get_current_cipher)(ssl);
00734 return 0L;
00735 }
00736
00737
00738 long KOpenSSLProxy::SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg) {
00739 if (K_SSL_ctrl) return (K_SSL_ctrl)(ssl, cmd, larg, parg);
00740 return -1;
00741 }
00742
00743
00744 int KOpenSSLProxy::RAND_egd(const char *path) {
00745 if (K_RAND_egd) return (K_RAND_egd)(path);
00746 return -1;
00747 }
00748
00749
00750 SSL_METHOD *KOpenSSLProxy::TLSv1_client_method() {
00751 if (K_TLSv1_client_method) return (K_TLSv1_client_method)();
00752 return 0L;
00753 }
00754
00755
00756 SSL_METHOD *KOpenSSLProxy::SSLv2_client_method() {
00757 if (K_SSLv2_client_method) return (K_SSLv2_client_method)();
00758 return 0L;
00759 }
00760
00761
00762 SSL_METHOD *KOpenSSLProxy::SSLv3_client_method() {
00763 if (K_SSLv3_client_method) return (K_SSLv3_client_method)();
00764 return 0L;
00765 }
00766
00767
00768 SSL_METHOD *KOpenSSLProxy::SSLv23_client_method() {
00769 if (K_SSLv23_client_method) return (K_SSLv23_client_method)();
00770 return 0L;
00771 }
00772
00773
00774 X509 *KOpenSSLProxy::SSL_get_peer_certificate(SSL *s) {
00775 if (K_SSL_get_peer_certificate) return (K_SSL_get_peer_certificate)(s);
00776 return 0L;
00777 }
00778
00779
00780 int KOpenSSLProxy::SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits) {
00781 if (K_SSL_CIPHER_get_bits) return (K_SSL_CIPHER_get_bits)(c, alg_bits);
00782 return -1;
00783 }
00784
00785
00786 char * KOpenSSLProxy::SSL_CIPHER_get_version(SSL_CIPHER *c) {
00787 if (K_SSL_CIPHER_get_version) return (K_SSL_CIPHER_get_version)(c);
00788 return 0L;
00789 }
00790
00791
00792 const char * KOpenSSLProxy::SSL_CIPHER_get_name(SSL_CIPHER *c) {
00793 if (K_SSL_CIPHER_get_name) return (K_SSL_CIPHER_get_name)(c);
00794 return 0L;
00795 }
00796
00797
00798 char * KOpenSSLProxy::SSL_CIPHER_description(SSL_CIPHER *c,char *buf,int size) {
00799 if (K_SSL_CIPHER_description) return (K_SSL_CIPHER_description)(c,buf,size);
00800 return 0L;
00801 }
00802
00803
00804 X509 * KOpenSSLProxy::d2i_X509(X509 **a,unsigned char **pp,long length) {
00805 if (K_d2i_X509) return (K_d2i_X509)(a,pp,length);
00806 return 0L;
00807 }
00808
00809
00810 int KOpenSSLProxy::i2d_X509(X509 *a,unsigned char **pp) {
00811 if (K_i2d_X509) return (K_i2d_X509)(a,pp);
00812 return -1;
00813 }
00814
00815
00816 int KOpenSSLProxy::X509_cmp(X509 *a, X509 *b) {
00817 if (K_X509_cmp) return (K_X509_cmp)(a,b);
00818 return 0;
00819 }
00820
00821
00822 X509_STORE *KOpenSSLProxy::X509_STORE_new(void) {
00823 if (K_X509_STORE_new) return (K_X509_STORE_new)();
00824 return 0L;
00825 }
00826
00827
00828 void KOpenSSLProxy::X509_STORE_free(X509_STORE *v) {
00829 if (K_X509_STORE_free) (K_X509_STORE_free)(v);
00830 }
00831
00832
00833 X509_STORE_CTX *KOpenSSLProxy::X509_STORE_CTX_new(void) {
00834 if (K_X509_STORE_CTX_new) return (K_X509_STORE_CTX_new)();
00835 return 0L;
00836 }
00837
00838
00839 void KOpenSSLProxy::X509_STORE_CTX_free(X509_STORE_CTX *ctx) {
00840 if (K_X509_STORE_CTX_free) (K_X509_STORE_CTX_free)(ctx);
00841 }
00842
00843
00844 int KOpenSSLProxy::X509_verify_cert(X509_STORE_CTX *ctx) {
00845 if (K_X509_verify_cert) return (K_X509_verify_cert)(ctx);
00846 return -1;
00847 }
00848
00849
00850 void KOpenSSLProxy::X509_free(X509 *a) {
00851 if (K_X509_free) (K_X509_free)(a);
00852 }
00853
00854
00855 char *KOpenSSLProxy::X509_NAME_oneline(X509_NAME *a,char *buf,int size) {
00856 if (K_X509_NAME_oneline) return (K_X509_NAME_oneline)(a,buf,size);
00857 return 0L;
00858 }
00859
00860
00861 X509_NAME *KOpenSSLProxy::X509_get_subject_name(X509 *a) {
00862 if (K_X509_get_subject_name) return (K_X509_get_subject_name)(a);
00863 return 0L;
00864 }
00865
00866
00867 X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a) {
00868 if (K_X509_get_issuer_name) return (K_X509_get_issuer_name)(a);
00869 return 0L;
00870 }
00871
00872
00873 X509_LOOKUP *KOpenSSLProxy::X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) {
00874 if (K_X509_STORE_add_lookup) return (K_X509_STORE_add_lookup)(v,m);
00875 return 0L;
00876 }
00877
00878
00879 X509_LOOKUP_METHOD *KOpenSSLProxy::X509_LOOKUP_file(void) {
00880 if (K_X509_LOOKUP_file) return (K_X509_LOOKUP_file)();
00881 return 0L;
00882 }
00883
00884
00885 void KOpenSSLProxy::X509_LOOKUP_free(X509_LOOKUP *x) {
00886 if (K_X509_LOOKUP_free) (K_X509_LOOKUP_free)(x);
00887 }
00888
00889
00890 int KOpenSSLProxy::X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret) {
00891 if (K_X509_LOOKUP_ctrl) return (K_X509_LOOKUP_ctrl)(ctx,cmd,argc,argl,ret);
00892 return -1;
00893 }
00894
00895
00896 void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain) {
00897 if (K_X509_STORE_CTX_init) (K_X509_STORE_CTX_init)(ctx,store,x509,chain);
00898 }
00899
00900
00901 void KOpenSSLProxy::CRYPTO_free(void *x) {
00902 if (K_CRYPTO_free) (K_CRYPTO_free)(x);
00903 }
00904
00905
00906 X509 *KOpenSSLProxy::X509_dup(X509 *x509) {
00907 if (K_X509_dup) return (K_X509_dup)(x509);
00908 return 0L;
00909 }
00910
00911
00912 BIO *KOpenSSLProxy::BIO_new(BIO_METHOD *type) {
00913 if (K_BIO_new) return (K_BIO_new)(type);
00914 else return 0L;
00915 }
00916
00917
00918 BIO_METHOD *KOpenSSLProxy::BIO_s_mem(void) {
00919 if (K_BIO_s_mem) return (K_BIO_s_mem)();
00920 else return 0L;
00921 }
00922
00923
00924 BIO *KOpenSSLProxy::BIO_new_fp(FILE *stream, int close_flag) {
00925 if (K_BIO_new_fp) return (K_BIO_new_fp)(stream, close_flag);
00926 return 0L;
00927 }
00928
00929
00930 BIO *KOpenSSLProxy::BIO_new_mem_buf(void *buf, int len) {
00931 if (K_BIO_new_mem_buf) return (K_BIO_new_mem_buf)(buf,len);
00932 else return 0L;
00933 }
00934
00935
00936 int KOpenSSLProxy::BIO_free(BIO *a) {
00937 if (K_BIO_free) return (K_BIO_free)(a);
00938 return -1;
00939 }
00940
00941
00942 long KOpenSSLProxy::BIO_ctrl(BIO *bp,int cmd,long larg,void *parg) {
00943 if (K_BIO_ctrl) return (K_BIO_ctrl)(bp,cmd,larg,parg);
00944 else return 0;
00945 }
00946
00947
00948 int KOpenSSLProxy::BIO_write(BIO *b, const void *data, int len) {
00949 if (K_BIO_write) return (K_BIO_write)(b, data, len);
00950 else return -1;
00951 }
00952
00953
00954 int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) {
00955 if (K_PEM_ASN1_write_bio) return (K_PEM_ASN1_write_bio) ((int (*)())K_i2d_X509, PEM_STRING_X509, bp, (char *)x, 0L, 0L, 0, 0L, 0L);
00956 else return -1;
00957 }
00958
00959
00960 ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(void) {
00961 if (K_X509_asn1_meth) return (K_X509_asn1_meth)();
00962 else return 0L;
00963 }
00964
00965
00966 int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) {
00967 if (K_ASN1_i2d_fp && K_i2d_ASN1_HEADER)
00968 return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
00969 else return -1;
00970 }
00971
00972
00973 int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
00974 if (K_X509_print_fp) return (K_X509_print_fp)(fp, x);
00975 return -1;
00976 }
00977
00978
00979 PKCS12 *KOpenSSLProxy::d2i_PKCS12_fp(FILE *fp, PKCS12 **p12) {
00980 if (K_d2i_PKCS12_fp) return (K_d2i_PKCS12_fp)(fp, p12);
00981 else return 0L;
00982 }
00983
00984
00985 int KOpenSSLProxy::PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass) {
00986 if (K_PKCS12_newpass) return (K_PKCS12_newpass)(p12, oldpass, newpass);
00987 else return -1;
00988 }
00989
00990
00991 int KOpenSSLProxy::i2d_PKCS12(PKCS12 *p12, unsigned char **p) {
00992 if (K_i2d_PKCS12) return (K_i2d_PKCS12)(p12, p);
00993 else return -1;
00994 }
00995
00996
00997 int KOpenSSLProxy::i2d_PKCS12_fp(FILE *fp, PKCS12 *p12) {
00998 if (K_i2d_PKCS12_fp) return (K_i2d_PKCS12_fp)(fp, p12);
00999 else return -1;
01000 }
01001
01002
01003 PKCS12 *KOpenSSLProxy::PKCS12_new(void) {
01004 if (K_PKCS12_new) return (K_PKCS12_new)();
01005 else return 0L;
01006 }
01007
01008
01009 void KOpenSSLProxy::PKCS12_free(PKCS12 *a) {
01010 if (K_PKCS12_free) (K_PKCS12_free)(a);
01011 }
01012
01013
01014 int KOpenSSLProxy::PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey,
01015 X509 **cert, STACK_OF(X509) **ca) {
01016 if (K_PKCS12_parse) return (K_PKCS12_parse) (p12, pass, pkey, cert, ca);
01017 else return -1;
01018 }
01019
01020
01021 void KOpenSSLProxy::EVP_PKEY_free(EVP_PKEY *x) {
01022 if (K_EVP_PKEY_free) (K_EVP_PKEY_free)(x);
01023 }
01024
01025
01026 EVP_PKEY* KOpenSSLProxy::EVP_PKEY_new() {
01027 if (K_EVP_PKEY_new) return (K_EVP_PKEY_new)();
01028 else return 0L;
01029 }
01030
01031
01032 void KOpenSSLProxy::X509_REQ_free(X509_REQ *x) {
01033 if (K_X509_REQ_free) (K_X509_REQ_free)(x);
01034 }
01035
01036
01037 X509_REQ* KOpenSSLProxy::X509_REQ_new() {
01038 if (K_X509_REQ_new) return (K_X509_REQ_new)();
01039 else return 0L;
01040 }
01041
01042
01043 int KOpenSSLProxy::SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) {
01044 if (K_SSL_CTX_use_PrivateKey) return (K_SSL_CTX_use_PrivateKey)(ctx,pkey);
01045 else return -1;
01046 }
01047
01048
01049 int KOpenSSLProxy::SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) {
01050 if (K_SSL_CTX_use_certificate) return (K_SSL_CTX_use_certificate)(ctx,x);
01051 else return -1;
01052 }
01053
01054
01055 int KOpenSSLProxy::SSL_get_error(SSL *ssl, int rc) {
01056 if (K_SSL_get_error) return (K_SSL_get_error)(ssl,rc);
01057 else return -1;
01058 }
01059
01060
01061 STACK_OF(X509) *KOpenSSLProxy::SSL_get_peer_cert_chain(SSL *s) {
01062 if (K_SSL_get_peer_cert_chain) return (K_SSL_get_peer_cert_chain)(s);
01063 else return 0L;
01064 }
01065
01066
01067 void KOpenSSLProxy::sk_free(STACK *s) {
01068 if (K_sk_free) (K_sk_free)(s);
01069 }
01070
01071
01072 int KOpenSSLProxy::sk_num(STACK *s) {
01073 if (K_sk_num) return (K_sk_num)(s);
01074 else return -1;
01075 }
01076
01077
01078 char *KOpenSSLProxy::sk_pop(STACK *s) {
01079 if (K_sk_pop) return (K_sk_pop)(s);
01080 else return 0L;
01081 }
01082
01083
01084 char *KOpenSSLProxy::sk_value(STACK *s, int n) {
01085 if (K_sk_value) return (K_sk_value)(s, n);
01086 else return 0L;
01087 }
01088
01089
01090 void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) {
01091 if (K_X509_STORE_CTX_set_chain) (K_X509_STORE_CTX_set_chain)(v,x);
01092 }
01093
01094 void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v, int purpose) {
01095 if (K_X509_STORE_CTX_set_purpose) (K_X509_STORE_CTX_set_purpose)(v,purpose);
01096 }
01097
01098
01099 STACK* KOpenSSLProxy::sk_dup(STACK *s) {
01100 if (K_sk_dup) return (K_sk_dup)(s);
01101 else return 0L;
01102 }
01103
01104
01105 STACK* KOpenSSLProxy::sk_new(int (*cmp)()) {
01106 if (K_sk_new) return (K_sk_new)(cmp);
01107 else return 0L;
01108 }
01109
01110
01111 int KOpenSSLProxy::sk_push(STACK* s, char* d) {
01112 if (K_sk_push) return (K_sk_push)(s,d);
01113 else return -1;
01114 }
01115
01116
01117 char *KOpenSSLProxy::i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint) {
01118 if (K_i2s_ASN1_INTEGER) return (K_i2s_ASN1_INTEGER)(meth, aint);
01119 else return 0L;
01120 }
01121
01122
01123 ASN1_INTEGER *KOpenSSLProxy::X509_get_serialNumber(X509 *x) {
01124 if (K_X509_get_serialNumber) return (K_X509_get_serialNumber)(x);
01125 else return 0L;
01126 }
01127
01128
01129 EVP_PKEY *KOpenSSLProxy::X509_get_pubkey(X509 *x) {
01130 if (K_X509_get_pubkey) return (K_X509_get_pubkey)(x);
01131 else return 0L;
01132 }
01133
01134
01135 int KOpenSSLProxy::i2d_PublicKey(EVP_PKEY *a, unsigned char **pp) {
01136 if (K_i2d_PublicKey) return (K_i2d_PublicKey)(a,pp);
01137 else return 0;
01138 }
01139
01140
01141 int KOpenSSLProxy::X509_check_private_key(X509 *x, EVP_PKEY *p) {
01142 if (K_X509_check_private_key) return (K_X509_check_private_key)(x,p);
01143 return -1;
01144 }
01145
01146
01147 char *KOpenSSLProxy::BN_bn2hex(const BIGNUM *a) {
01148 if (K_BN_bn2hex) return (K_BN_bn2hex)(a);
01149 else return 0L;
01150 }
01151
01152
01153 int KOpenSSLProxy::X509_digest(const X509 *x,const EVP_MD *t, unsigned char *md, unsigned int *len) {
01154 if (K_X509_digest) return (K_X509_digest)(x, t, md, len);
01155 else return -1;
01156 }
01157
01158
01159 EVP_MD *KOpenSSLProxy::EVP_md5() {
01160 if (K_EVP_md5) return (K_EVP_md5)();
01161 return 0L;
01162 }
01163
01164
01165 void KOpenSSLProxy::ASN1_INTEGER_free(ASN1_INTEGER *a) {
01166 if (K_ASN1_INTEGER_free) (K_ASN1_INTEGER_free)(a);
01167 }
01168
01169
01170 int KOpenSSLProxy::OBJ_obj2nid(ASN1_OBJECT *o) {
01171 if (K_OBJ_obj2nid) return (K_OBJ_obj2nid)(o);
01172 else return -1;
01173 }
01174
01175
01176 const char * KOpenSSLProxy::OBJ_nid2ln(int n) {
01177 if (K_OBJ_nid2ln) return (K_OBJ_nid2ln)(n);
01178 else return 0L;
01179 }
01180
01181
01182 int KOpenSSLProxy::X509_get_ext_count(X509 *x) {
01183 if (K_X509_get_ext_count) return (K_X509_get_ext_count)(x);
01184 else return -1;
01185 }
01186
01187
01188 int KOpenSSLProxy::X509_get_ext_by_NID(X509 *x, int nid, int lastpos) {
01189 if (K_X509_get_ext_by_NID) return (K_X509_get_ext_by_NID)(x,nid,lastpos);
01190 else return -1;
01191 }
01192
01193
01194 int KOpenSSLProxy::X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos) {
01195 if (K_X509_get_ext_by_OBJ) return (K_X509_get_ext_by_OBJ)(x,obj,lastpos);
01196 else return -1;
01197 }
01198
01199
01200 X509_EXTENSION *KOpenSSLProxy::X509_get_ext(X509 *x, int loc) {
01201 if (K_X509_get_ext) return (K_X509_get_ext)(x,loc);
01202 else return 0L;
01203 }
01204
01205
01206 X509_EXTENSION *KOpenSSLProxy::X509_delete_ext(X509 *x, int loc) {
01207 if (K_X509_delete_ext) return (K_X509_delete_ext)(x,loc);
01208 else return 0L;
01209 }
01210
01211
01212 int KOpenSSLProxy::X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc) {
01213 if (K_X509_add_ext) return (K_X509_add_ext)(x,ex,loc);
01214 else return -1;
01215 }
01216
01217
01218 void *KOpenSSLProxy::X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx) {
01219 if (K_X509_get_ext_d2i) return (K_X509_get_ext_d2i)(x,nid,crit,idx);
01220 else return 0L;
01221 }
01222
01223
01224 char *KOpenSSLProxy::i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5) {
01225 if (K_i2s_ASN1_OCTET_STRING) return (K_i2s_ASN1_OCTET_STRING)(method,ia5);
01226 else return 0L;
01227 }
01228
01229
01230 int KOpenSSLProxy::ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n) {
01231 if (K_ASN1_BIT_STRING_get_bit) return (K_ASN1_BIT_STRING_get_bit)(a,n);
01232 else return -1;
01233 }
01234
01235
01236 PKCS7 *KOpenSSLProxy::PKCS7_new(void) {
01237 if (K_PKCS7_new) return (K_PKCS7_new)();
01238 else return 0L;
01239 }
01240
01241
01242 void KOpenSSLProxy::PKCS7_free(PKCS7 *a) {
01243 if (K_PKCS7_free) (K_PKCS7_free)(a);
01244 }
01245
01246
01247 void KOpenSSLProxy::PKCS7_content_free(PKCS7 *a) {
01248 if (K_PKCS7_content_free) (K_PKCS7_content_free)(a);
01249 }
01250
01251
01252 int KOpenSSLProxy::i2d_PKCS7(PKCS7 *a, unsigned char **pp) {
01253 if (K_i2d_PKCS7) return (K_i2d_PKCS7)(a,pp);
01254 else return -1;
01255 }
01256
01257
01258 PKCS7 *KOpenSSLProxy::d2i_PKCS7(PKCS7 **a, unsigned char **pp,long length) {
01259 if (K_d2i_PKCS7) return (K_d2i_PKCS7)(a,pp,length);
01260 else return 0L;
01261 }
01262
01263
01264 int KOpenSSLProxy::i2d_PKCS7_fp(FILE *fp,PKCS7 *p7) {
01265 if (K_i2d_PKCS7_fp) return (K_i2d_PKCS7_fp)(fp,p7);
01266 else return -1;
01267 }
01268
01269
01270 PKCS7 *KOpenSSLProxy::d2i_PKCS7_fp(FILE *fp,PKCS7 **p7) {
01271 if (K_d2i_PKCS7_fp) return (K_d2i_PKCS7_fp)(fp,p7);
01272 else return 0L;
01273 }
01274
01275
01276 int KOpenSSLProxy::i2d_PKCS7_bio(BIO *bp,PKCS7 *p7) {
01277 if (K_i2d_PKCS7_bio) return (K_i2d_PKCS7_bio)(bp, p7);
01278 else return -1;
01279 }
01280
01281
01282 PKCS7 *KOpenSSLProxy::d2i_PKCS7_bio(BIO *bp,PKCS7 **p7) {
01283 if (K_d2i_PKCS7_bio) return (K_d2i_PKCS7_bio)(bp, p7);
01284 else return 0L;
01285 }
01286
01287
01288 PKCS7 *KOpenSSLProxy::PKCS7_dup(PKCS7 *p7) {
01289 if (K_PKCS7_dup) return (K_PKCS7_dup)(p7);
01290 else return 0L;
01291 }
01292
01293
01294 PKCS7 *KOpenSSLProxy::PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
01295 BIO *data, int flags) {
01296 if (K_PKCS7_sign) return (K_PKCS7_sign)(signcert,pkey,certs,data,flags);
01297 else return 0L;
01298 }
01299
01300
01301 int KOpenSSLProxy::PKCS7_verify(PKCS7* p, STACK_OF(X509)* st, X509_STORE* s, BIO* in, BIO *out, int flags) {
01302 if (K_PKCS7_verify) return (K_PKCS7_verify)(p,st,s,in,out,flags);
01303 else return 0;
01304 }
01305
01306
01307 STACK_OF(X509) *KOpenSSLProxy::PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) {
01308 if (K_PKCS7_get0_signers) return (K_PKCS7_get0_signers)(p7,certs,flags);
01309 else return 0L;
01310 }
01311
01312
01313 PKCS7 *KOpenSSLProxy::PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
01314 int flags) {
01315 if (K_PKCS7_encrypt) return (K_PKCS7_encrypt)(certs,in,cipher,flags);
01316 else return 0L;
01317 }
01318
01319
01320 int KOpenSSLProxy::PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags) {
01321 if (K_PKCS7_decrypt) return (K_PKCS7_decrypt)(p7,pkey,cert,data,flags);
01322 else return 0;
01323 }
01324
01325
01326 STACK_OF(X509_NAME) *KOpenSSLProxy::SSL_load_client_CA_file(const char *file) {
01327 if (K_SSL_load_client_CA_file) return (K_SSL_load_client_CA_file)(file);
01328 else return 0L;
01329 }
01330
01331
01332 STACK_OF(X509_INFO) *KOpenSSLProxy::PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u) {
01333 if (K_PEM_X509_INFO_read) return (K_PEM_X509_INFO_read)(fp,sk,cb,u);
01334 else return 0L;
01335 }
01336
01337
01338 X509 *KOpenSSLProxy::X509_d2i_fp(FILE *out, X509** buf) {
01339 if (K_ASN1_d2i_fp) return reinterpret_cast<X509 *>((K_ASN1_d2i_fp)(reinterpret_cast<char *(*)()>(K_X509_new), reinterpret_cast<char *(*)()>(K_d2i_X509), out, reinterpret_cast<unsigned char **>(buf)));
01340 else return 0L;
01341 }
01342
01343
01344 int KOpenSSLProxy::SSL_peek(SSL *ssl,void *buf,int num) {
01345 if (K_SSL_peek) return (K_SSL_peek)(ssl,buf,num);
01346 else return -1;
01347 }
01348
01349
01350 const char *KOpenSSLProxy::RAND_file_name(char *buf, size_t num) {
01351 if (K_RAND_file_name) return (K_RAND_file_name)(buf, num);
01352 else return 0L;
01353 }
01354
01355
01356 int KOpenSSLProxy::RAND_load_file(const char *filename, long max_bytes) {
01357 if (K_RAND_load_file) return (K_RAND_load_file)(filename, max_bytes);
01358 else return -1;
01359 }
01360
01361
01362 int KOpenSSLProxy::RAND_write_file(const char *filename) {
01363 if (K_RAND_write_file) return (K_RAND_write_file)(filename);
01364 else return -1;
01365 }
01366
01367
01368 int KOpenSSLProxy::X509_PURPOSE_get_count() {
01369 if (K_X509_PURPOSE_get_count) return (K_X509_PURPOSE_get_count)();
01370 else return -1;
01371 }
01372
01373
01374 int KOpenSSLProxy::X509_PURPOSE_get_id(X509_PURPOSE *p) {
01375 if (K_X509_PURPOSE_get_id) return (K_X509_PURPOSE_get_id)(p);
01376 else return -1;
01377 }
01378
01379
01380 int KOpenSSLProxy::X509_check_purpose(X509 *x, int id, int ca) {
01381 if (K_X509_check_purpose) return (K_X509_check_purpose)(x, id, ca);
01382 else return -1;
01383 }
01384
01385
01386 X509_PURPOSE *KOpenSSLProxy::X509_PURPOSE_get0(int idx) {
01387 if (K_X509_PURPOSE_get0) return (K_X509_PURPOSE_get0)(idx);
01388 else return 0L;
01389 }
01390
01391
01392 int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key) {
01393 if (K_EVP_PKEY_assign) return (K_EVP_PKEY_assign)(pkey, type, key);
01394 else return -1;
01395 }
01396
01397
01398 int KOpenSSLProxy::X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) {
01399 if (K_X509_REQ_set_pubkey) return (K_X509_REQ_set_pubkey)(x, pkey);
01400 else return -1;
01401 }
01402
01403
01404 RSA* KOpenSSLProxy::RSA_generate_key(int bits, unsigned long e, void
01405 (*callback)(int,int,void *), void *cb_arg) {
01406 if (K_RSA_generate_key) return (K_RSA_generate_key)(bits, e, callback, cb_arg);
01407 else return 0L;
01408 }
01409
01410 STACK *KOpenSSLProxy::X509_get1_email(X509 *x) {
01411 if (K_X509_get1_email) return (K_X509_get1_email)(x);
01412 else return 0L;
01413 }
01414
01415 void KOpenSSLProxy::X509_email_free(STACK *sk) {
01416 if (K_X509_email_free) (K_X509_email_free)(sk);
01417 }
01418
01419 EVP_CIPHER *KOpenSSLProxy::EVP_des_ede3_cbc() {
01420 if (K_EVP_des_ede3_cbc) return (K_EVP_des_ede3_cbc)();
01421 else return 0L;
01422 }
01423
01424 EVP_CIPHER *KOpenSSLProxy::EVP_des_cbc() {
01425 if (K_EVP_des_cbc) return (K_EVP_des_cbc)();
01426 else return 0L;
01427 }
01428
01429 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_cbc() {
01430 if (K_EVP_rc2_cbc) return (K_EVP_rc2_cbc)();
01431 else return 0L;
01432 }
01433
01434 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_64_cbc() {
01435 if (K_EVP_rc2_64_cbc) return (K_EVP_rc2_64_cbc)();
01436 else return 0L;
01437 }
01438
01439 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_40_cbc() {
01440 if (K_EVP_rc2_40_cbc) return (K_EVP_rc2_40_cbc)();
01441 else return 0L;
01442 }
01443
01444 int KOpenSSLProxy::i2d_X509_REQ_fp(FILE *fp, X509_REQ *x) {
01445 if (K_i2d_X509_REQ_fp) return (K_i2d_X509_REQ_fp)(fp,x);
01446 else return -1;
01447 }
01448
01449
01450 void KOpenSSLProxy::ERR_clear_error() {
01451 if (K_ERR_clear_error) (K_ERR_clear_error)();
01452 }
01453
01454
01455 unsigned long KOpenSSLProxy::ERR_get_error() {
01456 if (K_ERR_get_error) return (K_ERR_get_error)();
01457 else return 0xffffffff;
01458 }
01459
01460
01461 void KOpenSSLProxy::ERR_print_errors_fp(FILE* fp) {
01462 if (K_ERR_print_errors_fp) (K_ERR_print_errors_fp)(fp);
01463 }
01464
01465
01466 SSL_SESSION *KOpenSSLProxy::SSL_get1_session(SSL *ssl) {
01467 if (K_SSL_get1_session) return (K_SSL_get1_session)(ssl);
01468 else return 0L;
01469 }
01470
01471
01472 void KOpenSSLProxy::SSL_SESSION_free(SSL_SESSION *session) {
01473 if (K_SSL_SESSION_free) (K_SSL_SESSION_free)(session);
01474 }
01475
01476
01477 int KOpenSSLProxy::SSL_set_session(SSL *ssl, SSL_SESSION *session) {
01478 if (K_SSL_set_session) return (K_SSL_set_session)(ssl, session);
01479 else return -1;
01480 }
01481
01482
01483 SSL_SESSION *KOpenSSLProxy::d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, long length) {
01484 if (K_d2i_SSL_SESSION) return (K_d2i_SSL_SESSION)(a, pp, length);
01485 else return 0L;
01486 }
01487
01488
01489 int KOpenSSLProxy::i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) {
01490 if (K_i2d_SSL_SESSION) return (K_i2d_SSL_SESSION)(in, pp);
01491 else return -1;
01492 }
01493
01494
01495 int KOpenSSLProxy::i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *p) {
01496 if (K_i2d_PrivateKey_fp) return (K_i2d_PrivateKey_fp)(fp, p);
01497 else return -1;
01498 }
01499
01500
01501 int KOpenSSLProxy::i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *p, const EVP_CIPHER *c, char *k, int klen, pem_password_cb *cb, void *u) {
01502 if (K_i2d_PKCS8PrivateKey_fp) return (K_i2d_PKCS8PrivateKey_fp)(fp, p, c, k, klen, cb, u);
01503 else return -1;
01504 }
01505
01506
01507 void KOpenSSLProxy::RSA_free(RSA *rsa) {
01508 if (K_RSA_free) (K_RSA_free)(rsa);
01509 }
01510
01511
01512 EVP_CIPHER *KOpenSSLProxy::EVP_bf_cbc() {
01513 if (K_EVP_bf_cbc) return (K_EVP_bf_cbc)();
01514 return 0L;
01515 }
01516
01517
01518 int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md) {
01519 if (K_X509_REQ_sign) return (K_X509_REQ_sign)(x, pkey, md);
01520 return -1;
01521 }
01522
01523
01524 int KOpenSSLProxy::X509_NAME_add_entry_by_txt(X509_NAME *name, char *field,
01525 int type, unsigned char *bytes, int len, int loc, int set) {
01526 if (K_X509_NAME_add_entry_by_txt) return (K_X509_NAME_add_entry_by_txt)(name, field, type, bytes, len, loc, set);
01527 return -1;
01528 }
01529
01530
01531 X509_NAME *KOpenSSLProxy::X509_NAME_new() {
01532 if (K_X509_NAME_new) return (K_X509_NAME_new)();
01533 return 0L;
01534 }
01535
01536
01537 int KOpenSSLProxy::X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name) {
01538 if (K_X509_REQ_set_subject_name) return (K_X509_REQ_set_subject_name)(req, name);
01539 return -1;
01540 }
01541
01542
01543 unsigned char *KOpenSSLProxy::ASN1_STRING_data(ASN1_STRING *x) {
01544 if (K_ASN1_STRING_data) return (K_ASN1_STRING_data)(x);
01545 return 0L;
01546 }
01547
01548 STACK_OF(SSL_CIPHER) *KOpenSSLProxy::SSL_get_ciphers(const SSL* ssl) {
01549 if (K_SSL_get_ciphers) return (K_SSL_get_ciphers)(ssl);
01550 return 0L;
01551 }
01552
01553 #endif
01554