22 #include <ksslconfig.h>
25 #include <openssl/opensslv.h>
32 #include <QtCore/QCoreApplication>
33 #include <QtCore/QFile>
34 #include <QtCore/QRegExp>
42 static int (*K_SSL_connect) (SSL *) = 0L;
43 static int (*K_SSL_accept) (SSL *) = 0L;
44 static int (*K_SSL_read) (SSL *,
void *, int) = 0L;
45 static int (*K_SSL_write) (SSL *,
const void *, int) = 0L;
46 static SSL *(*K_SSL_new) (SSL_CTX *) = 0L;
47 static void (*K_SSL_free) (SSL *) = 0L;
48 static int (*K_SSL_shutdown) (SSL *) = 0L;
49 static SSL_CTX *(*K_SSL_CTX_new)(SSL_METHOD *) = 0L;
50 static void (*K_SSL_CTX_free) (SSL_CTX *) = 0L;
51 static int (*K_SSL_set_fd) (SSL *, int) = 0L;
52 static int (*K_SSL_pending) (SSL *) = 0L;
53 static int (*K_SSL_peek) (SSL *,
void *, int) = 0L;
54 static int (*K_SSL_CTX_set_cipher_list)(SSL_CTX *,
const char *) = 0L;
55 static void (*K_SSL_CTX_set_verify)(SSL_CTX *, int,
56 int (*)(int, X509_STORE_CTX *)) = 0L;
57 static int (*K_SSL_use_certificate)(SSL *, X509 *) = 0L;
58 static SSL_CIPHER *(*K_SSL_get_current_cipher)(SSL *) = 0L;
59 static long (*K_SSL_ctrl) (SSL *,int, long,
char *) = 0L;
60 static int (*K_RAND_egd) (
const char *) = 0L;
61 static const char* (*K_RAND_file_name) (
char *, size_t) = 0L;
62 static int (*K_RAND_load_file) (
const char *, long) = 0L;
63 static int (*K_RAND_write_file) (
const char *) = 0L;
64 static SSL_METHOD * (*K_TLSv1_client_method) () = 0L;
65 static SSL_METHOD * (*K_SSLv23_client_method) () = 0L;
66 static X509 * (*K_SSL_get_peer_certificate) (SSL *) = 0L;
67 static int (*K_SSL_CIPHER_get_bits) (SSL_CIPHER *,
int *) = 0L;
68 static char * (*K_SSL_CIPHER_get_version) (SSL_CIPHER *) = 0L;
69 static const char * (*K_SSL_CIPHER_get_name) (SSL_CIPHER *) = 0L;
70 static char * (*K_SSL_CIPHER_description) (SSL_CIPHER *,
char *, int) = 0L;
71 static X509 * (*K_d2i_X509) (X509 **,
unsigned char **,long) = 0L;
72 static int (*K_i2d_X509) (X509 *,
unsigned char **) = 0L;
73 static int (*K_X509_cmp) (X509 *, X509 *) = 0L;
74 static void (*K_X509_STORE_CTX_free) (X509_STORE_CTX *) = 0L;
75 static int (*K_X509_verify_cert) (X509_STORE_CTX *) = 0L;
76 static X509_STORE_CTX *(*K_X509_STORE_CTX_new) (void) = 0L;
77 static void (*K_X509_STORE_free) (X509_STORE *) = 0L;
78 static void (*K_X509_STORE_set_verify_cb)(X509_STORE *, int (*)(int, X509_STORE_CTX *)) = 0L;
79 static X509_STORE *(*K_X509_STORE_new) (void) = 0L;
80 static void (*K_X509_free) (X509 *) = 0L;
81 static char *(*K_X509_NAME_oneline) (X509_NAME *,
char *,int) = 0L;
82 static X509_NAME *(*K_X509_get_subject_name) (X509 *) = 0L;
83 static X509_NAME *(*K_X509_get_issuer_name) (X509 *) = 0L;
84 static void (*K_X509_get0_signature)(
const ASN1_BIT_STRING **psig,
const X509_ALGOR **palg,
const X509 *x) = 0L;
85 static X509_LOOKUP *(*K_X509_STORE_add_lookup) (X509_STORE *, X509_LOOKUP_METHOD *) = 0L;
86 static X509_LOOKUP_METHOD *(*K_X509_LOOKUP_file)(void) = 0L;
87 static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = 0L;
88 static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int,
const char *, long,
char **) = 0L;
89 static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *,
STACK_OF(X509) *) = 0L;
90 #if OPENSSL_VERSION_NUMBER < 0x10100000L
91 static void (*K_CRYPTO_free) (
void *) = 0L;
93 static void (*K_CRYPTO_free)(
void *,
const char *, int) = 0L;
95 static X509* (*K_X509_dup) (X509 *) = 0L;
96 static ASN1_TIME *(*K_X509_getm_notBefore)(
const X509 *) = 0L;
97 static ASN1_TIME *(*K_X509_getm_notAfter)(
const X509 *) = 0L;
98 static BIO_METHOD *(*K_BIO_s_mem) (void) = 0L;
99 static BIO* (*K_BIO_new) (BIO_METHOD *) = 0L;
100 static BIO* (*K_BIO_new_fp) (FILE *, int) = 0L;
101 static BIO* (*K_BIO_new_mem_buf) (
void *, int) = 0L;
102 static int (*K_BIO_free) (BIO *) = 0L;
103 static long (*K_BIO_ctrl) (BIO *,int,long,
void *) = 0L;
104 static int (*K_BIO_write) (BIO *b,
const void *data,
int len) = 0L;
105 static int (*K_PEM_ASN1_write_bio) (int (*)(),
const char *,BIO *,
char *,
106 const EVP_CIPHER *,
unsigned char *,
int ,
107 pem_password_cb *,
void *) = 0L;
108 static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,
unsigned char *) = 0L;
109 static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
110 static int (*K_X509_print_fp) (FILE *, X509*) = 0L;
111 static int (*K_i2d_PKCS12) (PKCS12*,
unsigned char**) = 0L;
112 static int (*K_i2d_PKCS12_fp) (FILE *, PKCS12*) = 0L;
113 static int (*K_PKCS12_newpass) (PKCS12*,
char*,
char*) = 0L;
114 static PKCS12* (*K_d2i_PKCS12_fp) (FILE*, PKCS12**) = 0L;
115 static PKCS12* (*K_PKCS12_new) (void) = 0L;
116 static void (*K_PKCS12_free) (PKCS12 *) = 0L;
117 static int (*K_PKCS12_parse) (PKCS12*,
const char *, EVP_PKEY**,
119 static void (*K_EVP_PKEY_free) (EVP_PKEY *) = 0L;
120 static EVP_PKEY* (*K_EVP_PKEY_new) () = 0L;
121 static void (*K_X509_REQ_free) (X509_REQ *) = 0L;
122 static X509_REQ* (*K_X509_REQ_new) () = 0L;
123 static int (*K_SSL_CTX_use_PrivateKey) (SSL_CTX*, EVP_PKEY*) = 0L;
124 static int (*K_SSL_CTX_use_certificate) (SSL_CTX*, X509*) = 0L;
125 static int (*K_SSL_get_error) (SSL*, int) = 0L;
126 static STACK_OF(X509)* (*K_SSL_get_peer_cert_chain) (SSL*) = 0L;
127 static void (*K_X509_STORE_CTX_set_chain) (X509_STORE_CTX *,
STACK_OF(X509)*) = 0L;
128 static void (*K_X509_STORE_CTX_set_purpose) (X509_STORE_CTX *, int) = 0L;
129 static X509 *(*K_X509_STORE_CTX_get_current_cert)(X509_STORE_CTX *) = 0L;
130 static void (*K_X509_STORE_CTX_set_error)(X509_STORE_CTX *, int) = 0L;
131 static int (*K_X509_STORE_CTX_get_error)(X509_STORE_CTX *) = 0L;
132 static void (*K_OPENSSL_sk_free)(STACK *) = 0L;
133 static int (*K_OPENSSL_sk_num)(STACK *) = 0L;
134 static char *(*K_OPENSSL_sk_pop)(STACK *) = 0L;
135 static char *(*K_OPENSSL_sk_value)(STACK *, int) = 0L;
136 static STACK *(*K_OPENSSL_sk_new)(int (*)()) = 0L;
137 static int (*K_OPENSSL_sk_push)(STACK *,
char *) = 0L;
138 static STACK *(*K_OPENSSL_sk_dup)(STACK *) = 0L;
139 static char * (*K_i2s_ASN1_INTEGER) (X509V3_EXT_METHOD *, ASN1_INTEGER *) =0L;
140 static ASN1_INTEGER * (*K_X509_get_serialNumber) (X509 *) = 0L;
141 static EVP_PKEY *(*K_X509_get_pubkey)(X509 *) = 0L;
142 static int (*K_i2d_PublicKey)(EVP_PKEY *,
unsigned char **) = 0L;
143 static int (*K_X509_check_private_key)(X509 *, EVP_PKEY *) = 0L;
144 static char * (*K_BN_bn2hex)(
const BIGNUM *) = 0L;
145 static int (*K_X509_digest)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *) = 0L;
146 static EVP_MD* (*K_EVP_md5)() = 0L;
147 static void (*K_ASN1_INTEGER_free)(ASN1_INTEGER *) = 0L;
148 static int (*K_OBJ_obj2nid)(ASN1_OBJECT *) = 0L;
149 static const char * (*K_OBJ_nid2ln)(int) = 0L;
150 static int (*K_X509_get_ext_count)(X509*) = 0L;
151 static int (*K_X509_get_ext_by_NID)(X509*, int, int) = 0L;
152 static int (*K_X509_get_ext_by_OBJ)(X509*,ASN1_OBJECT*,int) = 0L;
153 static X509_EXTENSION *(*K_X509_get_ext)(X509*,
int loc) = 0L;
154 static X509_EXTENSION *(*K_X509_delete_ext)(X509*, int) = 0L;
155 static int (*K_X509_add_ext)(X509*, X509_EXTENSION*, int) = 0L;
156 static void *(*K_X509_get_ext_d2i)(X509*, int,
int*,
int*) = 0L;
157 static char *(*K_i2s_ASN1_OCTET_STRING)(X509V3_EXT_METHOD*, ASN1_OCTET_STRING*) = 0L;
158 static int (*K_ASN1_BIT_STRING_get_bit)(ASN1_BIT_STRING*, int) = 0L;
159 static PKCS7 *(*K_PKCS7_new)() = 0L;
160 static void (*K_PKCS7_free)(PKCS7*) = 0L;
161 static void (*K_PKCS7_content_free)(PKCS7*) = 0L;
162 static int (*K_i2d_PKCS7)(PKCS7*,
unsigned char**) = 0L;
163 static PKCS7 *(*K_d2i_PKCS7)(PKCS7**,
unsigned char**,long) = 0L;
164 static int (*K_i2d_PKCS7_fp)(FILE*,PKCS7*) = 0L;
165 static PKCS7* (*K_d2i_PKCS7_fp)(FILE*,PKCS7**) = 0L;
166 static int (*K_i2d_PKCS7_bio)(BIO *bp,PKCS7 *p7) = 0L;
167 static PKCS7 *(*K_d2i_PKCS7_bio)(BIO *bp,PKCS7 **p7) = 0L;
168 static PKCS7* (*K_PKCS7_dup)(PKCS7*) = 0L;
169 static STACK_OF(X509_NAME) *(*K_SSL_load_client_CA_file)(
const char*) = 0L;
170 static STACK_OF(X509_INFO) *(*K_PEM_X509_INFO_read)(FILE*,
STACK_OF(X509_INFO)*, pem_password_cb*,
void*) = 0L;
171 static char *(*K_ASN1_d2i_fp)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**) = 0L;
172 static X509 *(*K_X509_new)() = 0L;
173 static int (*K_X509_PURPOSE_get_count)() = 0L;
174 static int (*K_X509_PURPOSE_get_id)(X509_PURPOSE *) = 0L;
175 static int (*K_X509_check_purpose)(X509*,int,int) = 0L;
176 static X509_PURPOSE* (*K_X509_PURPOSE_get0)(int) = 0L;
177 static int (*K_EVP_PKEY_assign)(EVP_PKEY*, int,
char*) = 0L;
178 static int (*K_EVP_PKEY_base_id)(EVP_PKEY *) = 0L;
179 static RSA *(*K_EVP_PKEY_get0_RSA)(EVP_PKEY *) = 0L;
180 static void (*K_RSA_get0_key)(RSA *,
const BIGNUM **,
const BIGNUM **,
const BIGNUM **) = 0L;
181 static DSA *(*K_EVP_PKEY_get0_DSA)(EVP_PKEY *) = 0L;
182 static void (*K_DSA_get0_pqg)(DSA *,
const BIGNUM **,
const BIGNUM **,
const BIGNUM **) = 0L;
183 static void (*K_DSA_get0_key)(DSA *,
const BIGNUM **,
const BIGNUM **) = 0L;
184 static int (*K_X509_REQ_set_pubkey)(X509_REQ*, EVP_PKEY*) = 0L;
185 static RSA *(*K_RSA_generate_key)(int,
unsigned long, void (*)(int,int,
void *),
void *) = 0L;
186 static int (*K_i2d_X509_REQ_fp)(FILE*, X509_REQ*) = 0L;
187 static void (*K_ERR_clear_error)() = 0L;
188 static unsigned long (*K_ERR_get_error)() = 0L;
189 static void (*K_ERR_print_errors_fp)(FILE*) = 0L;
190 static PKCS7 *(*K_PKCS7_sign)(X509*, EVP_PKEY*,
STACK_OF(X509)*, BIO*, int) = 0L;
191 static int (*K_PKCS7_verify)(PKCS7*,
STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int) = 0L;
192 static STACK_OF(X509) *(*K_PKCS7_get0_signers)(PKCS7 *,
STACK_OF(X509) *, int) = 0L;
193 static PKCS7 *(*K_PKCS7_encrypt)(
STACK_OF(X509) *, BIO *, EVP_CIPHER *, int) = 0L;
194 static int (*K_PKCS7_decrypt)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int) = 0L;
195 static SSL_SESSION* (*K_SSL_get1_session)(SSL*) = 0L;
196 static void (*K_SSL_SESSION_free)(SSL_SESSION*) = 0L;
197 static int (*K_SSL_set_session)(SSL*,SSL_SESSION*) = 0L;
198 static SSL_SESSION* (*K_d2i_SSL_SESSION)(SSL_SESSION**,
unsigned char**, long) = 0L;
199 static int (*K_i2d_SSL_SESSION)(SSL_SESSION*,
unsigned char**) = 0L;
200 static STACK *(*K_X509_get1_email)(X509 *x) = 0L;
201 static void (*K_X509_email_free)(STACK *sk) = 0L;
202 static EVP_CIPHER *(*K_EVP_des_ede3_cbc)() = 0L;
203 static EVP_CIPHER *(*K_EVP_des_cbc)() = 0L;
204 static EVP_CIPHER *(*K_EVP_rc2_cbc)() = 0L;
205 static EVP_CIPHER *(*K_EVP_rc2_64_cbc)() = 0L;
206 static EVP_CIPHER *(*K_EVP_rc2_40_cbc)() = 0L;
207 static int (*K_i2d_PrivateKey_fp)(FILE*,EVP_PKEY*) = 0L;
208 static int (*K_i2d_PKCS8PrivateKey_fp)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*) = 0L;
209 static void (*K_RSA_free)(RSA*) = 0L;
210 static EVP_CIPHER *(*K_EVP_bf_cbc)() = 0L;
211 static int (*K_X509_REQ_sign)(X509_REQ*, EVP_PKEY*,
const EVP_MD*) = 0L;
212 static int (*K_X509_NAME_add_entry_by_txt)(X509_NAME*,
char*, int,
unsigned char*, int, int, int) = 0L;
213 static X509_NAME *(*K_X509_NAME_new)() = 0L;
214 static int (*K_X509_REQ_set_subject_name)(X509_REQ*,X509_NAME*) = 0L;
215 static unsigned char *(*K_ASN1_STRING_data)(ASN1_STRING*) = 0L;
216 static int (*K_ASN1_STRING_length)(ASN1_STRING*) = 0L;
217 static STACK_OF(SSL_CIPHER) *(*K_SSL_get_ciphers)(
const SSL *ssl) = 0L;
223 class KOpenSSLProxyPrivate
226 KOpenSSLProxyPrivate()
227 : sslLib(0), cryptoLib(0),
ok(false)
235 static void cleanupKOpenSSLProxy() {
236 delete KOpenSSLProxyPrivate::sSelf;
242 return d->sslLib != 0L;
247 return d->cryptoLib != 0L;
253 KOpenSSLProxyPrivate::sSelf = 0;
258 #include <QtCore/QDir>
259 #include <QtCore/QString>
260 #include <QtCore/QStringList>
265 QString filter =
"lib"+name+
".so.*";
276 uint s = filter.
length()-1;
279 uint endmaj = numberpart.
indexOf(
'.');
283 int maj = numberpart.
left(endmaj).
toInt(&ok);
286 int min = numberpart.
mid(endmaj+1).
toInt(&ok);
289 if (maj > bestmaj || (maj == bestmaj && min > bestmin)) {
302 KOpenSSLProxy::KOpenSSLProxy()
303 : d(new KOpenSSLProxyPrivate())
317 d->cryptoLib =
new KLibrary(
"libeay32.dll");
318 if (!d->cryptoLib->load()) {
322 #elif defined(__OpenBSD__)
324 QString libname = findMostRecentLib(
"/usr/lib" KDELIBSUFF,
"crypto");
326 d->cryptoLib =
new KLibrary(libname);
327 d->cryptoLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
328 if (!d->cryptoLib->load()) {
334 #elif defined(__CYGWIN__)
335 libpaths <<
"/usr/bin/"
338 libnamess <<
"cygssl-0.9.8.dll"
339 <<
"cygssl-0.9.7.dll"
342 libnamesc <<
"cygcrypto-0.9.8.dll"
343 <<
"cygcrypto-0.9.7.dll"
348 <<
"/opt/freeware/lib/"
350 <<
"/usr/lib" KDELIBSUFF
"/"
351 <<
"/usr/ssl/lib" KDELIBSUFF
"/"
352 <<
"/usr/local/lib" KDELIBSUFF
"/"
353 <<
"/usr/local/openssl/lib" KDELIBSUFF
"/"
354 <<
"/usr/local/ssl/lib" KDELIBSUFF
"/"
355 <<
"/opt/openssl/lib" KDELIBSUFF
"/"
356 <<
"/lib" KDELIBSUFF
"/"
364 <<
"libssl.a(libssl.so.0)"
365 #elif defined(__APPLE__)
367 <<
"libssl.0.9.dylib"
369 #ifdef SHLIB_VERSION_NUMBER
370 <<
"libssl.so." SHLIB_VERSION_NUMBER
381 <<
"libcrypto.a(libcrypto.so.0)"
382 #elif defined(__APPLE__)
384 <<
"libcrypto.0.9.dylib"
386 #ifdef SHLIB_VERSION_NUMBER
387 <<
"libcrypto.so." SHLIB_VERSION_NUMBER
408 if (!
access(tmpStr.toLatin1(), R_OK)) {
410 d->cryptoLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
412 if (d->cryptoLib && d->cryptoLib->load()) {
420 if (d->cryptoLib)
break;
425 K_X509_free = (void (*) (X509 *)) d->cryptoLib->resolveFunction(
"X509_free");
426 K_RAND_egd = (int (*)(
const char *)) d->cryptoLib->resolveFunction(
"RAND_egd");
427 K_RAND_load_file = (int (*)(
const char *, long)) d->cryptoLib->resolveFunction(
"RAND_load_file");
428 K_RAND_file_name = (
const char* (*)(
char *, size_t)) d->cryptoLib->resolveFunction(
"RAND_file_name");
429 K_RAND_write_file = (int (*)(
const char *)) d->cryptoLib->resolveFunction(
"RAND_write_file");
430 #if OPENSSL_VERSION_NUMBER < 0x10100000L
431 K_CRYPTO_free = (void (*) (
void *)) d->cryptoLib->resolveFunction(
"CRYPTO_free");
433 K_CRYPTO_free = (void (*)(
void *,
const char *, int)) d->cryptoLib->resolveFunction(
"CRYPTO_free");
435 K_d2i_X509 = (X509 * (*)(X509 **,
unsigned char **,long)) d->cryptoLib->resolveFunction(
"d2i_X509");
436 K_i2d_X509 = (int (*)(X509 *,
unsigned char **)) d->cryptoLib->resolveFunction(
"i2d_X509");
437 K_X509_cmp = (int (*)(X509 *, X509 *)) d->cryptoLib->resolveFunction(
"X509_cmp");
438 K_X509_STORE_CTX_new = (X509_STORE_CTX * (*) (void)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_new");
439 K_X509_STORE_CTX_free = (void (*) (X509_STORE_CTX *)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_free");
440 K_X509_verify_cert = (int (*) (X509_STORE_CTX *)) d->cryptoLib->resolveFunction(
"X509_verify_cert");
441 K_X509_STORE_new = (X509_STORE * (*) (void)) d->cryptoLib->resolveFunction(
"X509_STORE_new");
442 K_X509_STORE_free = (void (*) (X509_STORE *)) d->cryptoLib->resolveFunction(
"X509_STORE_free");
443 K_X509_STORE_set_verify_cb = (void (*)(X509_STORE *, int (*)(int, X509_STORE_CTX *))) d->cryptoLib->resolveFunction(
"X509_STORE_set_verify_cb");
444 K_X509_NAME_oneline = (
char * (*) (X509_NAME *,
char *,int)) d->cryptoLib->resolveFunction(
"X509_NAME_oneline");
445 K_X509_get_subject_name = (X509_NAME * (*) (X509 *)) d->cryptoLib->resolveFunction(
"X509_get_subject_name");
446 K_X509_get_issuer_name = (X509_NAME * (*) (X509 *)) d->cryptoLib->resolveFunction(
"X509_get_issuer_name");
447 K_X509_get0_signature = (void (*)(
const ASN1_BIT_STRING **,
const X509_ALGOR **,
const X509 *)) d->cryptoLib->resolveFunction(
"X509_get0_signature");
448 K_X509_STORE_add_lookup = (X509_LOOKUP *(*) (X509_STORE *, X509_LOOKUP_METHOD *)) d->cryptoLib->resolveFunction(
"X509_STORE_add_lookup");
449 K_X509_LOOKUP_file = (X509_LOOKUP_METHOD *(*)(void)) d->cryptoLib->resolveFunction(
"X509_LOOKUP_file");
450 K_X509_LOOKUP_free = (void (*)(X509_LOOKUP *)) d->cryptoLib->resolveFunction(
"X509_LOOKUP_free");
451 K_X509_LOOKUP_ctrl = (int (*)(X509_LOOKUP *, int,
const char *, long,
char **)) d->cryptoLib->resolveFunction(
"X509_LOOKUP_ctrl");
452 K_X509_STORE_CTX_init = (void (*)(X509_STORE_CTX *, X509_STORE *, X509 *,
STACK_OF(X509) *)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_init");
453 K_X509_dup = (X509* (*)(X509*)) d->cryptoLib->resolveFunction(
"X509_dup");
454 K_X509_getm_notBefore = (ASN1_TIME *(*)(
const X509 *)) d->cryptoLib->resolveFunction(
"X509_getm_notBefore");
455 K_X509_getm_notAfter = (ASN1_TIME *(*)(
const X509 *)) d->cryptoLib->resolveFunction(
"X509_getm_notAfter");
456 K_BIO_s_mem = (BIO_METHOD *(*) (void)) d->cryptoLib->resolveFunction(
"BIO_s_mem");
457 K_BIO_new = (BIO* (*)(BIO_METHOD *)) d->cryptoLib->resolveFunction(
"BIO_new");
458 K_BIO_new_fp = (BIO* (*)(FILE*, int)) d->cryptoLib->resolveFunction(
"BIO_new_fp");
459 K_BIO_new_mem_buf = (BIO* (*)(
void *, int)) d->cryptoLib->resolveFunction(
"BIO_new_mem_buf");
460 K_BIO_free = (int (*)(BIO*)) d->cryptoLib->resolveFunction(
"BIO_free");
461 K_BIO_ctrl = (long (*) (BIO *,int,long,
void *)) d->cryptoLib->resolveFunction(
"BIO_ctrl");
462 K_BIO_write = (int (*) (BIO *b,
const void *data,
int len)) d->cryptoLib->resolveFunction(
"BIO_write");
463 K_PEM_ASN1_write_bio = (int (*)(int (*)(),
const char *,BIO*,
char*,
const EVP_CIPHER *,
unsigned char *,
int, pem_password_cb *,
void *)) d->cryptoLib->resolveFunction(
"PEM_ASN1_write_bio");
464 K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*,
unsigned char *))
465 d->cryptoLib->resolveFunction(
"ASN1_item_i2d_fp");
466 K_NETSCAPE_X509_it = (ASN1_ITEM *) d->cryptoLib->resolveFunction(
"NETSCAPE_X509_it");
467 K_X509_print_fp = (int (*)(FILE*, X509*)) d->cryptoLib->resolveFunction(
"X509_print_fp");
468 K_i2d_PKCS12 = (int (*)(PKCS12*,
unsigned char**)) d->cryptoLib->resolveFunction(
"i2d_PKCS12");
469 K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) d->cryptoLib->resolveFunction(
"i2d_PKCS12_fp");
470 K_PKCS12_newpass = (int (*)(PKCS12*,
char*,
char*)) d->cryptoLib->resolveFunction(
"PKCS12_newpass");
471 K_d2i_PKCS12_fp = (PKCS12* (*)(FILE*, PKCS12**)) d->cryptoLib->resolveFunction(
"d2i_PKCS12_fp");
472 K_PKCS12_new = (PKCS12* (*)()) d->cryptoLib->resolveFunction(
"PKCS12_new");
473 K_PKCS12_free = (void (*)(PKCS12 *)) d->cryptoLib->resolveFunction(
"PKCS12_free");
474 K_PKCS12_parse = (int (*)(PKCS12*,
const char *, EVP_PKEY**,
475 X509**,
STACK_OF(X509)**)) d->cryptoLib->resolveFunction(
"PKCS12_parse");
476 K_EVP_PKEY_free = (void (*) (EVP_PKEY *)) d->cryptoLib->resolveFunction(
"EVP_PKEY_free");
477 K_EVP_PKEY_new = (EVP_PKEY* (*)()) d->cryptoLib->resolveFunction(
"EVP_PKEY_new");
478 K_X509_REQ_free = (void (*)(X509_REQ*)) d->cryptoLib->resolveFunction(
"X509_REQ_free");
479 K_X509_REQ_new = (X509_REQ* (*)()) d->cryptoLib->resolveFunction(
"X509_REQ_new");
480 K_X509_STORE_CTX_set_chain = (void (*)(X509_STORE_CTX *,
STACK_OF(X509)*)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_set_chain");
481 K_X509_STORE_CTX_set_purpose = (void (*)(X509_STORE_CTX *, int)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_set_purpose");
482 K_X509_STORE_CTX_get_current_cert = (X509 * (*)(X509_STORE_CTX *)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_get_current_cert");
483 K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *, int)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_set_error");
484 K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *)) d->cryptoLib->resolveFunction(
"X509_STORE_CTX_get_error");
485 #if OPENSSL_VERSION_NUMBER >= 0x10100000L
486 K_OPENSSL_sk_free = (void (*)(STACK *)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_free");
487 K_OPENSSL_sk_num = (int (*)(STACK *)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_num");
488 K_OPENSSL_sk_pop = (
char *(*)(STACK *)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_pop");
489 K_OPENSSL_sk_value = (
char *(*)(STACK *, int)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_value");
490 K_OPENSSL_sk_new = (STACK * (*)(int (*)())) d->cryptoLib->resolveFunction(
"OPENSSL_sk_new");
491 K_OPENSSL_sk_push = (int (*)(STACK *,
char *)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_push");
492 K_OPENSSL_sk_dup = (STACK * (*)(STACK *)) d->cryptoLib->resolveFunction(
"OPENSSL_sk_dup");
494 K_OPENSSL_sk_free = (void (*)(STACK *)) d->cryptoLib->resolveFunction(
"sk_free");
495 K_OPENSSL_sk_num = (int (*)(STACK *)) d->cryptoLib->resolveFunction(
"sk_num");
496 K_OPENSSL_sk_pop = (
char *(*)(STACK *)) d->cryptoLib->resolveFunction(
"sk_pop");
497 K_OPENSSL_sk_value = (
char *(*)(STACK *, int)) d->cryptoLib->resolveFunction(
"sk_value");
498 K_OPENSSL_sk_new = (STACK * (*)(int (*)())) d->cryptoLib->resolveFunction(
"sk_new");
499 K_OPENSSL_sk_push = (int (*)(STACK *,
char *)) d->cryptoLib->resolveFunction(
"sk_push");
500 K_OPENSSL_sk_dup = (STACK * (*)(STACK *)) d->cryptoLib->resolveFunction(
"sk_dup");
502 K_i2s_ASN1_INTEGER = (
char *(*) (X509V3_EXT_METHOD *, ASN1_INTEGER *)) d->cryptoLib->resolveFunction(
"i2s_ASN1_INTEGER");
503 K_X509_get_serialNumber = (ASN1_INTEGER * (*) (X509 *)) d->cryptoLib->resolveFunction(
"X509_get_serialNumber");
504 K_X509_get_pubkey = (EVP_PKEY *(*)(X509 *)) d->cryptoLib->resolveFunction(
"X509_get_pubkey");
505 K_i2d_PublicKey = (int (*)(EVP_PKEY *,
unsigned char **)) d->cryptoLib->resolveFunction(
"i2d_PublicKey");
506 K_X509_check_private_key = (int (*)(X509 *, EVP_PKEY *)) d->cryptoLib->resolveFunction(
"X509_check_private_key");
507 K_BN_bn2hex = (
char *(*)(
const BIGNUM *)) d->cryptoLib->resolveFunction(
"BN_bn2hex");
508 K_X509_digest = (int (*)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *)) d->cryptoLib->resolveFunction(
"X509_digest");
509 K_EVP_md5 = (EVP_MD *(*)()) d->cryptoLib->resolveFunction(
"EVP_md5");
510 K_ASN1_INTEGER_free = (void (*)(ASN1_INTEGER *)) d->cryptoLib->resolveFunction(
"ASN1_INTEGER_free");
511 K_OBJ_obj2nid = (int (*)(ASN1_OBJECT *)) d->cryptoLib->resolveFunction(
"OBJ_obj2nid");
512 K_OBJ_nid2ln = (
const char *(*)(int)) d->cryptoLib->resolveFunction(
"OBJ_nid2ln");
513 K_X509_get_ext_count = (int (*)(X509*)) d->cryptoLib->resolveFunction(
"X509_get_ext_count");
514 K_X509_get_ext_by_NID = (int (*)(X509*,int,int)) d->cryptoLib->resolveFunction(
"X509_get_ext_by_NID");
515 K_X509_get_ext_by_OBJ = (int (*)(X509*,ASN1_OBJECT*,int)) d->cryptoLib->resolveFunction(
"X509_get_ext_by_OBJ");
516 K_X509_get_ext = (X509_EXTENSION* (*)(X509*,int)) d->cryptoLib->resolveFunction(
"X509_get_ext");
517 K_X509_delete_ext = (X509_EXTENSION* (*)(X509*,int)) d->cryptoLib->resolveFunction(
"X509_delete_ext");
518 K_X509_add_ext = (int (*)(X509*,X509_EXTENSION*,int)) d->cryptoLib->resolveFunction(
"X509_add_ext");
519 K_X509_get_ext_d2i = (
void* (*)(X509*,int,
int*,
int*)) d->cryptoLib->resolveFunction(
"X509_get_ext_d2i");
520 K_i2s_ASN1_OCTET_STRING = (
char *(*)(X509V3_EXT_METHOD*,ASN1_OCTET_STRING*)) d->cryptoLib->resolveFunction(
"i2s_ASN1_OCTET_STRING");
521 K_ASN1_BIT_STRING_get_bit = (int (*)(ASN1_BIT_STRING*,int)) d->cryptoLib->resolveFunction(
"ASN1_BIT_STRING_get_bit");
522 K_PKCS7_new = (PKCS7 *(*)()) d->cryptoLib->resolveFunction(
"PKCS7_new");
523 K_PKCS7_free = (void (*)(PKCS7*)) d->cryptoLib->resolveFunction(
"PKCS7_free");
524 K_PKCS7_content_free = (void (*)(PKCS7*)) d->cryptoLib->resolveFunction(
"PKCS7_content_free");
525 K_i2d_PKCS7 = (int (*)(PKCS7*,
unsigned char**)) d->cryptoLib->resolveFunction(
"i2d_PKCS7");
526 K_i2d_PKCS7_fp = (int (*)(FILE*,PKCS7*)) d->cryptoLib->resolveFunction(
"i2d_PKCS7_fp");
527 K_i2d_PKCS7_bio = (int (*)(BIO *bp,PKCS7 *p7)) d->cryptoLib->resolveFunction(
"i2d_PKCS7_bio");
528 K_d2i_PKCS7 = (PKCS7* (*)(PKCS7**,
unsigned char**,long)) d->cryptoLib->resolveFunction(
"d2i_PKCS7");
529 K_d2i_PKCS7_fp = (PKCS7 *(*)(FILE *,PKCS7**)) d->cryptoLib->resolveFunction(
"d2i_PKCS7_fp");
530 K_d2i_PKCS7_bio = (PKCS7 *(*)(BIO *bp,PKCS7 **p7)) d->cryptoLib->resolveFunction(
"d2i_PKCS7_bio");
531 K_PKCS7_dup = (PKCS7* (*)(PKCS7*)) d->cryptoLib->resolveFunction(
"PKCS7_dup");
532 K_PKCS7_sign = (PKCS7 *(*)(X509*, EVP_PKEY*,
STACK_OF(X509)*, BIO*, int)) d->cryptoLib->resolveFunction(
"PKCS7_sign");
533 K_PKCS7_verify = (int (*)(PKCS7*,
STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int)) d->cryptoLib->resolveFunction(
"PKCS7_verify");
534 K_PKCS7_get0_signers = (
STACK_OF(X509) *(*)(PKCS7 *,
STACK_OF(X509) *, int)) d->cryptoLib->resolveFunction(
"PKCS7_get0_signers");
535 K_PKCS7_encrypt = (PKCS7* (*)(
STACK_OF(X509) *, BIO *, EVP_CIPHER *, int)) d->cryptoLib->resolveFunction(
"PKCS7_encrypt");
536 K_PKCS7_decrypt = (int (*)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int)) d->cryptoLib->resolveFunction(
"PKCS7_decrypt");
537 K_PEM_X509_INFO_read = (
STACK_OF(X509_INFO) *(*)(FILE*,
STACK_OF(X509_INFO)*, pem_password_cb*,
void *)) d->cryptoLib->resolveFunction(
"PEM_X509_INFO_read");
538 K_ASN1_d2i_fp = (
char *(*)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**)) d->cryptoLib->resolveFunction(
"ASN1_d2i_fp");
539 K_X509_new = (X509 *(*)()) d->cryptoLib->resolveFunction(
"X509_new");
540 K_X509_PURPOSE_get_count = (int (*)()) d->cryptoLib->resolveFunction(
"X509_PURPOSE_get_count");
541 K_X509_PURPOSE_get_id = (int (*)(X509_PURPOSE *)) d->cryptoLib->resolveFunction(
"X509_PURPOSE_get_id");
542 K_X509_check_purpose = (int (*)(X509*,int,int)) d->cryptoLib->resolveFunction(
"X509_check_purpose");
543 K_X509_PURPOSE_get0 = (X509_PURPOSE *(*)(int)) d->cryptoLib->resolveFunction(
"X509_PURPOSE_get0");
544 K_EVP_PKEY_assign = (int (*)(EVP_PKEY*, int,
char*)) d->cryptoLib->resolveFunction(
"EVP_PKEY_assign");
545 K_EVP_PKEY_base_id = (int (*)(EVP_PKEY *)) d->cryptoLib->resolveFunction(
"EVP_PKEY_base_id");
546 K_EVP_PKEY_get0_RSA = (RSA *(*)(EVP_PKEY *)) d->cryptoLib->resolveFunction(
"EVP_PKEY_get0_RSA");
547 K_RSA_get0_key = (void (*)(RSA *,
const BIGNUM **,
const BIGNUM **,
const BIGNUM **)) d->cryptoLib->resolveFunction(
"ESA_get0_key");
548 K_EVP_PKEY_get0_DSA = (DSA *(*)(EVP_PKEY *)) d->cryptoLib->resolveFunction(
"EVP_PKEY_get0_DSA");
549 K_DSA_get0_pqg = (void (*)(DSA *,
const BIGNUM **,
const BIGNUM **,
const BIGNUM **)) d->cryptoLib->resolveFunction(
"DSA_get0_pqg");
550 K_DSA_get0_key = (void (*)(DSA *,
const BIGNUM **,
const BIGNUM **)) d->cryptoLib->resolveFunction(
"DSA_get0_key");
551 K_X509_REQ_set_pubkey = (int (*)(X509_REQ*, EVP_PKEY*)) d->cryptoLib->resolveFunction(
"X509_REQ_set_pubkey");
552 K_RSA_generate_key = (RSA* (*)(int,
unsigned long, void (*)(int,int,
void *),
void *)) d->cryptoLib->resolveFunction(
"RSA_generate_key");
553 K_i2d_X509_REQ_fp = (int (*)(FILE *, X509_REQ *)) d->cryptoLib->resolveFunction(
"i2d_X509_REQ_fp");
554 K_ERR_clear_error = (void (*)()) d->cryptoLib->resolveFunction(
"ERR_clear_error");
555 K_ERR_get_error = (
unsigned long (*)()) d->cryptoLib->resolveFunction(
"ERR_get_error");
556 K_ERR_print_errors_fp = (void (*)(FILE*)) d->cryptoLib->resolveFunction(
"ERR_print_errors_fp");
557 K_X509_get1_email = (STACK *(*)(X509 *x)) d->cryptoLib->resolveFunction(
"X509_get1_email");
558 K_X509_email_free = (void (*)(STACK *sk)) d->cryptoLib->resolveFunction(
"X509_email_free");
559 K_EVP_des_ede3_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_des_ede3_cbc");
560 K_EVP_des_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_des_cbc");
561 K_EVP_rc2_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_rc2_cbc");
562 K_EVP_rc2_64_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_rc2_64_cbc");
563 K_EVP_rc2_40_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_rc2_40_cbc");
564 K_i2d_PrivateKey_fp = (int (*)(FILE*,EVP_PKEY*)) d->cryptoLib->resolveFunction(
"i2d_PrivateKey_fp");
565 K_i2d_PKCS8PrivateKey_fp = (int (*)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*)) d->cryptoLib->resolveFunction(
"i2d_PKCS8PrivateKey_fp");
566 K_RSA_free = (void (*)(RSA*)) d->cryptoLib->resolveFunction(
"RSA_free");
567 K_EVP_bf_cbc = (EVP_CIPHER *(*)()) d->cryptoLib->resolveFunction(
"EVP_bf_cbc");
568 K_X509_REQ_sign = (int (*)(X509_REQ*, EVP_PKEY*,
const EVP_MD*)) d->cryptoLib->resolveFunction(
"X509_REQ_sign");
569 K_X509_NAME_add_entry_by_txt = (int (*)(X509_NAME*,
char*, int,
unsigned char*, int, int, int)) d->cryptoLib->resolveFunction(
"X509_NAME_add_entry_by_txt");
570 K_X509_NAME_new = (X509_NAME *(*)()) d->cryptoLib->resolveFunction(
"X509_NAME_new");
571 K_X509_REQ_set_subject_name = (int (*)(X509_REQ*,X509_NAME*)) d->cryptoLib->resolveFunction(
"X509_REQ_set_subject_name");
572 K_ASN1_STRING_data = (
unsigned char *(*)(ASN1_STRING*)) d->cryptoLib->resolveFunction(
"ASN1_STRING_data");
573 K_ASN1_STRING_length = (int (*)(ASN1_STRING*)) d->cryptoLib->resolveFunction(
"ASN1_STRING_length");
578 d->sslLib =
new KLibrary(
"ssleay32.dll");
579 if (!d->sslLib->load()) {
583 #elif defined(__OpenBSD__)
585 QString libname = findMostRecentLib(
"/usr/lib",
"ssl");
588 d->sslLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
589 if (!d->sslLib->load()) {
608 if (!
access(tmpStr.toLatin1(), R_OK)) {
610 d->sslLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
612 if (d->sslLib && d->sslLib->load()) {
620 if (d->sslLib)
break;
627 K_SSL_connect = (int (*)(SSL *)) d->sslLib->resolveFunction(
"SSL_connect");
628 K_SSL_accept = (int (*)(SSL *)) d->sslLib->resolveFunction(
"SSL_accept");
629 K_SSL_read = (int (*)(SSL *,
void *, int)) d->sslLib->resolveFunction(
"SSL_read");
630 K_SSL_write = (int (*)(SSL *,
const void *, int))
631 d->sslLib->resolveFunction(
"SSL_write");
632 K_SSL_new = (SSL* (*)(SSL_CTX *)) d->sslLib->resolveFunction(
"SSL_new");
633 K_SSL_free = (void (*)(SSL *)) d->sslLib->resolveFunction(
"SSL_free");
634 K_SSL_shutdown = (int (*)(SSL *)) d->sslLib->resolveFunction(
"SSL_shutdown");
635 K_SSL_CTX_new = (SSL_CTX* (*)(SSL_METHOD*)) d->sslLib->resolveFunction(
"SSL_CTX_new");
636 K_SSL_CTX_free = (void (*)(SSL_CTX*)) d->sslLib->resolveFunction(
"SSL_CTX_free");
637 K_SSL_set_fd = (int (*)(SSL *, int)) d->sslLib->resolveFunction(
"SSL_set_fd");
638 K_SSL_pending = (int (*)(SSL *)) d->sslLib->resolveFunction(
"SSL_pending");
639 K_SSL_CTX_set_cipher_list = (int (*)(SSL_CTX *,
const char *))
640 d->sslLib->resolveFunction(
"SSL_CTX_set_cipher_list");
641 K_SSL_CTX_set_verify = (void (*)(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*))) d->sslLib->resolveFunction(
"SSL_CTX_set_verify");
642 K_SSL_use_certificate = (int (*)(SSL*, X509*))
643 d->sslLib->resolveFunction(
"SSL_CTX_use_certificate");
644 K_SSL_get_current_cipher = (SSL_CIPHER *(*)(SSL *))
645 d->sslLib->resolveFunction(
"SSL_get_current_cipher");
646 K_SSL_ctrl = (long (*)(SSL * ,int, long,
char *))
647 d->sslLib->resolveFunction(
"SSL_ctrl");
648 K_TLSv1_client_method = (SSL_METHOD *(*)()) d->sslLib->resolveFunction(
"TLSv1_client_method");
649 K_SSLv23_client_method = (SSL_METHOD *(*)()) d->sslLib->resolveFunction(
"SSLv23_client_method");
650 K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) d->sslLib->resolveFunction(
"SSL_get_peer_certificate");
651 K_SSL_CIPHER_get_bits = (int (*)(SSL_CIPHER *,
int *)) d->sslLib->resolveFunction(
"SSL_CIPHER_get_bits");
652 K_SSL_CIPHER_get_version = (
char * (*)(SSL_CIPHER *)) d->sslLib->resolveFunction(
"SSL_CIPHER_get_version");
653 K_SSL_CIPHER_get_name = (
const char * (*)(SSL_CIPHER *)) d->sslLib->resolveFunction(
"SSL_CIPHER_get_name");
654 K_SSL_CIPHER_description = (
char * (*)(SSL_CIPHER *,
char *, int)) d->sslLib->resolveFunction(
"SSL_CIPHER_description");
655 K_SSL_CTX_use_PrivateKey = (int (*)(SSL_CTX*, EVP_PKEY*)) d->sslLib->resolveFunction(
"SSL_CTX_use_PrivateKey");
656 K_SSL_CTX_use_certificate = (int (*)(SSL_CTX*, X509*)) d->sslLib->resolveFunction(
"SSL_CTX_use_certificate");
657 K_SSL_get_error = (int (*)(SSL*, int)) d->sslLib->resolveFunction(
"SSL_get_error");
658 K_SSL_get_peer_cert_chain = (
STACK_OF(X509)* (*)(SSL*)) d->sslLib->resolveFunction(
"SSL_get_peer_cert_chain");
659 K_SSL_load_client_CA_file = (
STACK_OF(X509_NAME)* (*)(
const char *)) d->sslLib->resolveFunction(
"SSL_load_client_CA_file");
660 K_SSL_peek = (int (*)(SSL*,
void*,int)) d->sslLib->resolveFunction(
"SSL_peek");
661 K_SSL_get1_session = (SSL_SESSION* (*)(SSL*)) d->sslLib->resolveFunction(
"SSL_get1_session");
662 K_SSL_SESSION_free = (void (*)(SSL_SESSION*)) d->sslLib->resolveFunction(
"SSL_SESSION_free");
663 K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) d->sslLib->resolveFunction(
"SSL_set_session");
664 K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,
unsigned char**, long)) d->sslLib->resolveFunction(
"d2i_SSL_SESSION");
665 K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,
unsigned char**)) d->sslLib->resolveFunction(
"i2d_SSL_SESSION");
666 K_SSL_get_ciphers = (
STACK_OF(SSL_CIPHER) *(*)(
const SSL*)) d->sslLib->resolveFunction(
"SSL_get_ciphers");
672 x = d->sslLib->resolveFunction(
"SSL_library_init");
674 if (x) ((int (*)())x)();
675 x = d->cryptoLib->resolveFunction(
"OpenSSL_add_all_algorithms");
677 x = d->cryptoLib->resolveFunction(
"OPENSSL_add_all_algorithms");
681 x = d->cryptoLib->resolveFunction(
"OpenSSL_add_all_algorithms_conf");
683 x = d->cryptoLib->resolveFunction(
"OPENSSL_add_all_algorithms_conf");
687 x = d->cryptoLib->resolveFunction(
"OpenSSL_add_all_algorithms_noconf");
689 x = d->cryptoLib->resolveFunction(
"OPENSSL_add_all_algorithms_noconf");
694 x = d->cryptoLib->resolveFunction(
"OpenSSL_add_all_ciphers");
696 x = d->cryptoLib->resolveFunction(
"OPENSSL_add_all_ciphers");
697 if (x) ((void (*)())x)();
698 x = d->cryptoLib->resolveFunction(
"OpenSSL_add_all_digests");
700 x = d->cryptoLib->resolveFunction(
"OPENSSL_add_all_digests");
701 if (x) ((void (*)())x)();
707 KOpenSSLProxy::~KOpenSSLProxy() {
712 d->cryptoLib->unload();
715 KOpenSSLProxyPrivate::sSelf = 0;
724 if(!KOpenSSLProxyPrivate::sSelf) {
726 qAddPostRoutine(KOpenSSLProxyPrivate::cleanupKOpenSSLProxy);
729 return KOpenSSLProxyPrivate::sSelf;
742 int KOpenSSLProxy::SSL_connect(SSL *ssl) {
743 if (K_SSL_connect)
return (K_SSL_connect)(ssl);
748 int KOpenSSLProxy::SSL_accept(SSL *ssl) {
749 if (K_SSL_accept)
return (K_SSL_accept)(ssl);
754 int KOpenSSLProxy::SSL_read(SSL *ssl,
void *buf,
int num) {
755 if (K_SSL_read)
return (K_SSL_read)(ssl, buf, num);
760 int KOpenSSLProxy::SSL_write(SSL *ssl,
const void *buf,
int num) {
761 if (K_SSL_write)
return (K_SSL_write)(ssl, buf, num);
766 SSL *KOpenSSLProxy::SSL_new(SSL_CTX *ctx) {
767 if (K_SSL_new)
return (K_SSL_new)(ctx);
772 void KOpenSSLProxy::SSL_free(SSL *ssl) {
773 if (K_SSL_free) (K_SSL_free)(ssl);
777 int KOpenSSLProxy::SSL_shutdown(SSL *ssl) {
778 if (K_SSL_shutdown)
return (K_SSL_shutdown)(ssl);
783 SSL_CTX *KOpenSSLProxy::SSL_CTX_new(SSL_METHOD *method) {
784 if (K_SSL_CTX_new)
return (K_SSL_CTX_new)(method);
789 void KOpenSSLProxy::SSL_CTX_free(SSL_CTX *ctx) {
790 if (K_SSL_CTX_free) (K_SSL_CTX_free)(ctx);
794 int KOpenSSLProxy::SSL_set_fd(SSL *ssl,
int fd) {
795 if (K_SSL_set_fd)
return (K_SSL_set_fd)(ssl, fd);
800 int KOpenSSLProxy::SSL_pending(SSL *ssl) {
801 if (K_SSL_pending)
return (K_SSL_pending)(ssl);
806 int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx,
const char *str) {
807 if (K_SSL_CTX_set_cipher_list)
return (K_SSL_CTX_set_cipher_list)(ctx, str);
812 void KOpenSSLProxy::SSL_CTX_set_verify(SSL_CTX *ctx,
int mode,
813 int (*verify_callback)(
int, X509_STORE_CTX *)) {
814 if (K_SSL_CTX_set_verify) (K_SSL_CTX_set_verify)(ctx, mode, verify_callback);
818 int KOpenSSLProxy::SSL_use_certificate(SSL *ssl, X509 *x) {
819 if (K_SSL_use_certificate)
return (K_SSL_use_certificate)(ssl, x);
824 SSL_CIPHER *KOpenSSLProxy::SSL_get_current_cipher(SSL *ssl) {
825 if (K_SSL_get_current_cipher)
return (K_SSL_get_current_cipher)(ssl);
830 long KOpenSSLProxy::SSL_ctrl(SSL *ssl,
int cmd,
long larg,
char *parg) {
831 if (K_SSL_ctrl)
return (K_SSL_ctrl)(ssl, cmd, larg, parg);
836 int KOpenSSLProxy::RAND_egd(
const char *path) {
837 if (K_RAND_egd)
return (K_RAND_egd)(path);
842 SSL_METHOD *KOpenSSLProxy::TLSv1_client_method() {
843 if (K_TLSv1_client_method)
return (K_TLSv1_client_method)();
848 SSL_METHOD *KOpenSSLProxy::SSLv23_client_method() {
849 if (K_SSLv23_client_method)
return (K_SSLv23_client_method)();
854 X509 *KOpenSSLProxy::SSL_get_peer_certificate(SSL *s) {
855 if (K_SSL_get_peer_certificate)
return (K_SSL_get_peer_certificate)(s);
860 int KOpenSSLProxy::SSL_CIPHER_get_bits(SSL_CIPHER *c,
int *alg_bits) {
861 if (K_SSL_CIPHER_get_bits)
return (K_SSL_CIPHER_get_bits)(c, alg_bits);
866 char * KOpenSSLProxy::SSL_CIPHER_get_version(SSL_CIPHER *c) {
867 if (K_SSL_CIPHER_get_version)
return (K_SSL_CIPHER_get_version)(c);
872 const char * KOpenSSLProxy::SSL_CIPHER_get_name(SSL_CIPHER *c) {
873 if (K_SSL_CIPHER_get_name)
return (K_SSL_CIPHER_get_name)(c);
878 char * KOpenSSLProxy::SSL_CIPHER_description(SSL_CIPHER *c,
char *buf,
int size) {
879 if (K_SSL_CIPHER_description)
return (K_SSL_CIPHER_description)(c,buf,size);
884 X509 * KOpenSSLProxy::d2i_X509(X509 **a,
unsigned char **pp,
long length) {
885 if (K_d2i_X509)
return (K_d2i_X509)(a,pp,length);
890 int KOpenSSLProxy::i2d_X509(X509 *a,
unsigned char **pp) {
891 if (K_i2d_X509)
return (K_i2d_X509)(a,pp);
896 int KOpenSSLProxy::X509_cmp(X509 *a, X509 *b) {
897 if (K_X509_cmp)
return (K_X509_cmp)(a,b);
902 X509_STORE *KOpenSSLProxy::X509_STORE_new(
void) {
903 if (K_X509_STORE_new)
return (K_X509_STORE_new)();
908 void KOpenSSLProxy::X509_STORE_free(X509_STORE *v) {
909 if (K_X509_STORE_free) (K_X509_STORE_free)(v);
913 void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *store,
int (*verify_cb)(
int, X509_STORE_CTX *))
915 #if OPENSSL_VERSION_NUMBER < 0x10100000L
916 X509_STORE_set_verify_cb_func(store, verify_cb);
918 if (K_X509_STORE_set_verify_cb) (K_X509_STORE_set_verify_cb)(store, verify_cb);
923 X509_STORE_CTX *KOpenSSLProxy::X509_STORE_CTX_new(
void) {
924 if (K_X509_STORE_CTX_new)
return (K_X509_STORE_CTX_new)();
929 void KOpenSSLProxy::X509_STORE_CTX_free(X509_STORE_CTX *ctx) {
930 if (K_X509_STORE_CTX_free) (K_X509_STORE_CTX_free)(ctx);
934 int KOpenSSLProxy::X509_verify_cert(X509_STORE_CTX *ctx) {
935 if (K_X509_verify_cert)
return (K_X509_verify_cert)(ctx);
940 void KOpenSSLProxy::X509_free(X509 *a) {
941 if (K_X509_free) (K_X509_free)(a);
945 char *KOpenSSLProxy::X509_NAME_oneline(X509_NAME *a,
char *buf,
int size) {
946 if (K_X509_NAME_oneline)
return (K_X509_NAME_oneline)(a,buf,size);
951 X509_NAME *KOpenSSLProxy::X509_get_subject_name(X509 *a) {
952 if (K_X509_get_subject_name)
return (K_X509_get_subject_name)(a);
957 X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a) {
958 if (K_X509_get_issuer_name)
return (K_X509_get_issuer_name)(a);
963 void KOpenSSLProxy::X509_get0_signature(
const ASN1_BIT_STRING **psig,
const X509_ALGOR **algor,
const X509 *x)
965 #if OPENSSL_VERSION_NUMBER < 0x10100000L
966 if (psig) *psig = x->signature;
967 if (algor) *algor = x->sig_alg;
969 if (K_X509_get0_signature)
return (K_X509_get0_signature)(psig, algor, x);
974 X509_LOOKUP *KOpenSSLProxy::X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) {
975 if (K_X509_STORE_add_lookup)
return (K_X509_STORE_add_lookup)(v,m);
980 X509_LOOKUP_METHOD *KOpenSSLProxy::X509_LOOKUP_file(
void) {
981 if (K_X509_LOOKUP_file)
return (K_X509_LOOKUP_file)();
986 void KOpenSSLProxy::X509_LOOKUP_free(X509_LOOKUP *x) {
987 if (K_X509_LOOKUP_free) (K_X509_LOOKUP_free)(x);
991 int KOpenSSLProxy::X509_LOOKUP_ctrl(X509_LOOKUP *ctx,
int cmd,
const char *argc,
long argl,
char **ret) {
992 if (K_X509_LOOKUP_ctrl)
return (K_X509_LOOKUP_ctrl)(ctx,cmd,argc,argl,ret);
997 void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
STACK_OF(X509) *chain) {
998 if (K_X509_STORE_CTX_init) (K_X509_STORE_CTX_init)(ctx,store,x509,chain);
1002 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1003 void KOpenSSLProxy::CRYPTO_free(
void *x) {
1004 if (K_CRYPTO_free) (K_CRYPTO_free)(x);
1007 void KOpenSSLProxy::CRYPTO_free(
void *x,
const char *file,
int line)
1009 if (K_CRYPTO_free) K_CRYPTO_free(x, file, line);
1014 X509 *KOpenSSLProxy::X509_dup(X509 *x509) {
1015 if (K_X509_dup)
return (K_X509_dup)(x509);
1020 ASN1_TIME *KOpenSSLProxy::X509_getm_notBefore(
const X509 *x)
1022 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1023 return X509_get_notBefore(x);
1025 if (K_X509_getm_notBefore)
return (K_X509_getm_notBefore)(x);
1031 ASN1_TIME *KOpenSSLProxy::X509_getm_notAfter(
const X509 *x)
1033 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1034 return X509_get_notAfter(x);
1036 if (K_X509_getm_notAfter)
return (K_X509_getm_notAfter)(x);
1042 BIO *KOpenSSLProxy::BIO_new(BIO_METHOD *type) {
1043 if (K_BIO_new)
return (K_BIO_new)(type);
1048 BIO_METHOD *KOpenSSLProxy::BIO_s_mem(
void) {
1049 if (K_BIO_s_mem)
return (K_BIO_s_mem)();
1054 BIO *KOpenSSLProxy::BIO_new_fp(FILE *stream,
int close_flag) {
1055 if (K_BIO_new_fp)
return (K_BIO_new_fp)(stream, close_flag);
1060 BIO *KOpenSSLProxy::BIO_new_mem_buf(
void *buf,
int len) {
1061 if (K_BIO_new_mem_buf)
return (K_BIO_new_mem_buf)(buf,len);
1066 int KOpenSSLProxy::BIO_free(BIO *a) {
1067 if (K_BIO_free)
return (K_BIO_free)(a);
1073 if (K_BIO_ctrl)
return (K_BIO_ctrl)(bp,cmd,larg,parg);
1078 int KOpenSSLProxy::BIO_write(BIO *b,
const void *data,
int len) {
1079 if (K_BIO_write)
return (K_BIO_write)(b, data, len);
1084 int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) {
1085 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);
1089 int KOpenSSLProxy::ASN1_item_i2d_fp(FILE *out,
unsigned char *x) {
1090 if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
1091 return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
1096 int KOpenSSLProxy::X509_print(FILE *
fp, X509 *x) {
1097 if (K_X509_print_fp)
return (K_X509_print_fp)(
fp, x);
1102 PKCS12 *KOpenSSLProxy::d2i_PKCS12_fp(FILE *fp, PKCS12 **p12) {
1103 if (K_d2i_PKCS12_fp)
return (K_d2i_PKCS12_fp)(
fp, p12);
1108 int KOpenSSLProxy::PKCS12_newpass(PKCS12 *p12,
char *oldpass,
char *newpass) {
1109 if (K_PKCS12_newpass)
return (K_PKCS12_newpass)(p12, oldpass, newpass);
1114 int KOpenSSLProxy::i2d_PKCS12(PKCS12 *p12,
unsigned char **p) {
1115 if (K_i2d_PKCS12)
return (K_i2d_PKCS12)(p12, p);
1120 int KOpenSSLProxy::i2d_PKCS12_fp(FILE *fp, PKCS12 *p12) {
1121 if (K_i2d_PKCS12_fp)
return (K_i2d_PKCS12_fp)(
fp, p12);
1126 PKCS12 *KOpenSSLProxy::PKCS12_new(
void) {
1127 if (K_PKCS12_new)
return (K_PKCS12_new)();
1132 void KOpenSSLProxy::PKCS12_free(PKCS12 *a) {
1133 if (K_PKCS12_free) (K_PKCS12_free)(a);
1137 int KOpenSSLProxy::PKCS12_parse(PKCS12 *p12,
const char *pass, EVP_PKEY **pkey,
1138 X509 **cert,
STACK_OF(X509) **ca) {
1139 if (K_PKCS12_parse)
return (K_PKCS12_parse) (p12, pass, pkey, cert, ca);
1144 void KOpenSSLProxy::EVP_PKEY_free(EVP_PKEY *x) {
1145 if (K_EVP_PKEY_free) (K_EVP_PKEY_free)(x);
1149 EVP_PKEY* KOpenSSLProxy::EVP_PKEY_new() {
1150 if (K_EVP_PKEY_new)
return (K_EVP_PKEY_new)();
1155 void KOpenSSLProxy::X509_REQ_free(X509_REQ *x) {
1156 if (K_X509_REQ_free) (K_X509_REQ_free)(x);
1160 X509_REQ* KOpenSSLProxy::X509_REQ_new() {
1161 if (K_X509_REQ_new)
return (K_X509_REQ_new)();
1166 int KOpenSSLProxy::SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) {
1167 if (K_SSL_CTX_use_PrivateKey)
return (K_SSL_CTX_use_PrivateKey)(ctx,pkey);
1172 int KOpenSSLProxy::SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) {
1173 if (K_SSL_CTX_use_certificate)
return (K_SSL_CTX_use_certificate)(ctx,x);
1178 int KOpenSSLProxy::SSL_get_error(SSL *ssl,
int rc) {
1179 if (K_SSL_get_error)
return (K_SSL_get_error)(ssl,rc);
1184 STACK_OF(X509) *KOpenSSLProxy::SSL_get_peer_cert_chain(SSL *s) {
1185 if (K_SSL_get_peer_cert_chain)
return (K_SSL_get_peer_cert_chain)(s);
1190 void KOpenSSLProxy::OPENSSL_sk_free(STACK *s) {
1191 if (K_OPENSSL_sk_free) (K_OPENSSL_sk_free)(s);
1195 int KOpenSSLProxy::OPENSSL_sk_num(STACK *s) {
1196 if (K_OPENSSL_sk_num)
return (K_OPENSSL_sk_num)(s);
1201 char *KOpenSSLProxy::OPENSSL_sk_pop(STACK *s) {
1202 if (K_OPENSSL_sk_pop)
return (K_OPENSSL_sk_pop)(s);
1207 char *KOpenSSLProxy::OPENSSL_sk_value(STACK *s,
int n) {
1208 if (K_OPENSSL_sk_value)
return (K_OPENSSL_sk_value)(s, n);
1213 void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v,
STACK_OF(X509)* x) {
1214 if (K_X509_STORE_CTX_set_chain) (K_X509_STORE_CTX_set_chain)(v,x);
1217 void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v,
int purpose) {
1218 if (K_X509_STORE_CTX_set_purpose) (K_X509_STORE_CTX_set_purpose)(v,purpose);
1222 X509 *KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *v)
1224 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1225 return v->current_cert;
1227 if (K_X509_STORE_CTX_get_current_cert)
return (K_X509_STORE_CTX_get_current_cert)(v);
1233 void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *v,
int error)
1235 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1238 if (K_X509_STORE_CTX_set_error) (K_X509_STORE_CTX_set_error)(v, error);
1243 int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *v)
1245 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1248 if (K_X509_STORE_CTX_get_error)
return (K_X509_STORE_CTX_get_error)(v);
1254 STACK* KOpenSSLProxy::OPENSSL_sk_dup(STACK *s) {
1255 if (K_OPENSSL_sk_dup)
return (K_OPENSSL_sk_dup)(s);
1260 STACK* KOpenSSLProxy::OPENSSL_sk_new(
int (*cmp)()) {
1261 if (K_OPENSSL_sk_new)
return (K_OPENSSL_sk_new)(cmp);
1266 int KOpenSSLProxy::OPENSSL_sk_push(STACK* s,
char* d) {
1267 if (K_OPENSSL_sk_push)
return (K_OPENSSL_sk_push)(s,d);
1272 char *KOpenSSLProxy::i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint) {
1273 if (K_i2s_ASN1_INTEGER)
return (K_i2s_ASN1_INTEGER)(meth, aint);
1278 ASN1_INTEGER *KOpenSSLProxy::X509_get_serialNumber(X509 *x) {
1279 if (K_X509_get_serialNumber)
return (K_X509_get_serialNumber)(x);
1284 EVP_PKEY *KOpenSSLProxy::X509_get_pubkey(X509 *x) {
1285 if (K_X509_get_pubkey)
return (K_X509_get_pubkey)(x);
1290 int KOpenSSLProxy::i2d_PublicKey(EVP_PKEY *a,
unsigned char **pp) {
1291 if (K_i2d_PublicKey)
return (K_i2d_PublicKey)(a,pp);
1296 int KOpenSSLProxy::X509_check_private_key(X509 *x, EVP_PKEY *p) {
1297 if (K_X509_check_private_key)
return (K_X509_check_private_key)(x,p);
1302 char *KOpenSSLProxy::BN_bn2hex(
const BIGNUM *a) {
1303 if (K_BN_bn2hex)
return (K_BN_bn2hex)(a);
1308 int KOpenSSLProxy::X509_digest(
const X509 *x,
const EVP_MD *t,
unsigned char *md,
unsigned int *len) {
1309 if (K_X509_digest)
return (K_X509_digest)(x, t, md, len);
1314 EVP_MD *KOpenSSLProxy::EVP_md5() {
1315 if (K_EVP_md5)
return (K_EVP_md5)();
1320 void KOpenSSLProxy::ASN1_INTEGER_free(ASN1_INTEGER *a) {
1321 if (K_ASN1_INTEGER_free) (K_ASN1_INTEGER_free)(a);
1325 int KOpenSSLProxy::OBJ_obj2nid(ASN1_OBJECT *o) {
1326 if (K_OBJ_obj2nid)
return (K_OBJ_obj2nid)(o);
1331 const char * KOpenSSLProxy::OBJ_nid2ln(
int n) {
1332 if (K_OBJ_nid2ln)
return (K_OBJ_nid2ln)(n);
1337 int KOpenSSLProxy::X509_get_ext_count(X509 *x) {
1338 if (K_X509_get_ext_count)
return (K_X509_get_ext_count)(x);
1343 int KOpenSSLProxy::X509_get_ext_by_NID(X509 *x,
int nid,
int lastpos) {
1344 if (K_X509_get_ext_by_NID)
return (K_X509_get_ext_by_NID)(x,nid,lastpos);
1349 int KOpenSSLProxy::X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,
int lastpos) {
1350 if (K_X509_get_ext_by_OBJ)
return (K_X509_get_ext_by_OBJ)(x,obj,lastpos);
1355 X509_EXTENSION *KOpenSSLProxy::X509_get_ext(X509 *x,
int loc) {
1356 if (K_X509_get_ext)
return (K_X509_get_ext)(x,loc);
1361 X509_EXTENSION *KOpenSSLProxy::X509_delete_ext(X509 *x,
int loc) {
1362 if (K_X509_delete_ext)
return (K_X509_delete_ext)(x,loc);
1367 int KOpenSSLProxy::X509_add_ext(X509 *x, X509_EXTENSION *ex,
int loc) {
1368 if (K_X509_add_ext)
return (K_X509_add_ext)(x,ex,loc);
1373 void *KOpenSSLProxy::X509_get_ext_d2i(X509 *x,
int nid,
int *crit,
int *idx) {
1374 if (K_X509_get_ext_d2i)
return (K_X509_get_ext_d2i)(x,nid,crit,idx);
1379 char *KOpenSSLProxy::i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5) {
1380 if (K_i2s_ASN1_OCTET_STRING)
return (K_i2s_ASN1_OCTET_STRING)(method,ia5);
1385 int KOpenSSLProxy::ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a,
int n) {
1386 if (K_ASN1_BIT_STRING_get_bit)
return (K_ASN1_BIT_STRING_get_bit)(a,n);
1391 PKCS7 *KOpenSSLProxy::PKCS7_new(
void) {
1392 if (K_PKCS7_new)
return (K_PKCS7_new)();
1397 void KOpenSSLProxy::PKCS7_free(PKCS7 *a) {
1398 if (K_PKCS7_free) (K_PKCS7_free)(a);
1402 void KOpenSSLProxy::PKCS7_content_free(PKCS7 *a) {
1403 if (K_PKCS7_content_free) (K_PKCS7_content_free)(a);
1407 int KOpenSSLProxy::i2d_PKCS7(PKCS7 *a,
unsigned char **pp) {
1408 if (K_i2d_PKCS7)
return (K_i2d_PKCS7)(a,pp);
1413 PKCS7 *KOpenSSLProxy::d2i_PKCS7(PKCS7 **a,
unsigned char **pp,
long length) {
1414 if (K_d2i_PKCS7)
return (K_d2i_PKCS7)(a,pp,length);
1419 int KOpenSSLProxy::i2d_PKCS7_fp(FILE *fp,PKCS7 *p7) {
1420 if (K_i2d_PKCS7_fp)
return (K_i2d_PKCS7_fp)(
fp,p7);
1425 PKCS7 *KOpenSSLProxy::d2i_PKCS7_fp(FILE *fp,PKCS7 **p7) {
1426 if (K_d2i_PKCS7_fp)
return (K_d2i_PKCS7_fp)(
fp,p7);
1431 int KOpenSSLProxy::i2d_PKCS7_bio(BIO *bp,PKCS7 *p7) {
1432 if (K_i2d_PKCS7_bio)
return (K_i2d_PKCS7_bio)(bp, p7);
1437 PKCS7 *KOpenSSLProxy::d2i_PKCS7_bio(BIO *bp,PKCS7 **p7) {
1438 if (K_d2i_PKCS7_bio)
return (K_d2i_PKCS7_bio)(bp, p7);
1443 PKCS7 *KOpenSSLProxy::PKCS7_dup(PKCS7 *p7) {
1444 if (K_PKCS7_dup)
return (K_PKCS7_dup)(p7);
1449 PKCS7 *KOpenSSLProxy::PKCS7_sign(X509 *signcert, EVP_PKEY *pkey,
STACK_OF(X509) *certs,
1450 BIO *data,
int flags) {
1451 if (K_PKCS7_sign)
return (K_PKCS7_sign)(signcert,pkey,certs,data,flags);
1456 int KOpenSSLProxy::PKCS7_verify(PKCS7* p,
STACK_OF(X509)* st, X509_STORE* s, BIO* in, BIO *out,
int flags) {
1457 if (K_PKCS7_verify)
return (K_PKCS7_verify)(p,st,s,in,out,flags);
1462 STACK_OF(X509) *KOpenSSLProxy::PKCS7_get0_signers(PKCS7 *p7,
STACK_OF(X509) *certs,
int flags) {
1463 if (K_PKCS7_get0_signers)
return (K_PKCS7_get0_signers)(p7,certs,flags);
1468 PKCS7 *KOpenSSLProxy::PKCS7_encrypt(
STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
1470 if (K_PKCS7_encrypt)
return (K_PKCS7_encrypt)(certs,in,cipher,flags);
1475 int KOpenSSLProxy::PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
int flags) {
1476 if (K_PKCS7_decrypt)
return (K_PKCS7_decrypt)(p7,pkey,cert,data,flags);
1481 STACK_OF(X509_NAME) *KOpenSSLProxy::SSL_load_client_CA_file(
const char *file) {
1482 if (K_SSL_load_client_CA_file)
return (K_SSL_load_client_CA_file)(file);
1487 STACK_OF(X509_INFO) *KOpenSSLProxy::PEM_X509_INFO_read(FILE *fp,
STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
void *u) {
1488 if (K_PEM_X509_INFO_read)
return (K_PEM_X509_INFO_read)(
fp,sk,cb,u);
1493 X509 *KOpenSSLProxy::X509_d2i_fp(FILE *out, X509** buf) {
1494 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)));
1499 int KOpenSSLProxy::SSL_peek(SSL *ssl,
void *buf,
int num) {
1500 if (K_SSL_peek)
return (K_SSL_peek)(ssl,buf,num);
1505 const char *KOpenSSLProxy::RAND_file_name(
char *buf,
size_t num) {
1506 if (K_RAND_file_name)
return (K_RAND_file_name)(buf, num);
1511 int KOpenSSLProxy::RAND_load_file(
const char *filename,
long max_bytes) {
1512 if (K_RAND_load_file)
return (K_RAND_load_file)(filename, max_bytes);
1517 int KOpenSSLProxy::RAND_write_file(
const char *filename) {
1518 if (K_RAND_write_file)
return (K_RAND_write_file)(filename);
1523 int KOpenSSLProxy::X509_PURPOSE_get_count() {
1524 if (K_X509_PURPOSE_get_count)
return (K_X509_PURPOSE_get_count)();
1529 int KOpenSSLProxy::X509_PURPOSE_get_id(X509_PURPOSE *p) {
1530 if (K_X509_PURPOSE_get_id)
return (K_X509_PURPOSE_get_id)(p);
1535 int KOpenSSLProxy::X509_check_purpose(X509 *x,
int id,
int ca) {
1536 if (K_X509_check_purpose)
return (K_X509_check_purpose)(x, id, ca);
1541 X509_PURPOSE *KOpenSSLProxy::X509_PURPOSE_get0(
int idx) {
1542 if (K_X509_PURPOSE_get0)
return (K_X509_PURPOSE_get0)(idx);
1547 int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey,
int type,
char *key) {
1548 if (K_EVP_PKEY_assign)
return (K_EVP_PKEY_assign)(pkey, type, key);
1553 int KOpenSSLProxy::EVP_PKEY_base_id(EVP_PKEY *pkey)
1555 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1558 if (K_EVP_PKEY_base_id)
return (K_EVP_PKEY_base_id)(pkey);
1564 RSA *KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
1566 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1567 return pkey->pkey.rsa;
1569 if (K_EVP_PKEY_get0_RSA)
return (K_EVP_PKEY_get0_RSA)(pkey);
1575 void KOpenSSLProxy::RSA_get0_key(RSA *rsa,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d)
1577 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1582 if (K_RSA_get0_key) (K_RSA_get0_key)(rsa, n, e, d);
1587 DSA *KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey)
1589 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1590 return pkey->pkey.dsa;
1592 if (K_EVP_PKEY_get0_DSA)
return (K_EVP_PKEY_get0_DSA)(pkey);
1598 void KOpenSSLProxy::DSA_get0_pqg(DSA *dsa,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g)
1600 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1605 if (K_DSA_get0_pqg) (K_DSA_get0_pqg)(dsa, p, q, g);
1610 void KOpenSSLProxy::DSA_get0_key(DSA *dsa,
const BIGNUM **pub_key,
const BIGNUM **priv_key)
1612 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1613 if (pub_key) *pub_key = dsa->pub_key;
1614 if (priv_key) *priv_key = dsa->priv_key;
1616 if (K_DSA_get0_key) (K_DSA_get0_key)(dsa, pub_key, priv_key);
1621 int KOpenSSLProxy::X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) {
1622 if (K_X509_REQ_set_pubkey)
return (K_X509_REQ_set_pubkey)(x, pkey);
1627 RSA* KOpenSSLProxy::RSA_generate_key(
int bits,
unsigned long e,
void
1628 (*callback)(
int,
int,
void *),
void *cb_arg) {
1629 if (K_RSA_generate_key)
return (K_RSA_generate_key)(bits, e, callback, cb_arg);
1633 STACK *KOpenSSLProxy::X509_get1_email(X509 *x) {
1634 if (K_X509_get1_email)
return (K_X509_get1_email)(x);
1638 void KOpenSSLProxy::X509_email_free(STACK *sk) {
1639 if (K_X509_email_free) (K_X509_email_free)(sk);
1642 EVP_CIPHER *KOpenSSLProxy::EVP_des_ede3_cbc() {
1643 if (K_EVP_des_ede3_cbc)
return (K_EVP_des_ede3_cbc)();
1647 EVP_CIPHER *KOpenSSLProxy::EVP_des_cbc() {
1648 if (K_EVP_des_cbc)
return (K_EVP_des_cbc)();
1652 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_cbc() {
1653 if (K_EVP_rc2_cbc)
return (K_EVP_rc2_cbc)();
1657 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_64_cbc() {
1658 if (K_EVP_rc2_64_cbc)
return (K_EVP_rc2_64_cbc)();
1662 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_40_cbc() {
1663 if (K_EVP_rc2_40_cbc)
return (K_EVP_rc2_40_cbc)();
1667 int KOpenSSLProxy::i2d_X509_REQ_fp(FILE *fp, X509_REQ *x) {
1668 if (K_i2d_X509_REQ_fp)
return (K_i2d_X509_REQ_fp)(
fp,x);
1673 void KOpenSSLProxy::ERR_clear_error() {
1674 if (K_ERR_clear_error) (K_ERR_clear_error)();
1678 unsigned long KOpenSSLProxy::ERR_get_error() {
1679 if (K_ERR_get_error)
return (K_ERR_get_error)();
1680 else return 0xffffffff;
1684 void KOpenSSLProxy::ERR_print_errors_fp(FILE* fp) {
1685 if (K_ERR_print_errors_fp) (K_ERR_print_errors_fp)(fp);
1689 SSL_SESSION *KOpenSSLProxy::SSL_get1_session(SSL *ssl) {
1690 if (K_SSL_get1_session)
return (K_SSL_get1_session)(ssl);
1695 void KOpenSSLProxy::SSL_SESSION_free(SSL_SESSION *session) {
1696 if (K_SSL_SESSION_free) (K_SSL_SESSION_free)(session);
1700 int KOpenSSLProxy::SSL_set_session(SSL *ssl, SSL_SESSION *session) {
1701 if (K_SSL_set_session)
return (K_SSL_set_session)(ssl, session);
1706 SSL_SESSION *KOpenSSLProxy::d2i_SSL_SESSION(SSL_SESSION **a,
unsigned char **pp,
long length) {
1707 if (K_d2i_SSL_SESSION)
return (K_d2i_SSL_SESSION)(a, pp, length);
1712 int KOpenSSLProxy::i2d_SSL_SESSION(SSL_SESSION *in,
unsigned char **pp) {
1713 if (K_i2d_SSL_SESSION)
return (K_i2d_SSL_SESSION)(in, pp);
1718 int KOpenSSLProxy::i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *p) {
1719 if (K_i2d_PrivateKey_fp)
return (K_i2d_PrivateKey_fp)(
fp, p);
1724 int KOpenSSLProxy::i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *p,
const EVP_CIPHER *c,
char *k,
int klen, pem_password_cb *cb,
void *u) {
1725 if (K_i2d_PKCS8PrivateKey_fp)
return (K_i2d_PKCS8PrivateKey_fp)(
fp, p, c, k, klen, cb, u);
1730 void KOpenSSLProxy::RSA_free(RSA *rsa) {
1731 if (K_RSA_free) (K_RSA_free)(rsa);
1735 EVP_CIPHER *KOpenSSLProxy::EVP_bf_cbc() {
1736 if (K_EVP_bf_cbc)
return (K_EVP_bf_cbc)();
1741 int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey,
const EVP_MD *md) {
1742 if (K_X509_REQ_sign)
return (K_X509_REQ_sign)(x, pkey, md);
1747 int KOpenSSLProxy::X509_NAME_add_entry_by_txt(X509_NAME *name,
char *field,
1748 int type,
unsigned char *bytes,
int len,
int loc,
int set) {
1749 if (K_X509_NAME_add_entry_by_txt)
return (K_X509_NAME_add_entry_by_txt)(name, field, type, bytes, len, loc, set);
1754 X509_NAME *KOpenSSLProxy::X509_NAME_new() {
1755 if (K_X509_NAME_new)
return (K_X509_NAME_new)();
1760 int KOpenSSLProxy::X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name) {
1761 if (K_X509_REQ_set_subject_name)
return (K_X509_REQ_set_subject_name)(req, name);
1766 unsigned char *KOpenSSLProxy::ASN1_STRING_data(ASN1_STRING *x) {
1767 if (K_ASN1_STRING_data)
return (K_ASN1_STRING_data)(x);
1772 int KOpenSSLProxy::ASN1_STRING_length(ASN1_STRING *x) {
1773 if (K_ASN1_STRING_length)
return (K_ASN1_STRING_length)(x);
1778 STACK_OF(SSL_CIPHER) *KOpenSSLProxy::SSL_get_ciphers(
const SSL* ssl) {
1779 if (K_SSL_get_ciphers)
return (K_SSL_get_ciphers)(ssl);
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
bool hasLibCrypto() const
Return true of libcrypto was found and loaded.
QString & remove(int position, int n)
Dynamically load and wrap OpenSSL.
int toInt(bool *ok, int base) const
const char * constData() const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QByteArray toLatin1() const
QString mid(int position, int n) const
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
int access(const QString &path, int mode)
QString left(int n) const
const_iterator constEnd() const
const_iterator constBegin() const
bool hasLibSSL() const
Return true of libssl was found and loaded.
static KOpenSSLProxy * self()
Return an instance of class KOpenSSLProxy * You cannot delete this object.
void destroy()
Destroy the class and start over - don't use this unless you know what you are doing.
void(* void_function_ptr)()