24 #include <openssl/opensslv.h>
28 #include <tdeconfig.h>
29 #include <kstaticdeleter.h>
36 #define STRINGIFY(x) #x
38 #define GET_CRYPTOLIB_SYMBOL(a) ((_cryptoLib->hasSymbol(a)) ? _cryptoLib->symbol(a) : NULL)
39 #define GET_SSLLIB_SYMBOL(a) ((_sslLib->hasSymbol(a)) ? _sslLib->symbol(a) : NULL)
42 #if !defined(OPENSSL_INIT_ADD_ALL_CIPHERS)
43 # define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
44 # define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
45 # define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
50 static int (*K_SSL_connect) (SSL *) = 0L;
51 static int (*K_SSL_accept) (SSL *) = 0L;
52 static int (*K_SSL_read) (SSL *,
void *, int) = 0L;
53 static int (*K_SSL_write) (SSL *,
const void *, int) = 0L;
54 static SSL *(*K_SSL_new) (SSL_CTX *) = 0L;
55 static void (*K_SSL_free) (SSL *) = 0L;
56 static int (*K_SSL_shutdown) (SSL *) = 0L;
57 static SSL_CTX *(*K_SSL_CTX_new)(SSL_METHOD *) = 0L;
58 static void (*K_SSL_CTX_free) (SSL_CTX *) = 0L;
59 static int (*K_SSL_set_fd) (SSL *, int) = 0L;
60 static int (*K_SSL_pending) (SSL *) = 0L;
61 static int (*K_SSL_peek) (SSL *,
void *, int) = 0L;
62 static int (*K_SSL_CTX_set_cipher_list)(SSL_CTX *,
const char *) = 0L;
63 static void (*K_SSL_CTX_set_verify)(SSL_CTX *, int,
64 int (*)(int, X509_STORE_CTX *)) = 0L;
65 static int (*K_SSL_use_certificate)(SSL *, X509 *) = 0L;
66 static SSL_CIPHER *(*K_SSL_get_current_cipher)(SSL *) = 0L;
67 static long (*K_SSL_set_options)(SSL *ssl,
long options) = 0L;
68 static int (*K_SSL_session_reused)(SSL *ssl) = 0L;
69 static long (*K_SSL_ctrl) (SSL *,int, long,
void *) = 0L;
70 static int (*K_RAND_egd) (
const char *) = 0L;
71 static const char* (*K_RAND_file_name) (
char *, size_t) = 0L;
72 static int (*K_RAND_load_file) (
const char *, long) = 0L;
73 static int (*K_RAND_write_file) (
const char *) = 0L;
74 static SSL_METHOD * (*K_TLSv1_client_method) () = 0L;
75 static SSL_METHOD * (*K_SSLv2_client_method) () = 0L;
76 static SSL_METHOD * (*K_SSLv3_client_method) () = 0L;
77 static SSL_METHOD * (*K_TLS_client_method) () = 0L;
78 static X509 * (*K_SSL_get_peer_certificate) (SSL *) = 0L;
79 static int (*K_SSL_CIPHER_get_bits) (SSL_CIPHER *,
int *) = 0L;
80 static char * (*K_SSL_CIPHER_get_version) (SSL_CIPHER *) = 0L;
81 static const char * (*K_SSL_CIPHER_get_name) (SSL_CIPHER *) = 0L;
82 static char * (*K_SSL_CIPHER_description) (SSL_CIPHER *,
char *, int) = 0L;
83 static X509 * (*K_d2i_X509) (X509 **,
unsigned char **,long) = 0L;
84 static X509_CRL * (*K_d2i_X509_CRL) (X509_CRL **,
unsigned char **,long) = 0L;
85 static int (*K_i2d_X509) (X509 *,
unsigned char **) = 0L;
86 static int (*K_X509_cmp) (X509 *, X509 *) = 0L;
87 static int (*K_X509_subject_name_cmp) (
const X509 *,
const X509 *) = 0L;
88 static void (*K_X509_STORE_CTX_free) (X509_STORE_CTX *) = 0L;
89 static int (*K_X509_verify_cert) (X509_STORE_CTX *) = 0L;
90 static X509_STORE_CTX *(*K_X509_STORE_CTX_new) (void) = 0L;
91 static void (*K_X509_STORE_free) (X509_STORE *) = 0L;
92 static X509_STORE *(*K_X509_STORE_new) (void) = 0L;
93 static void (*K_X509_free) (X509 *) = 0L;
94 static void (*K_X509_CRL_free) (X509_CRL *) = 0L;
95 static char *(*K_X509_NAME_oneline) (X509_NAME *,
char *,int) = 0L;
96 static X509_NAME *(*K_X509_get_subject_name) (X509 *) = 0L;
97 static X509_NAME *(*K_X509_get_issuer_name) (X509 *) = 0L;
98 static X509_LOOKUP *(*K_X509_STORE_add_lookup) (X509_STORE *, X509_LOOKUP_METHOD *) = 0L;
99 static X509_LOOKUP_METHOD *(*K_X509_LOOKUP_file)(void) = 0L;
100 static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = 0L;
101 static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int,
const char *, long,
char **) = 0L;
102 static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *) = 0L;
103 static void (*K_CRYPTO_free) (
void *) = 0L;
104 static X509* (*K_X509_dup) (X509 *) = 0L;
105 static void (*K_X509_get0_signature)(
const ASN1_BIT_STRING **psig,
106 const X509_ALGOR **palg,
const X509 *x) = 0L;
107 static BIO_METHOD *(*K_BIO_s_mem) (void) = 0L;
108 static BIO* (*K_BIO_new) (BIO_METHOD *) = 0L;
109 static BIO* (*K_BIO_new_fp) (FILE *, int) = 0L;
110 static BIO* (*K_BIO_new_mem_buf) (
void *, int) = 0L;
111 static int (*K_BIO_free) (BIO *) = 0L;
112 static long (*K_BIO_ctrl) (BIO *,int,long,
void *) = 0L;
113 static int (*K_BIO_write) (BIO *b,
const void *data,
int len) = 0L;
114 static void* (*K_BIO_get_data) (BIO *a) = 0L;
115 static int (*K_PEM_ASN1_write_bio) (int (*)(),
const char *,BIO *,
char *,
116 const EVP_CIPHER *,
unsigned char *,
int ,
117 pem_password_cb *,
void *) = 0L;
118 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
119 static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,
unsigned char *) = 0L;
120 static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
122 static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
123 static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,
unsigned char *) = 0L;
124 static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *,
unsigned char **) = 0L;
126 static int (*K_X509_print_fp) (FILE *, X509*) = 0L;
127 static int (*K_i2d_PKCS12) (PKCS12*,
unsigned char**) = 0L;
128 static int (*K_i2d_PKCS12_fp) (FILE *, PKCS12*) = 0L;
129 static int (*K_PKCS12_newpass) (PKCS12*,
char*,
char*) = 0L;
130 static PKCS12* (*K_d2i_PKCS12_fp) (FILE*, PKCS12**) = 0L;
131 static PKCS12* (*K_PKCS12_new) (void) = 0L;
132 static void (*K_PKCS12_free) (PKCS12 *) = 0L;
133 static int (*K_PKCS12_parse) (PKCS12*,
const char *, EVP_PKEY**,
134 X509**, STACK_OF(X509)**) = 0L;
135 static void (*K_EVP_PKEY_free) (EVP_PKEY *) = 0L;
136 static EVP_PKEY* (*K_EVP_PKEY_new) () = 0L;
137 static int (*K_EVP_PKEY_base_id)(
const EVP_PKEY *pkey) = 0L;
138 static RSA* (*K_EVP_PKEY_get0_RSA)(EVP_PKEY *pkey) = 0L;
139 static DSA* (*K_EVP_PKEY_get0_DSA)(EVP_PKEY *pkey) = 0L;
140 static void (*K_X509_REQ_free) (X509_REQ *) = 0L;
141 static X509_REQ* (*K_X509_REQ_new) () = 0L;
142 static int (*K_SSL_CTX_use_PrivateKey) (SSL_CTX*, EVP_PKEY*) = 0L;
143 static int (*K_SSL_CTX_use_certificate) (SSL_CTX*, X509*) = 0L;
144 static int (*K_SSL_get_error) (SSL*, int) = 0L;
145 static STACK_OF(X509)* (*K_SSL_get_peer_cert_chain) (SSL*) = 0L;
146 static void (*K_X509_STORE_CTX_set0_untrusted) (X509_STORE_CTX *, STACK_OF(X509)*) = 0L;
147 static void (*K_X509_STORE_CTX_set_purpose) (X509_STORE_CTX *, int) = 0L;
148 static void (*K_sk_free) (STACK*) = 0L;
149 static int (*K_sk_num) (STACK*) = 0L;
150 static char* (*K_sk_pop) (STACK*) = 0L;
151 static char* (*K_sk_value) (STACK*, int) = 0L;
152 static STACK* (*K_sk_new) (int (*)()) = 0L;
153 static int (*K_sk_push) (STACK*,
char*) = 0L;
154 static STACK* (*K_sk_dup) (
const STACK *) = 0L;
155 static char * (*K_i2s_ASN1_INTEGER) (X509V3_EXT_METHOD *, ASN1_INTEGER *) =0L;
156 static ASN1_INTEGER * (*K_X509_get_serialNumber) (X509 *) = 0L;
157 static EVP_PKEY *(*K_X509_get_pubkey)(X509 *) = 0L;
158 static int (*K_i2d_PublicKey)(EVP_PKEY *,
unsigned char **) = 0L;
159 static int (*K_X509_check_private_key)(X509 *, EVP_PKEY *) = 0L;
160 static char * (*K_BN_bn2hex)(
const BIGNUM *) = 0L;
161 static int (*K_X509_digest)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *) = 0L;
162 static EVP_MD* (*K_EVP_md5)() = 0L;
163 static void (*K_ASN1_INTEGER_free)(ASN1_INTEGER *) = 0L;
164 static int (*K_OBJ_obj2nid)(ASN1_OBJECT *) = 0L;
165 static const char * (*K_OBJ_nid2ln)(int) = 0L;
166 static int (*K_X509_get_ext_count)(X509*) = 0L;
167 static int (*K_X509_get_ext_by_NID)(X509*, int, int) = 0L;
168 static int (*K_X509_get_ext_by_OBJ)(X509*,ASN1_OBJECT*,int) = 0L;
169 static X509_EXTENSION *(*K_X509_get_ext)(X509*,
int loc) = 0L;
170 static X509_EXTENSION *(*K_X509_delete_ext)(X509*, int) = 0L;
171 static int (*K_X509_add_ext)(X509*, X509_EXTENSION*, int) = 0L;
172 static void *(*K_X509_get_ext_d2i)(X509*, int,
int*,
int*) = 0L;
173 static char *(*K_i2s_ASN1_OCTET_STRING)(X509V3_EXT_METHOD*, ASN1_OCTET_STRING*) = 0L;
174 static int (*K_ASN1_BIT_STRING_get_bit)(ASN1_BIT_STRING*, int) = 0L;
175 static PKCS7 *(*K_PKCS7_new)() = 0L;
176 static void (*K_PKCS7_free)(PKCS7*) = 0L;
177 static void (*K_PKCS7_content_free)(PKCS7*) = 0L;
178 static int (*K_i2d_PKCS7)(PKCS7*,
unsigned char**) = 0L;
179 static PKCS7 *(*K_d2i_PKCS7)(PKCS7**,
unsigned char**,long) = 0L;
180 static int (*K_i2d_PKCS7_fp)(FILE*,PKCS7*) = 0L;
181 static PKCS7* (*K_d2i_PKCS7_fp)(FILE*,PKCS7**) = 0L;
182 static int (*K_i2d_PKCS7_bio)(BIO *bp,PKCS7 *p7) = 0L;
183 static PKCS7 *(*K_d2i_PKCS7_bio)(BIO *bp,PKCS7 **p7) = 0L;
184 static PKCS7* (*K_PKCS7_dup)(PKCS7*) = 0L;
185 static STACK_OF(X509_NAME) *(*K_SSL_load_client_CA_file)(
const char*) = 0L;
186 static STACK_OF(X509_INFO) *(*K_PEM_X509_INFO_read)(FILE*, STACK_OF(X509_INFO)*, pem_password_cb*,
void*) = 0L;
187 static char *(*K_ASN1_d2i_fp)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**) = 0L;
188 static X509 *(*K_X509_new)() = 0L;
189 static int (*K_X509_PURPOSE_get_count)() = 0L;
190 static int (*K_X509_PURPOSE_get_id)(X509_PURPOSE *) = 0L;
191 static int (*K_X509_check_purpose)(X509*,int,int) = 0L;
192 static X509_PURPOSE* (*K_X509_PURPOSE_get0)(int) = 0L;
193 static int (*K_EVP_PKEY_assign)(EVP_PKEY*, int,
char*) = 0L;
194 static int (*K_X509_REQ_set_pubkey)(X509_REQ*, EVP_PKEY*) = 0L;
195 static void (*K_RSA_get0_key)(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d) = 0L;
196 static RSA *(*K_RSA_generate_key)(int,
unsigned long, void (*)(int,int,
void *),
void *) = 0L;
197 static void (*K_DSA_get0_pqg)(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g) = 0L;
198 static void (*K_DSA_get0_key)(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key) = 0L;
199 static int (*K_i2d_X509_REQ_fp)(FILE*, X509_REQ*) = 0L;
200 static void (*K_ERR_clear_error)() = 0L;
201 static unsigned long (*K_ERR_get_error)() = 0L;
202 static void (*K_ERR_print_errors_fp)(FILE*) = 0L;
203 static PKCS7 *(*K_PKCS7_sign)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int) = 0L;
204 static int (*K_PKCS7_verify)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int) = 0L;
205 static STACK_OF(X509) *(*K_PKCS7_get0_signers)(PKCS7 *, STACK_OF(X509) *, int) = 0L;
206 static PKCS7 *(*K_PKCS7_encrypt)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int) = 0L;
207 static int (*K_PKCS7_decrypt)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int) = 0L;
208 static SSL_SESSION* (*K_SSL_get1_session)(SSL*) = 0L;
209 static void (*K_SSL_SESSION_free)(SSL_SESSION*) = 0L;
210 static int (*K_SSL_set_session)(SSL*,SSL_SESSION*) = 0L;
211 static SSL_SESSION* (*K_d2i_SSL_SESSION)(SSL_SESSION**,
unsigned char**, long) = 0L;
212 static int (*K_i2d_SSL_SESSION)(SSL_SESSION*,
unsigned char**) = 0L;
213 static STACK *(*K_X509_get1_email)(X509 *x) = 0L;
214 static void (*K_X509_email_free)(STACK *sk) = 0L;
215 static EVP_CIPHER *(*K_EVP_des_ede3_cbc)() = 0L;
216 static EVP_CIPHER *(*K_EVP_des_cbc)() = 0L;
217 static EVP_CIPHER *(*K_EVP_rc2_cbc)() = 0L;
218 static EVP_CIPHER *(*K_EVP_rc2_64_cbc)() = 0L;
219 static EVP_CIPHER *(*K_EVP_rc2_40_cbc)() = 0L;
220 static int (*K_i2d_PrivateKey_fp)(FILE*,EVP_PKEY*) = 0L;
221 static int (*K_i2d_PKCS8PrivateKey_fp)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*) = 0L;
222 static void (*K_RSA_free)(RSA*) = 0L;
223 static EVP_CIPHER *(*K_EVP_bf_cbc)() = 0L;
224 static int (*K_X509_REQ_sign)(X509_REQ*, EVP_PKEY*,
const EVP_MD*) = 0L;
225 static int (*K_X509_NAME_add_entry_by_txt)(X509_NAME*,
char*, int,
unsigned char*, int, int, int) = 0L;
226 static X509_NAME *(*K_X509_NAME_new)() = 0L;
227 static int (*K_X509_REQ_set_subject_name)(X509_REQ*,X509_NAME*) = 0L;
228 static unsigned char *(*K_ASN1_STRING_data)(ASN1_STRING*) = 0L;
229 static int (*K_ASN1_STRING_length)(ASN1_STRING*) = 0L;
230 static STACK_OF(SSL_CIPHER) *(*K_SSL_get_ciphers)(
const SSL *ssl) = 0L;
231 static const ASN1_TIME* (*K_X509_CRL_get0_lastUpdate)(
const X509_CRL *crl) = 0L;
232 static const ASN1_TIME* (*K_X509_CRL_get0_nextUpdate)(
const X509_CRL *crl) = 0L;
233 static X509* (*K_X509_STORE_CTX_get_current_cert)(X509_STORE_CTX *ctx) = 0L;
234 static int (*K_X509_STORE_CTX_get_error)(X509_STORE_CTX *ctx) = 0L;
235 static int (*K_X509_STORE_CTX_get_error_depth)(X509_STORE_CTX *ctx) = 0L;
236 static void (*K_X509_STORE_CTX_set_error)(X509_STORE_CTX *ctx,
int s) = 0L;
237 static void (*K_X509_STORE_set_verify_cb)(X509_STORE *ctx,
238 X509_STORE_CTX_verify_cb verify_cb) = 0L;
239 static STACK_OF(X509_OBJECT)* (*K_X509_STORE_get0_objects)(X509_STORE *v) = 0L;
240 static X509_LOOKUP_TYPE (*K_X509_OBJECT_get_type)(
const X509_OBJECT *a) = 0L;
241 static X509* (*K_X509_OBJECT_get0_X509)(
const X509_OBJECT *a) = 0L;
242 static ASN1_TIME* (*K_X509_getm_notAfter)(
const X509 *x) = 0L;
243 static ASN1_TIME* (*K_X509_getm_notBefore)(
const X509 *x) = 0L;
249 return _sslLib != 0L;
254 return _cryptoLib != 0L;
265 #include <tqstring.h>
266 #include <tqstringlist.h>
268 static TQString findMostRecentLib(TQString dir, TQString name)
271 TQString filter =
"lib"+name+
".so.*";
272 TQDir d(dir, filter);
275 TQStringList l = d.entryList();
282 uint s = filter.length()-1;
283 for (TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
284 TQString numberpart = (*it).mid(s);
285 uint endmaj = numberpart.find(
'.');
289 int maj = numberpart.left(endmaj).toInt(&ok);
292 int min = numberpart.mid(endmaj+1).toInt(&ok);
295 if (maj > bestmaj || (maj == bestmaj && min > bestmin)) {
309 KOpenSSLProxy::KOpenSSLProxy() {
310 KLibLoader *ll = KLibLoader::self();
312 TQStringList libpaths, libnamesc, libnamess;
318 cfg =
new TDEConfig(
"cryptodefaults",
false,
false);
319 cfg->setGroup(
"OpenSSL");
320 TQString upath = cfg->readPathEntry(
"Path");
321 if (!upath.isEmpty())
328 TQString libname = findMostRecentLib(
"/usr/" SYSTEM_LIBDIR,
"crypto");
329 if (!libname.isNull())
330 _cryptoLib = ll->globalLibrary(libname.latin1());
332 #elif defined(__CYGWIN__)
333 libpaths <<
"/usr/bin/"
335 <<
"/usr/local/openssl/bin"
336 <<
"/opt/openssl/bin"
337 <<
"/opt/trinity/bin"
340 libnamess <<
"cygssl-0.9.7.dll"
345 libnamesc <<
"cygcrypto.dll"
352 libpaths <<
"/" SYSTEM_LIBDIR KDELIBSUFF
"/"
353 <<
"/usr/" SYSTEM_LIBDIR KDELIBSUFF
"/"
359 <<
"/opt/freeware/lib/"
361 <<
"/usr/" SYSTEM_LIBDIR
"/"
362 <<
"/usr/ssl/" SYSTEM_LIBDIR
"/"
363 <<
"/usr/local/" SYSTEM_LIBDIR
"/"
364 <<
"/usr/local/openssl/" SYSTEM_LIBDIR
"/"
365 <<
"/usr/local/ssl/" SYSTEM_LIBDIR
"/"
366 <<
"/opt/openssl/" SYSTEM_LIBDIR
"/"
367 <<
"/" SYSTEM_LIBDIR
"/"
376 <<
"libssl.a(libssl.so.0)"
377 #elif defined(__APPLE__)
379 <<
"libssl.0.9.dylib"
381 #ifdef OPENSSL_SHLIB_VERSION
382 <<
"libssl.so." STRINGIFY(OPENSSL_SHLIB_VERSION)
384 #ifdef SHLIB_VERSION_NUMBER
385 <<
"libssl.so." SHLIB_VERSION_NUMBER
397 <<
"libcrypto.a(libcrypto.so.0)"
398 #elif defined(__APPLE__)
400 <<
"libcrypto.0.9.dylib"
402 #ifdef OPENSSL_SHLIB_VERSION
403 <<
"libcrypto.so." STRINGIFY(OPENSSL_SHLIB_VERSION)
405 #ifdef SHLIB_VERSION_NUMBER
406 <<
"libcrypto.so." SHLIB_VERSION_NUMBER
415 for (TQStringList::Iterator it = libpaths.begin();
416 it != libpaths.end();
418 for (TQStringList::Iterator shit = libnamesc.begin();
419 shit != libnamesc.end();
422 if (!alib.isEmpty() && !alib.endsWith(
"/"))
425 TQString tmpStr(alib.latin1());
426 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
427 if (!access(tmpStr.latin1(), R_OK))
428 _cryptoLib = ll->globalLibrary(alib.latin1());
429 if (_cryptoLib)
break;
431 if (_cryptoLib)
break;
436 K_X509_free = (void (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_free");
437 K_X509_CRL_free = (void (*) (X509_CRL *)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_free");
438 K_RAND_egd = (int (*)(
const char *)) GET_CRYPTOLIB_SYMBOL(
"RAND_egd");
439 K_RAND_load_file = (int (*)(
const char *, long)) GET_CRYPTOLIB_SYMBOL(
"RAND_load_file");
440 K_RAND_file_name = (
const char* (*)(
char *,
size_t)) GET_CRYPTOLIB_SYMBOL(
"RAND_file_name");
441 K_RAND_write_file = (int (*)(
const char *)) GET_CRYPTOLIB_SYMBOL(
"RAND_write_file");
442 K_CRYPTO_free = (void (*) (
void *)) GET_CRYPTOLIB_SYMBOL(
"CRYPTO_free");
443 K_d2i_X509 = (X509 * (*)(X509 **,
unsigned char **,
long)) GET_CRYPTOLIB_SYMBOL(
"d2i_X509");
444 K_d2i_X509_CRL = (X509_CRL * (*)(X509_CRL **,
unsigned char **,
long)) GET_CRYPTOLIB_SYMBOL(
"d2i_X509_CRL");
445 K_i2d_X509 = (int (*)(X509 *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_X509");
446 K_X509_cmp = (int (*)(X509 *, X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_cmp");
447 K_X509_subject_name_cmp = (int (*)(
const X509 *,
const X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_subject_name_cmp");
448 K_X509_STORE_CTX_new = (X509_STORE_CTX * (*) (
void)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_new");
449 K_X509_STORE_CTX_free = (void (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_free");
450 K_X509_verify_cert = (int (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL(
"X509_verify_cert");
451 K_X509_STORE_new = (X509_STORE * (*) (
void)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_new");
452 K_X509_STORE_free = (void (*) (X509_STORE *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_free");
453 K_X509_NAME_oneline = (
char * (*) (X509_NAME *,
char *,
int)) GET_CRYPTOLIB_SYMBOL(
"X509_NAME_oneline");
454 K_X509_get_subject_name = (X509_NAME * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_subject_name");
455 K_X509_get_issuer_name = (X509_NAME * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_issuer_name");
456 K_X509_STORE_add_lookup = (X509_LOOKUP *(*) (X509_STORE *, X509_LOOKUP_METHOD *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_add_lookup");
457 K_X509_LOOKUP_file = (X509_LOOKUP_METHOD *(*)(
void)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_file");
458 K_X509_LOOKUP_free = (void (*)(X509_LOOKUP *)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_free");
459 K_X509_LOOKUP_ctrl = (int (*)(X509_LOOKUP *, int,
const char *, long,
char **)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_ctrl");
460 K_X509_STORE_CTX_init = (void (*)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_init");
461 K_X509_dup = (X509* (*)(X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_dup");
462 K_X509_get0_signature = (void (*)(
const ASN1_BIT_STRING **psig,
463 const X509_ALGOR **palg,
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_get0_signature");
464 K_BIO_s_mem = (BIO_METHOD *(*) (
void)) GET_CRYPTOLIB_SYMBOL(
"BIO_s_mem");
465 K_BIO_new = (BIO* (*)(BIO_METHOD *)) GET_CRYPTOLIB_SYMBOL(
"BIO_new");
466 K_BIO_new_fp = (BIO* (*)(FILE*,
int)) GET_CRYPTOLIB_SYMBOL(
"BIO_new_fp");
467 K_BIO_new_mem_buf = (BIO* (*)(
void *,
int)) GET_CRYPTOLIB_SYMBOL(
"BIO_new_mem_buf");
468 K_BIO_free = (int (*)(BIO*)) GET_CRYPTOLIB_SYMBOL(
"BIO_free");
469 K_BIO_ctrl = (long (*) (BIO *,int,long,
void *)) GET_CRYPTOLIB_SYMBOL(
"BIO_ctrl");
470 K_BIO_write = (int (*) (BIO *b,
const void *data,
int len)) GET_CRYPTOLIB_SYMBOL(
"BIO_write");
471 K_BIO_get_data = (
void* (*)(BIO *a)) GET_CRYPTOLIB_SYMBOL(
"BIO_get_data");
472 K_PEM_ASN1_write_bio = (int (*)(int (*)(),
const char *,BIO*,
char*,
const EVP_CIPHER *,
unsigned char *,
int, pem_password_cb *,
void *)) GET_CRYPTOLIB_SYMBOL(
"PEM_ASN1_write_bio");
473 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
474 K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*,
unsigned char *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_item_i2d_fp");
475 K_NETSCAPE_X509_it = (ASN1_ITEM *) GET_CRYPTOLIB_SYMBOL(
"NETSCAPE_X509_it");
477 K_X509_asn1_meth = (ASN1_METHOD* (*)(
void)) GET_CRYPTOLIB_SYMBOL(
"X509_asn1_meth");
478 K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*,
unsigned char *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_i2d_fp");
479 K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_ASN1_HEADER");
481 K_X509_print_fp = (int (*)(FILE*, X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_print_fp");
482 K_i2d_PKCS12 = (int (*)(PKCS12*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS12");
483 K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS12_fp");
484 K_PKCS12_newpass = (int (*)(PKCS12*,
char*,
char*)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_newpass");
485 K_d2i_PKCS12_fp = (PKCS12* (*)(FILE*, PKCS12**)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS12_fp");
486 K_PKCS12_new = (PKCS12* (*)()) GET_CRYPTOLIB_SYMBOL(
"PKCS12_new");
487 K_PKCS12_free = (void (*)(PKCS12 *)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_free");
488 K_PKCS12_parse = (int (*)(PKCS12*,
const char *, EVP_PKEY**,
489 X509**, STACK_OF(X509)**)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_parse");
490 K_EVP_PKEY_free = (void (*) (EVP_PKEY *)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_free");
491 K_EVP_PKEY_new = (EVP_PKEY* (*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_new");
492 K_EVP_PKEY_base_id = (int (*)(
const EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_base_id");
493 K_EVP_PKEY_get0_RSA = (RSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_get0_RSA");
494 K_EVP_PKEY_get0_DSA = (DSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_get0_DSA");
495 K_X509_REQ_free = (void (*)(X509_REQ*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_free");
496 K_X509_REQ_new = (X509_REQ* (*)()) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_new");
497 K_X509_STORE_CTX_set0_untrusted = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set0_untrusted");
498 if (!K_X509_STORE_CTX_set0_untrusted) K_X509_STORE_CTX_set0_untrusted = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set_chain");
499 K_X509_STORE_CTX_set_purpose = (void (*)(X509_STORE_CTX *, int)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set_purpose");
500 K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_free");
501 if (!K_sk_free) K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_free");
502 K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_num");
503 if (!K_sk_num) K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_num");
504 K_sk_pop = (
char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_pop");
505 if (!K_sk_pop) K_sk_pop = (
char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_pop");
506 K_sk_value = (
char* (*) (STACK *,
int)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_value");
507 if (!K_sk_value) K_sk_value = (
char* (*) (STACK *,
int)) GET_CRYPTOLIB_SYMBOL(
"sk_value");
508 K_sk_new = (STACK* (*) (
int (*)())) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_new");
509 if (!K_sk_new) K_sk_new = (STACK* (*) (
int (*)())) GET_CRYPTOLIB_SYMBOL(
"sk_new");
510 K_sk_push = (int (*) (STACK*,
char*)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_push");
511 if (!K_sk_push) K_sk_push = (int (*) (STACK*,
char*)) GET_CRYPTOLIB_SYMBOL(
"sk_push");
512 K_sk_dup = (STACK* (*) (
const STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_dup");
513 if (!K_sk_dup) K_sk_dup = (STACK* (*) (
const STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_dup");
514 K_i2s_ASN1_INTEGER = (
char *(*) (X509V3_EXT_METHOD *, ASN1_INTEGER *)) GET_CRYPTOLIB_SYMBOL(
"i2s_ASN1_INTEGER");
515 K_X509_get_serialNumber = (ASN1_INTEGER * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_serialNumber");
516 K_X509_get_pubkey = (EVP_PKEY *(*)(X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_pubkey");
517 K_i2d_PublicKey = (int (*)(EVP_PKEY *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_PublicKey");
518 K_X509_check_private_key = (int (*)(X509 *, EVP_PKEY *)) GET_CRYPTOLIB_SYMBOL(
"X509_check_private_key");
519 K_BN_bn2hex = (
char *(*)(
const BIGNUM *)) GET_CRYPTOLIB_SYMBOL(
"BN_bn2hex");
520 K_X509_digest = (int (*)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *)) GET_CRYPTOLIB_SYMBOL(
"X509_digest");
521 K_EVP_md5 = (EVP_MD *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_md5");
522 K_ASN1_INTEGER_free = (void (*)(ASN1_INTEGER *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_INTEGER_free");
523 K_OBJ_obj2nid = (int (*)(ASN1_OBJECT *)) GET_CRYPTOLIB_SYMBOL(
"OBJ_obj2nid");
524 K_OBJ_nid2ln = (
const char *(*)(
int)) GET_CRYPTOLIB_SYMBOL(
"OBJ_nid2ln");
525 K_X509_get_ext_count = (int (*)(X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_count");
526 K_X509_get_ext_by_NID = (int (*)(X509*,int,int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_by_NID");
527 K_X509_get_ext_by_OBJ = (int (*)(X509*,ASN1_OBJECT*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_by_OBJ");
528 K_X509_get_ext = (X509_EXTENSION* (*)(X509*,
int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext");
529 K_X509_delete_ext = (X509_EXTENSION* (*)(X509*,
int)) GET_CRYPTOLIB_SYMBOL(
"X509_delete_ext");
530 K_X509_add_ext = (int (*)(X509*,X509_EXTENSION*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_add_ext");
531 K_X509_get_ext_d2i = (
void* (*)(X509*,
int,
int*,
int*)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_d2i");
532 K_i2s_ASN1_OCTET_STRING = (
char *(*)(X509V3_EXT_METHOD*,ASN1_OCTET_STRING*)) GET_CRYPTOLIB_SYMBOL(
"i2s_ASN1_OCTET_STRING");
533 K_ASN1_BIT_STRING_get_bit = (int (*)(ASN1_BIT_STRING*,int)) GET_CRYPTOLIB_SYMBOL(
"ASN1_BIT_STRING_get_bit");
534 K_PKCS7_new = (PKCS7 *(*)()) GET_CRYPTOLIB_SYMBOL(
"PKCS7_new");
535 K_PKCS7_free = (void (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_free");
536 K_PKCS7_content_free = (void (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_content_free");
537 K_i2d_PKCS7 = (int (*)(PKCS7*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7");
538 K_i2d_PKCS7_fp = (int (*)(FILE*,PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7_fp");
539 K_i2d_PKCS7_bio = (int (*)(BIO *bp,PKCS7 *p7)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7_bio");
540 K_d2i_PKCS7 = (PKCS7* (*)(PKCS7**,
unsigned char**,
long)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7");
541 K_d2i_PKCS7_fp = (PKCS7 *(*)(FILE *,PKCS7**)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7_fp");
542 K_d2i_PKCS7_bio = (PKCS7 *(*)(BIO *bp,PKCS7 **p7)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7_bio");
543 K_PKCS7_dup = (PKCS7* (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_dup");
544 K_PKCS7_sign = (PKCS7 *(*)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_sign");
545 K_PKCS7_verify = (int (*)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_verify");
546 K_PKCS7_get0_signers = (STACK_OF(X509) *(*)(PKCS7 *, STACK_OF(X509) *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_get0_signers");
547 K_PKCS7_encrypt = (PKCS7* (*)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_encrypt");
548 K_PKCS7_decrypt = (int (*)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_decrypt");
549 K_PEM_X509_INFO_read = (STACK_OF(X509_INFO) *(*)(FILE*, STACK_OF(X509_INFO)*, pem_password_cb*,
void *)) GET_CRYPTOLIB_SYMBOL(
"PEM_X509_INFO_read");
550 K_ASN1_d2i_fp = (
char *(*)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"ASN1_d2i_fp");
551 K_X509_new = (X509 *(*)()) GET_CRYPTOLIB_SYMBOL(
"X509_new");
552 K_X509_PURPOSE_get_count = (int (*)()) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get_count");
553 K_X509_PURPOSE_get_id = (int (*)(X509_PURPOSE *)) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get_id");
554 K_X509_check_purpose = (int (*)(X509*,int,int)) GET_CRYPTOLIB_SYMBOL(
"X509_check_purpose");
555 K_X509_PURPOSE_get0 = (X509_PURPOSE *(*)(
int)) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get0");
556 K_EVP_PKEY_assign = (int (*)(EVP_PKEY*, int,
char*)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_assign");
557 K_X509_REQ_set_pubkey = (int (*)(X509_REQ*, EVP_PKEY*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_set_pubkey");
558 K_RSA_get0_key = (void (*)(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d)) GET_CRYPTOLIB_SYMBOL(
"RSA_get0_key");
559 K_RSA_generate_key = (RSA* (*)(
int,
unsigned long,
void (*)(int,int,
void *),
void *)) GET_CRYPTOLIB_SYMBOL(
"RSA_generate_key");
560 K_DSA_get0_pqg = (void (*)(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g)) GET_CRYPTOLIB_SYMBOL(
"DSA_get0_pqg");
561 K_DSA_get0_key = (void (*)(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key)) GET_CRYPTOLIB_SYMBOL(
"DSA_get0_key");
562 K_i2d_X509_REQ_fp = (int (*)(FILE *, X509_REQ *)) GET_CRYPTOLIB_SYMBOL(
"i2d_X509_REQ_fp");
563 K_ERR_clear_error = (void (*)()) GET_CRYPTOLIB_SYMBOL(
"ERR_clear_error");
564 K_ERR_get_error = (
unsigned long (*)()) GET_CRYPTOLIB_SYMBOL(
"ERR_get_error");
565 K_ERR_print_errors_fp = (void (*)(FILE*)) GET_CRYPTOLIB_SYMBOL(
"ERR_print_errors_fp");
566 K_X509_get1_email = (STACK *(*)(X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_get1_email");
567 K_X509_email_free = (void (*)(STACK *sk)) GET_CRYPTOLIB_SYMBOL(
"X509_email_free");
568 K_EVP_des_ede3_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_des_ede3_cbc");
569 K_EVP_des_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_des_cbc");
570 K_EVP_rc2_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_cbc");
571 K_EVP_rc2_64_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_64_cbc");
572 K_EVP_rc2_40_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_40_cbc");
573 K_i2d_PrivateKey_fp = (int (*)(FILE*,EVP_PKEY*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PrivateKey_fp");
574 K_i2d_PKCS8PrivateKey_fp = (int (*)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS8PrivateKey_fp");
575 K_RSA_free = (void (*)(RSA*)) GET_CRYPTOLIB_SYMBOL(
"RSA_free");
576 K_EVP_bf_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_bf_cbc");
577 K_X509_REQ_sign = (int (*)(X509_REQ*, EVP_PKEY*,
const EVP_MD*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_sign");
578 K_X509_NAME_add_entry_by_txt = (int (*)(X509_NAME*,
char*, int,
unsigned char*, int, int, int)) GET_CRYPTOLIB_SYMBOL(
"X509_NAME_add_entry_by_txt");
579 K_X509_NAME_new = (X509_NAME *(*)()) GET_CRYPTOLIB_SYMBOL(
"X509_NAME_new");
580 K_X509_REQ_set_subject_name = (int (*)(X509_REQ*,X509_NAME*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_set_subject_name");
581 K_ASN1_STRING_data = (
unsigned char *(*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL(
"ASN1_STRING_data");
582 K_ASN1_STRING_length = (int (*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL(
"ASN1_STRING_length");
583 K_X509_CRL_get0_lastUpdate = (
const ASN1_TIME* (*)(
const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_get0_lastUpdate");
584 K_X509_CRL_get0_nextUpdate = (
const ASN1_TIME* (*)(
const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_get0_nextUpdate");
585 K_X509_STORE_CTX_get_current_cert = (X509* (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_current_cert");
586 K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_error");
587 K_X509_STORE_CTX_get_error_depth = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_error_depth");
588 K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *ctx,
int s)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set_error");
589 K_X509_STORE_set_verify_cb = (void (*)(X509_STORE *ctx,
590 X509_STORE_CTX_verify_cb verify_cb)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_set_verify_cb");
591 K_X509_STORE_get0_objects = (STACK_OF(X509_OBJECT)* (*)(X509_STORE *v)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_get0_objects");
592 K_X509_OBJECT_get_type = (X509_LOOKUP_TYPE (*)(
const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL(
"X509_OBJECT_get_type");
593 K_X509_OBJECT_get0_X509 = (X509* (*)(
const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL(
"X509_OBJECT_get0_X509");
594 K_X509_getm_notAfter = (ASN1_TIME* (*)(
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_getm_notAfter");
595 K_X509_getm_notBefore = (ASN1_TIME* (*)(
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_getm_notBefore");
601 TQString libname = findMostRecentLib(
"/usr/lib",
"ssl");
602 if (!libname.isNull())
603 _sslLib = ll->globalLibrary(libname.latin1());
606 for (TQStringList::Iterator it = libpaths.begin();
607 it != libpaths.end();
609 for (TQStringList::Iterator shit = libnamess.begin();
610 shit != libnamess.end();
613 if (!alib.isEmpty() && !alib.endsWith(
"/"))
616 TQString tmpStr(alib.latin1());
617 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
618 if (!access(tmpStr.latin1(), R_OK))
619 _sslLib = ll->globalLibrary(alib.latin1());
629 K_SSL_connect = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_connect");
630 K_SSL_accept = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_accept");
631 K_SSL_read = (int (*)(SSL *,
void *, int)) GET_SSLLIB_SYMBOL(
"SSL_read");
632 K_SSL_write = (int (*)(SSL *,
const void *, int))
633 GET_SSLLIB_SYMBOL(
"SSL_write");
634 K_SSL_new = (SSL* (*)(SSL_CTX *)) GET_SSLLIB_SYMBOL(
"SSL_new");
635 K_SSL_free = (void (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_free");
636 K_SSL_shutdown = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_shutdown");
637 K_SSL_CTX_new = (SSL_CTX* (*)(SSL_METHOD*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_new");
638 K_SSL_CTX_free = (void (*)(SSL_CTX*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_free");
639 K_SSL_set_fd = (int (*)(SSL *, int)) GET_SSLLIB_SYMBOL(
"SSL_set_fd");
640 K_SSL_pending = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_pending");
641 K_SSL_CTX_set_cipher_list = (int (*)(SSL_CTX *,
const char *))
642 GET_SSLLIB_SYMBOL(
"SSL_CTX_set_cipher_list");
643 K_SSL_CTX_set_verify = (void (*)(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*))) GET_SSLLIB_SYMBOL(
"SSL_CTX_set_verify");
644 K_SSL_use_certificate = (int (*)(SSL*, X509*))
645 GET_SSLLIB_SYMBOL(
"SSL_CTX_use_certificate");
646 K_SSL_get_current_cipher = (SSL_CIPHER *(*)(SSL *))
647 GET_SSLLIB_SYMBOL(
"SSL_get_current_cipher");
648 K_SSL_set_options = (long (*)(SSL *ssl,
long options)) GET_SSLLIB_SYMBOL(
"SSL_set_options");
649 K_SSL_session_reused = (int (*)(SSL *ssl)) GET_SSLLIB_SYMBOL(
"SSL_session_reused");
650 K_SSL_ctrl = (long (*)(SSL * ,int, long,
void *))
651 GET_SSLLIB_SYMBOL(
"SSL_ctrl");
652 K_TLSv1_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"TLSv1_client_method");
653 K_SSLv2_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv2_client_method");
654 K_SSLv3_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv3_client_method");
655 K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"TLS_client_method");
656 if (!K_TLS_client_method) K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv23_client_method");
657 K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_get1_peer_certificate");
658 if (!K_SSL_get_peer_certificate) K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_get_peer_certificate");
659 K_SSL_CIPHER_get_bits = (int (*)(SSL_CIPHER *,
int *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_bits");
660 K_SSL_CIPHER_get_version = (
char * (*)(SSL_CIPHER *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_version");
661 K_SSL_CIPHER_get_name = (
const char * (*)(SSL_CIPHER *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_name");
662 K_SSL_CIPHER_description = (
char * (*)(SSL_CIPHER *,
char *,
int)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_description");
663 K_SSL_CTX_use_PrivateKey = (int (*)(SSL_CTX*, EVP_PKEY*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_use_PrivateKey");
664 K_SSL_CTX_use_certificate = (int (*)(SSL_CTX*, X509*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_use_certificate");
665 K_SSL_get_error = (int (*)(SSL*, int)) GET_SSLLIB_SYMBOL(
"SSL_get_error");
666 K_SSL_get_peer_cert_chain = (STACK_OF(X509)* (*)(SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get_peer_cert_chain");
667 K_SSL_load_client_CA_file = (STACK_OF(X509_NAME)* (*)(
const char *)) GET_SSLLIB_SYMBOL(
"SSL_load_client_CA_file");
668 K_SSL_peek = (int (*)(SSL*,
void*,int)) GET_SSLLIB_SYMBOL(
"SSL_peek");
669 K_SSL_get1_session = (SSL_SESSION* (*)(SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get1_session");
670 K_SSL_SESSION_free = (void (*)(SSL_SESSION*)) GET_SSLLIB_SYMBOL(
"SSL_SESSION_free");
671 K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) GET_SSLLIB_SYMBOL(
"SSL_set_session");
672 K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,
unsigned char**,
long)) GET_SSLLIB_SYMBOL(
"d2i_SSL_SESSION");
673 K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,
unsigned char**)) GET_SSLLIB_SYMBOL(
"i2d_SSL_SESSION");
674 K_SSL_get_ciphers = (STACK_OF(SSL_CIPHER) *(*)(
const SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get_ciphers");
680 x = GET_SSLLIB_SYMBOL(
"OPENSSL_init_ssl");
684 ((int (*)(
unsigned long long,
void*))x)(0, NULL);
685 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_init_crypto");
686 if (x) ((int (*)(
unsigned long long,
void*))x)(OPENSSL_INIT_ADD_ALL_CIPHERS
687 | OPENSSL_INIT_ADD_ALL_DIGESTS
688 | OPENSSL_INIT_LOAD_CONFIG,
694 x = GET_SSLLIB_SYMBOL(
"SSL_library_init");
696 if (x) ((int (*)())x)();
697 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms");
699 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms");
703 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms_conf");
705 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms_conf");
709 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms_noconf");
711 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms_noconf");
716 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_ciphers");
718 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_ciphers");
719 if (x) ((void (*)())x)();
720 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_digests");
722 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_digests");
723 if (x) ((void (*)())x)();
732 static KStaticDeleter<KOpenSSLProxy> medProxy;
736 KOpenSSLProxy::~KOpenSSLProxy() {
741 _cryptoLib->unload();
743 medProxy.setObject(0);
768 int KOpenSSLProxy::SSL_connect(SSL *ssl) {
769 if (K_SSL_connect)
return (K_SSL_connect)(ssl);
770 kdWarning() <<
"SSL_connect not defined!" << endl;
775 int KOpenSSLProxy::SSL_accept(SSL *ssl) {
776 if (K_SSL_accept)
return (K_SSL_accept)(ssl);
777 kdWarning() <<
"SSL_accept not defined!" << endl;
782 int KOpenSSLProxy::SSL_read(SSL *ssl,
void *buf,
int num) {
783 if (K_SSL_read)
return (K_SSL_read)(ssl, buf, num);
784 kdWarning() <<
"SSL_read not defined!" << endl;
789 int KOpenSSLProxy::SSL_write(SSL *ssl,
const void *buf,
int num) {
790 if (K_SSL_write)
return (K_SSL_write)(ssl, buf, num);
791 kdWarning() <<
"SSL_write not defined!" << endl;
796 SSL *KOpenSSLProxy::SSL_new(SSL_CTX *ctx) {
797 if (K_SSL_new)
return (K_SSL_new)(ctx);
798 kdWarning() <<
"SSL_new not defined!" << endl;
803 void KOpenSSLProxy::SSL_free(SSL *ssl) {
804 if (K_SSL_free) (K_SSL_free)(ssl);
805 else kdWarning() <<
"SSL_free not defined!" << endl;
809 int KOpenSSLProxy::SSL_shutdown(SSL *ssl) {
810 if (K_SSL_shutdown)
return (K_SSL_shutdown)(ssl);
811 kdWarning() <<
"SSL_shutdown not defined!" << endl;
816 SSL_CTX *KOpenSSLProxy::SSL_CTX_new(SSL_METHOD *method) {
817 if (K_SSL_CTX_new)
return (K_SSL_CTX_new)(method);
818 kdWarning() <<
"SSL_CTX_new not defined!" << endl;
823 void KOpenSSLProxy::SSL_CTX_free(SSL_CTX *ctx) {
824 if (K_SSL_CTX_free) (K_SSL_CTX_free)(ctx);
825 else kdWarning() <<
"SSL_CTX_free not defined!" << endl;
829 int KOpenSSLProxy::SSL_set_fd(SSL *ssl,
int fd) {
830 if (K_SSL_set_fd)
return (K_SSL_set_fd)(ssl, fd);
831 kdWarning() <<
"SSL_sed_fd not defined!" << endl;
836 int KOpenSSLProxy::SSL_pending(SSL *ssl) {
837 if (K_SSL_pending)
return (K_SSL_pending)(ssl);
838 kdWarning() <<
"SSL_pending not defined!" << endl;
843 int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx,
const char *str) {
844 if (K_SSL_CTX_set_cipher_list)
return (K_SSL_CTX_set_cipher_list)(ctx, str);
845 kdWarning() <<
"SSL_CTX_set_cipher_list not defined!" << endl;
850 void KOpenSSLProxy::SSL_CTX_set_verify(SSL_CTX *ctx,
int mode,
851 int (*verify_callback)(
int, X509_STORE_CTX *)) {
852 if (K_SSL_CTX_set_verify) (K_SSL_CTX_set_verify)(ctx, mode, verify_callback);
853 else kdWarning() <<
"SSL_CTX_set_verify not defined!" << endl;
857 int KOpenSSLProxy::SSL_use_certificate(SSL *ssl, X509 *x) {
858 if (K_SSL_use_certificate)
return (K_SSL_use_certificate)(ssl, x);
859 kdWarning() <<
"SSL_use_certificate not defined!" << endl;
864 SSL_CIPHER *KOpenSSLProxy::SSL_get_current_cipher(SSL *ssl) {
865 if (K_SSL_get_current_cipher)
return (K_SSL_get_current_cipher)(ssl);
866 kdWarning() <<
"SSL_get_current_cipher not defined!" << endl;
871 long KOpenSSLProxy::_SSL_set_options(SSL *ssl,
long options) {
872 if (K_SSL_set_options)
return (K_SSL_set_options)(ssl, options);
873 #if OPENSSL_VERSION_NUMBER < 0x10100000L
874 return this->SSL_set_options(ssl, options);
876 kdWarning() <<
"SSL_set_options not defined!" << endl;
881 int KOpenSSLProxy::_SSL_session_reused(SSL *ssl) {
882 if (K_SSL_session_reused)
return (K_SSL_session_reused)(ssl);
883 #if OPENSSL_VERSION_NUMBER < 0x10100000L
884 return this->SSL_session_reused(ssl);
886 kdWarning() <<
"SSL_session_reused not defined!" << endl;
891 long KOpenSSLProxy::SSL_ctrl(SSL *ssl,
int cmd,
long larg,
void *parg) {
892 if (K_SSL_ctrl)
return (K_SSL_ctrl)(ssl, cmd, larg, parg);
893 kdWarning() <<
"SSL_ctrl not defined!" << endl;
898 int KOpenSSLProxy::RAND_egd(
const char *path) {
899 if (K_RAND_egd)
return (K_RAND_egd)(path);
900 kdWarning() <<
"RAND_egd not defined!" << endl;
905 SSL_METHOD *KOpenSSLProxy::TLSv1_client_method() {
906 if (K_TLSv1_client_method)
return (K_TLSv1_client_method)();
907 kdWarning() <<
"TLSv1_client_method not defined!" << endl;
912 SSL_METHOD *KOpenSSLProxy::SSLv2_client_method() {
913 if (K_SSLv2_client_method)
return (K_SSLv2_client_method)();
914 kdWarning() <<
"SSLv2_client_method not defined!" << endl;
919 SSL_METHOD *KOpenSSLProxy::SSLv3_client_method() {
920 if (K_SSLv3_client_method)
return (K_SSLv3_client_method)();
921 kdWarning() <<
"SSLv3_client_method not defined!" << endl;
926 SSL_METHOD *KOpenSSLProxy::TLS_client_method() {
927 if (K_TLS_client_method)
return (K_TLS_client_method)();
928 kdWarning() <<
"TLS_client_method not defined!" << endl;
933 X509 *KOpenSSLProxy::SSL_get_peer_certificate(SSL *s) {
934 if (K_SSL_get_peer_certificate)
return (K_SSL_get_peer_certificate)(s);
935 kdWarning() <<
"SSL_get_peer_certificate not defined!" << endl;
940 int KOpenSSLProxy::SSL_CIPHER_get_bits(SSL_CIPHER *c,
int *alg_bits) {
941 if (K_SSL_CIPHER_get_bits)
return (K_SSL_CIPHER_get_bits)(c, alg_bits);
942 kdWarning() <<
"SSL_CIPHER_get_bits not defined!" << endl;
947 char * KOpenSSLProxy::SSL_CIPHER_get_version(SSL_CIPHER *c) {
948 if (K_SSL_CIPHER_get_version)
return (K_SSL_CIPHER_get_version)(c);
949 kdWarning() <<
"SSL_CIPHER_get_version not defined!" << endl;
954 const char * KOpenSSLProxy::SSL_CIPHER_get_name(SSL_CIPHER *c) {
955 if (K_SSL_CIPHER_get_name)
return (K_SSL_CIPHER_get_name)(c);
956 kdWarning() <<
"SSL_CIPHER_get_name not defined!" << endl;
961 char * KOpenSSLProxy::SSL_CIPHER_description(SSL_CIPHER *c,
char *buf,
int size) {
962 if (K_SSL_CIPHER_description)
return (K_SSL_CIPHER_description)(c,buf,size);
963 kdWarning() <<
"SSL_CIPHER_description not defined!" << endl;
968 X509 * KOpenSSLProxy::d2i_X509(X509 **a,
unsigned char **pp,
long length) {
969 if (K_d2i_X509)
return (K_d2i_X509)(a,pp,length);
970 kdWarning() <<
"d2i_X509 not defined!" << endl;
975 X509_CRL * KOpenSSLProxy::d2i_X509_CRL(X509_CRL **a,
unsigned char **pp,
long length) {
976 if (K_d2i_X509_CRL)
return (K_d2i_X509_CRL)(a,pp,length);
977 kdWarning() <<
"d2i_X509_CRL not defined!" << endl;
982 int KOpenSSLProxy::i2d_X509(X509 *a,
unsigned char **pp) {
983 if (K_i2d_X509)
return (K_i2d_X509)(a,pp);
984 kdWarning() <<
"i2d_X509 not defined!" << endl;
989 int KOpenSSLProxy::X509_cmp(X509 *a, X509 *b) {
990 if (K_X509_cmp)
return (K_X509_cmp)(a,b);
991 kdWarning() <<
"X509_cmp not defined!" << endl;
996 int KOpenSSLProxy::X509_subject_name_cmp(
const X509 *a,
const X509 *b) {
997 if (K_X509_subject_name_cmp)
return (K_X509_subject_name_cmp)(a, b);
998 kdWarning() <<
"X509_subject_name_cmp not defined!" << endl;
1003 X509_STORE *KOpenSSLProxy::X509_STORE_new(
void) {
1004 if (K_X509_STORE_new)
return (K_X509_STORE_new)();
1005 kdWarning() <<
"X509_STORE_new not defined!" << endl;
1010 void KOpenSSLProxy::X509_STORE_free(X509_STORE *v) {
1011 if (K_X509_STORE_free) (K_X509_STORE_free)(v);
1012 else kdWarning() <<
"X509_STORE_free not defined!" << endl;
1016 X509_STORE_CTX *KOpenSSLProxy::X509_STORE_CTX_new(
void) {
1017 if (K_X509_STORE_CTX_new)
return (K_X509_STORE_CTX_new)();
1018 kdWarning() <<
"X509_STORE_CTX_new not defined!" << endl;
1023 void KOpenSSLProxy::X509_STORE_CTX_free(X509_STORE_CTX *ctx) {
1024 if (K_X509_STORE_CTX_free) (K_X509_STORE_CTX_free)(ctx);
1025 else kdWarning() <<
"X509_STORE_CTX_free not defined!" << endl;
1029 int KOpenSSLProxy::X509_verify_cert(X509_STORE_CTX *ctx) {
1030 if (K_X509_verify_cert)
return (K_X509_verify_cert)(ctx);
1031 kdWarning() <<
"X509_verify_cert not defined!" << endl;
1036 void KOpenSSLProxy::X509_free(X509 *a) {
1037 if (K_X509_free) (K_X509_free)(a);
1038 else kdWarning() <<
"X509_free not defined!" << endl;
1042 void KOpenSSLProxy::X509_CRL_free(X509_CRL *a) {
1043 if (K_X509_CRL_free) (K_X509_CRL_free)(a);
1044 else kdWarning() <<
"X509_CRL_free not defined!" << endl;
1048 char *KOpenSSLProxy::X509_NAME_oneline(X509_NAME *a,
char *buf,
int size) {
1049 if (K_X509_NAME_oneline)
return (K_X509_NAME_oneline)(a,buf,size);
1050 kdWarning() <<
"X509_NAME_online not defined!" << endl;
1055 X509_NAME *KOpenSSLProxy::X509_get_subject_name(X509 *a) {
1056 if (K_X509_get_subject_name)
return (K_X509_get_subject_name)(a);
1057 kdWarning() <<
"X509_get_subject not defined!" << endl;
1062 X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a) {
1063 if (K_X509_get_issuer_name)
return (K_X509_get_issuer_name)(a);
1064 kdWarning() <<
"X509_get_issuer not defined!" << endl;
1069 X509_LOOKUP *KOpenSSLProxy::X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) {
1070 if (K_X509_STORE_add_lookup)
return (K_X509_STORE_add_lookup)(v,m);
1071 kdWarning() <<
"X509_STORE_add_lookup not defined!" << endl;
1076 X509_LOOKUP_METHOD *KOpenSSLProxy::X509_LOOKUP_file(
void) {
1077 if (K_X509_LOOKUP_file)
return (K_X509_LOOKUP_file)();
1078 kdWarning() <<
"X509_LOOKUP_file not defined!" << endl;
1083 void KOpenSSLProxy::X509_LOOKUP_free(X509_LOOKUP *x) {
1084 if (K_X509_LOOKUP_free) (K_X509_LOOKUP_free)(x);
1085 else kdWarning() <<
"X509_LOOKUP_free not defined!" << endl;
1089 int KOpenSSLProxy::X509_LOOKUP_ctrl(X509_LOOKUP *ctx,
int cmd,
const char *argc,
long argl,
char **ret) {
1090 if (K_X509_LOOKUP_ctrl)
return (K_X509_LOOKUP_ctrl)(ctx,cmd,argc,argl,ret);
1091 kdWarning() <<
"X509_LOOKUP_ctrl not defined!" << endl;
1096 void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain) {
1097 if (K_X509_STORE_CTX_init) (K_X509_STORE_CTX_init)(ctx,store,x509,chain);
1098 else kdWarning() <<
"X509_STORE_CTX_init not defined!" << endl;
1102 void KOpenSSLProxy::CRYPTO_free(
void *x) {
1103 if (K_CRYPTO_free) (K_CRYPTO_free)(x);
1104 else kdWarning() <<
"CRYPTO_free not defined!" << endl;
1108 X509 *KOpenSSLProxy::X509_dup(X509 *x509) {
1109 if (K_X509_dup)
return (K_X509_dup)(x509);
1110 kdWarning() <<
"X509_dup not defined!" << endl;
1115 void KOpenSSLProxy::X509_get0_signature(
const ASN1_BIT_STRING **psig,
1116 const X509_ALGOR **palg,
const X509 *x) {
1117 if (K_X509_get0_signature) {
1118 (X509_get0_signature)(psig, palg, x);
1121 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1123 if (psig) *psig = x->signature;
1124 if (palg) *palg = x->sig_alg;
1127 kdWarning() <<
"X509_get0_signature not defined!" << endl;
1131 BIO *KOpenSSLProxy::BIO_new(BIO_METHOD *type) {
1132 if (K_BIO_new)
return (K_BIO_new)(type);
1133 kdWarning() <<
"BIO_new not defined!" << endl;
1138 BIO_METHOD *KOpenSSLProxy::BIO_s_mem(
void) {
1139 if (K_BIO_s_mem)
return (K_BIO_s_mem)();
1140 kdWarning() <<
"BIO_s_mem not defined!" << endl;
1145 BIO *KOpenSSLProxy::BIO_new_fp(FILE *stream,
int close_flag) {
1146 if (K_BIO_new_fp)
return (K_BIO_new_fp)(stream, close_flag);
1147 kdWarning() <<
"BIO_new_fp not defined!" << endl;
1152 BIO *KOpenSSLProxy::BIO_new_mem_buf(
void *buf,
int len) {
1153 if (K_BIO_new_mem_buf)
return (K_BIO_new_mem_buf)(buf,len);
1154 kdWarning() <<
"BIO_new_mem_buf not defined!" << endl;
1159 int KOpenSSLProxy::BIO_free(BIO *a) {
1160 if (K_BIO_free)
return (K_BIO_free)(a);
1161 kdWarning() <<
"BIO_free not defined!" << endl;
1166 long KOpenSSLProxy::BIO_ctrl(BIO *bp,
int cmd,
long larg,
void *parg) {
1167 if (K_BIO_ctrl)
return (K_BIO_ctrl)(bp,cmd,larg,parg);
1168 kdWarning() <<
"BIO_ctrl not defined!" << endl;
1173 int KOpenSSLProxy::BIO_write(BIO *b,
const void *data,
int len) {
1174 if (K_BIO_write)
return (K_BIO_write)(b, data, len);
1175 kdWarning() <<
"BIO_write not defined!" << endl;
1180 void *KOpenSSLProxy::BIO_get_data(BIO *a) {
1181 if (K_BIO_get_data)
return (K_BIO_get_data)(a);
1182 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1185 kdWarning() <<
"BIO_get_data not defined!" << endl;
1190 int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) {
1191 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);
1192 kdWarning() <<
"PEM_write_bio_X509 not defined!" << endl;
1196 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
1197 int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,
unsigned char *x) {
1198 if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
1199 return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
1200 kdWarning() <<
"ANS1_i2d_fp not defined!" << endl;
1204 ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(
void) {
1205 if (K_X509_asn1_meth)
return (K_X509_asn1_meth)();
1206 kdWarning() <<
"X509_ans1_meth not defined!" << endl;
1211 int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,
unsigned char *x) {
1212 if (K_ASN1_i2d_fp && K_i2d_ASN1_HEADER)
1213 return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
1214 kdWarning() <<
"ANS1_i2d_fp not defined!" << endl;
1219 int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
1220 if (K_X509_print_fp)
return (K_X509_print_fp)(fp, x);
1221 kdWarning() <<
"X509_print not defined!" << endl;
1226 PKCS12 *KOpenSSLProxy::d2i_PKCS12_fp(FILE *fp, PKCS12 **p12) {
1227 if (K_d2i_PKCS12_fp)
return (K_d2i_PKCS12_fp)(fp, p12);
1228 kdWarning() <<
"d2i_PKCS12_fp not defined!" << endl;
1233 int KOpenSSLProxy::PKCS12_newpass(PKCS12 *p12,
char *oldpass,
char *newpass) {
1234 if (K_PKCS12_newpass)
return (K_PKCS12_newpass)(p12, oldpass, newpass);
1235 kdWarning() <<
"PKCS12_newpass not defined!" << endl;
1240 int KOpenSSLProxy::i2d_PKCS12(PKCS12 *p12,
unsigned char **p) {
1241 if (K_i2d_PKCS12)
return (K_i2d_PKCS12)(p12, p);
1242 kdWarning() <<
"i2d_PKCS12 not defined!" << endl;
1247 int KOpenSSLProxy::i2d_PKCS12_fp(FILE *fp, PKCS12 *p12) {
1248 if (K_i2d_PKCS12_fp)
return (K_i2d_PKCS12_fp)(fp, p12);
1249 kdWarning() <<
"i2d_PKCS12_fp not defined!" << endl;
1254 PKCS12 *KOpenSSLProxy::PKCS12_new(
void) {
1255 if (K_PKCS12_new)
return (K_PKCS12_new)();
1256 kdWarning() <<
"PKCS12_new not defined!" << endl;
1261 void KOpenSSLProxy::PKCS12_free(PKCS12 *a) {
1262 if (K_PKCS12_free) (K_PKCS12_free)(a);
1263 else kdWarning() <<
"PKCS12_free not defined!" << endl;
1267 int KOpenSSLProxy::PKCS12_parse(PKCS12 *p12,
const char *pass, EVP_PKEY **pkey,
1268 X509 **cert, STACK_OF(X509) **ca) {
1269 if (K_PKCS12_parse)
return (K_PKCS12_parse) (p12, pass, pkey, cert, ca);
1270 kdWarning() <<
"PKCS12_parse not defined!" << endl;
1275 void KOpenSSLProxy::EVP_PKEY_free(EVP_PKEY *x) {
1276 if (K_EVP_PKEY_free) (K_EVP_PKEY_free)(x);
1277 else kdWarning() <<
"EVP_PKEY_free not defined!" << endl;
1281 EVP_PKEY* KOpenSSLProxy::EVP_PKEY_new() {
1282 if (K_EVP_PKEY_new)
return (K_EVP_PKEY_new)();
1283 kdWarning() <<
"EVP_PKEY_new not defined!" << endl;
1288 int KOpenSSLProxy::EVP_PKEY_base_id(
const EVP_PKEY *pkey) {
1289 if (K_EVP_PKEY_base_id)
return (K_EVP_PKEY_base_id)(pkey);
1290 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1293 kdWarning() <<
"EVP_PKEY_base_id not defined!" << endl;
1298 RSA* KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey) {
1299 if (K_EVP_PKEY_get0_RSA)
return (K_EVP_PKEY_get0_RSA)(pkey);
1300 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1301 return pkey->pkey.rsa;
1303 kdWarning() <<
"EVP_PKEY_get0_RSA not defined!" << endl;
1308 DSA* KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey) {
1309 if (K_EVP_PKEY_get0_DSA)
return (K_EVP_PKEY_get0_DSA)(pkey);
1310 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1311 return pkey->pkey.dsa;
1313 kdWarning() <<
"EVP_PKEY_get0_DSA not defined!" << endl;
1318 void KOpenSSLProxy::X509_REQ_free(X509_REQ *x) {
1319 if (K_X509_REQ_free) (K_X509_REQ_free)(x);
1320 else kdWarning() <<
"X509_REQ_free not defined!" << endl;
1324 X509_REQ* KOpenSSLProxy::X509_REQ_new() {
1325 if (K_X509_REQ_new)
return (K_X509_REQ_new)();
1326 kdWarning() <<
"X509_REQ_new not defined!" << endl;
1331 int KOpenSSLProxy::SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) {
1332 if (K_SSL_CTX_use_PrivateKey)
return (K_SSL_CTX_use_PrivateKey)(ctx,pkey);
1333 kdWarning() <<
"SSL_CTX_use_PrivateKey not defined!" << endl;
1338 int KOpenSSLProxy::SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) {
1339 if (K_SSL_CTX_use_certificate)
return (K_SSL_CTX_use_certificate)(ctx,x);
1340 kdWarning() <<
"SSL_CTX_use_certificate not defined!" << endl;
1345 int KOpenSSLProxy::SSL_get_error(SSL *ssl,
int rc) {
1346 if (K_SSL_get_error)
return (K_SSL_get_error)(ssl,rc);
1347 kdWarning() <<
"SSL_get_error not defined!" << endl;
1352 STACK_OF(X509) *KOpenSSLProxy::SSL_get_peer_cert_chain(SSL *s) {
1353 if (K_SSL_get_peer_cert_chain)
return (K_SSL_get_peer_cert_chain)(s);
1354 kdWarning() <<
"SSL_get_peer_cert_chain not defined!" << endl;
1359 void KOpenSSLProxy::OPENSSL_sk_free(STACK *s) {
1360 if (K_sk_free) (K_sk_free)(s);
1361 else kdWarning() <<
"OPENSSL_sk_free not defined!" << endl;
1365 int KOpenSSLProxy::OPENSSL_sk_num(STACK *s) {
1366 if (K_sk_num)
return (K_sk_num)(s);
1367 kdWarning() <<
"OPENSSL_sk_num not defined!" << endl;
1372 char *KOpenSSLProxy::OPENSSL_sk_pop(STACK *s) {
1373 if (K_sk_pop)
return (K_sk_pop)(s);
1374 kdWarning() <<
"OPENSSL_sk_pop not defined!" << endl;
1379 char *KOpenSSLProxy::OPENSSL_sk_value(STACK *s,
int n) {
1380 if (K_sk_value)
return (K_sk_value)(s, n);
1381 kdWarning() <<
"OPENSSL_sk_value not defined!" << endl;
1386 void KOpenSSLProxy::X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *v, STACK_OF(X509)* x) {
1387 if (K_X509_STORE_CTX_set0_untrusted) (K_X509_STORE_CTX_set0_untrusted)(v,x);
1388 else kdWarning() <<
"X509_STORE_CTX_set0_untrusted not defined!" << endl;
1391 void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v,
int purpose) {
1392 if (K_X509_STORE_CTX_set_purpose) (K_X509_STORE_CTX_set_purpose)(v,purpose);
1393 else kdWarning() <<
"X509_STORE_CTX_set_purpose not defined!" << endl;
1397 STACK* KOpenSSLProxy::OPENSSL_sk_dup(
const STACK *s) {
1398 if (K_sk_dup)
return (K_sk_dup)(s);
1399 kdWarning() <<
"OPENSSL_sk_dup not defined!" << endl;
1404 STACK* KOpenSSLProxy::OPENSSL_sk_new(
int (*cmp)()) {
1405 if (K_sk_new)
return (K_sk_new)(cmp);
1406 kdWarning() <<
"OPENSSL_sk_new not defined!" << endl;
1411 int KOpenSSLProxy::OPENSSL_sk_push(STACK* s,
char* d) {
1412 if (K_sk_push)
return (K_sk_push)(s,d);
1413 kdWarning() <<
"OPENSSL_sk_push not defined!" << endl;
1418 char *KOpenSSLProxy::i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint) {
1419 if (K_i2s_ASN1_INTEGER)
return (K_i2s_ASN1_INTEGER)(meth, aint);
1420 kdWarning() <<
"i2s_ANS1_INTEGER not defined!" << endl;
1425 ASN1_INTEGER *KOpenSSLProxy::X509_get_serialNumber(X509 *x) {
1426 if (K_X509_get_serialNumber)
return (K_X509_get_serialNumber)(x);
1427 kdWarning() <<
"X509_get_serialNumber not defined!" << endl;
1432 EVP_PKEY *KOpenSSLProxy::X509_get_pubkey(X509 *x) {
1433 if (K_X509_get_pubkey)
return (K_X509_get_pubkey)(x);
1434 kdWarning() <<
"X59_get_pubkey not defined!" << endl;
1439 int KOpenSSLProxy::i2d_PublicKey(EVP_PKEY *a,
unsigned char **pp) {
1440 if (K_i2d_PublicKey)
return (K_i2d_PublicKey)(a,pp);
1441 kdWarning() <<
"i2d_PublicKey not defined!" << endl;
1446 int KOpenSSLProxy::X509_check_private_key(X509 *x, EVP_PKEY *p) {
1447 if (K_X509_check_private_key)
return (K_X509_check_private_key)(x,p);
1448 kdWarning() <<
"X509_check_private_key not defined!" << endl;
1453 char *KOpenSSLProxy::BN_bn2hex(
const BIGNUM *a) {
1454 if (K_BN_bn2hex)
return (K_BN_bn2hex)(a);
1455 kdWarning() <<
"BN_bn2hex not defined!" << endl;
1460 int KOpenSSLProxy::X509_digest(
const X509 *x,
const EVP_MD *t,
unsigned char *md,
unsigned int *len) {
1461 if (K_X509_digest)
return (K_X509_digest)(x, t, md, len);
1462 kdWarning() <<
"X509_digest not defined!" << endl;
1467 EVP_MD *KOpenSSLProxy::EVP_md5() {
1468 if (K_EVP_md5)
return (K_EVP_md5)();
1469 kdWarning() <<
"EVP_md5 not defined!" << endl;
1474 void KOpenSSLProxy::ASN1_INTEGER_free(ASN1_INTEGER *a) {
1475 if (K_ASN1_INTEGER_free) (K_ASN1_INTEGER_free)(a);
1476 else kdWarning() <<
"ANS1_INTEGER_free not defined!" << endl;
1480 int KOpenSSLProxy::OBJ_obj2nid(ASN1_OBJECT *o) {
1481 if (K_OBJ_obj2nid)
return (K_OBJ_obj2nid)(o);
1482 kdWarning() <<
"OBJ_obj2nid not defined!" << endl;
1487 const char * KOpenSSLProxy::OBJ_nid2ln(
int n) {
1488 if (K_OBJ_nid2ln)
return (K_OBJ_nid2ln)(n);
1489 kdWarning() <<
"OBJ_nid2ln not defined!" << endl;
1494 int KOpenSSLProxy::X509_get_ext_count(X509 *x) {
1495 if (K_X509_get_ext_count)
return (K_X509_get_ext_count)(x);
1496 kdWarning() <<
"X509_get_ext_count not defined!" << endl;
1501 int KOpenSSLProxy::X509_get_ext_by_NID(X509 *x,
int nid,
int lastpos) {
1502 if (K_X509_get_ext_by_NID)
return (K_X509_get_ext_by_NID)(x,nid,lastpos);
1503 kdWarning() <<
"X509_get_ext_by_NID not defined!" << endl;
1508 int KOpenSSLProxy::X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,
int lastpos) {
1509 if (K_X509_get_ext_by_OBJ)
return (K_X509_get_ext_by_OBJ)(x,obj,lastpos);
1510 kdWarning() <<
"X509_get_ext_by_OBJ not defined!" << endl;
1515 X509_EXTENSION *KOpenSSLProxy::X509_get_ext(X509 *x,
int loc) {
1516 if (K_X509_get_ext)
return (K_X509_get_ext)(x,loc);
1517 kdWarning() <<
"X509_get_ext not defined!" << endl;
1522 X509_EXTENSION *KOpenSSLProxy::X509_delete_ext(X509 *x,
int loc) {
1523 if (K_X509_delete_ext)
return (K_X509_delete_ext)(x,loc);
1524 kdWarning() <<
"X509_delete_ext not defined!" << endl;
1529 int KOpenSSLProxy::X509_add_ext(X509 *x, X509_EXTENSION *ex,
int loc) {
1530 if (K_X509_add_ext)
return (K_X509_add_ext)(x,ex,loc);
1531 kdWarning() <<
"X509_add_ext not defined!" << endl;
1536 void *KOpenSSLProxy::X509_get_ext_d2i(X509 *x,
int nid,
int *crit,
int *idx) {
1537 if (K_X509_get_ext_d2i)
return (K_X509_get_ext_d2i)(x,nid,crit,idx);
1538 kdWarning() <<
"X509_get_ext_d2i not defined!" << endl;
1543 char *KOpenSSLProxy::i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5) {
1544 if (K_i2s_ASN1_OCTET_STRING)
return (K_i2s_ASN1_OCTET_STRING)(method,ia5);
1545 kdWarning() <<
"i2s_ANS1_OCTET_STRING not defined!" << endl;
1550 int KOpenSSLProxy::ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a,
int n) {
1551 if (K_ASN1_BIT_STRING_get_bit)
return (K_ASN1_BIT_STRING_get_bit)(a,n);
1552 kdWarning() <<
"ANS1_BIT_STRING_get_bit not defined!" << endl;
1557 PKCS7 *KOpenSSLProxy::PKCS7_new(
void) {
1558 if (K_PKCS7_new)
return (K_PKCS7_new)();
1559 kdWarning() <<
"PKCS7_new not defined!" << endl;
1564 void KOpenSSLProxy::PKCS7_free(PKCS7 *a) {
1565 if (K_PKCS7_free) (K_PKCS7_free)(a);
1566 else kdWarning() <<
"PKCS7_free not defined!" << endl;
1570 void KOpenSSLProxy::PKCS7_content_free(PKCS7 *a) {
1571 if (K_PKCS7_content_free) (K_PKCS7_content_free)(a);
1572 else kdWarning() <<
"PKCS7_content_free not defined!" << endl;
1576 int KOpenSSLProxy::i2d_PKCS7(PKCS7 *a,
unsigned char **pp) {
1577 if (K_i2d_PKCS7)
return (K_i2d_PKCS7)(a,pp);
1578 kdWarning() <<
"i2d_PKCS7 not defined!" << endl;
1583 PKCS7 *KOpenSSLProxy::d2i_PKCS7(PKCS7 **a,
unsigned char **pp,
long length) {
1584 if (K_d2i_PKCS7)
return (K_d2i_PKCS7)(a,pp,length);
1585 kdWarning() <<
"d2i_PKCS7 not defined!" << endl;
1590 int KOpenSSLProxy::i2d_PKCS7_fp(FILE *fp,PKCS7 *p7) {
1591 if (K_i2d_PKCS7_fp)
return (K_i2d_PKCS7_fp)(fp,p7);
1592 kdWarning() <<
"i2d_PKCS7_fd not defined!" << endl;
1597 PKCS7 *KOpenSSLProxy::d2i_PKCS7_fp(FILE *fp,PKCS7 **p7) {
1598 if (K_d2i_PKCS7_fp)
return (K_d2i_PKCS7_fp)(fp,p7);
1599 kdWarning() <<
"d2i_PKCS7_fp not defined!" << endl;
1604 int KOpenSSLProxy::i2d_PKCS7_bio(BIO *bp,PKCS7 *p7) {
1605 if (K_i2d_PKCS7_bio)
return (K_i2d_PKCS7_bio)(bp, p7);
1606 kdWarning() <<
"i2d_PKCS7_bio not defined!" << endl;
1611 PKCS7 *KOpenSSLProxy::d2i_PKCS7_bio(BIO *bp,PKCS7 **p7) {
1612 if (K_d2i_PKCS7_bio)
return (K_d2i_PKCS7_bio)(bp, p7);
1613 kdWarning() <<
"d2i_PKCS7_bio not defined!" << endl;
1618 PKCS7 *KOpenSSLProxy::PKCS7_dup(PKCS7 *p7) {
1619 if (K_PKCS7_dup)
return (K_PKCS7_dup)(p7);
1620 kdWarning() <<
"PKCS7_dup not defined!" << endl;
1625 PKCS7 *KOpenSSLProxy::PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
1626 BIO *data,
int flags) {
1627 if (K_PKCS7_sign)
return (K_PKCS7_sign)(signcert,pkey,certs,data,flags);
1628 kdWarning() <<
"PKCS7_sign not defined!" << endl;
1633 int KOpenSSLProxy::PKCS7_verify(PKCS7* p, STACK_OF(X509)* st, X509_STORE* s, BIO* in, BIO *out,
int flags) {
1634 if (K_PKCS7_verify)
return (K_PKCS7_verify)(p,st,s,in,out,flags);
1635 kdWarning() <<
"PKCS7_verify not defined!" << endl;
1640 STACK_OF(X509) *KOpenSSLProxy::PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs,
int flags) {
1641 if (K_PKCS7_get0_signers)
return (K_PKCS7_get0_signers)(p7,certs,flags);
1642 kdWarning() <<
"PKCS7_get0_signers not defined!" << endl;
1647 PKCS7 *KOpenSSLProxy::PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
1649 if (K_PKCS7_encrypt)
return (K_PKCS7_encrypt)(certs,in,cipher,flags);
1650 kdWarning() <<
"PKCS7_encrypt not defined!" << endl;
1655 int KOpenSSLProxy::PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
int flags) {
1656 if (K_PKCS7_decrypt)
return (K_PKCS7_decrypt)(p7,pkey,cert,data,flags);
1657 kdWarning() <<
"PKCS7_decrypt not defined!" << endl;
1662 STACK_OF(X509_NAME) *KOpenSSLProxy::SSL_load_client_CA_file(
const char *file) {
1663 if (K_SSL_load_client_CA_file)
return (K_SSL_load_client_CA_file)(file);
1664 kdWarning() <<
"SSL_load_client_CA_file not defined!" << endl;
1669 STACK_OF(X509_INFO) *KOpenSSLProxy::PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
void *u) {
1670 if (K_PEM_X509_INFO_read)
return (K_PEM_X509_INFO_read)(fp,sk,cb,u);
1671 kdWarning() <<
"PEM_X509_INFO_read not defined!" << endl;
1676 X509 *KOpenSSLProxy::X509_d2i_fp(FILE *out, X509** buf) {
1677 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)));
1678 kdWarning() <<
"X509_d2i_fp not defined!" << endl;
1683 int KOpenSSLProxy::SSL_peek(SSL *ssl,
void *buf,
int num) {
1684 if (K_SSL_peek)
return (K_SSL_peek)(ssl,buf,num);
1685 kdWarning() <<
"SSL_peek not defined!" << endl;
1690 const char *KOpenSSLProxy::RAND_file_name(
char *buf,
size_t num) {
1691 if (K_RAND_file_name)
return (K_RAND_file_name)(buf, num);
1692 kdWarning() <<
"RAND_file_name not defined!" << endl;
1697 int KOpenSSLProxy::RAND_load_file(
const char *filename,
long max_bytes) {
1698 if (K_RAND_load_file)
return (K_RAND_load_file)(filename, max_bytes);
1699 kdWarning() <<
"REND_load_file not defined!" << endl;
1704 int KOpenSSLProxy::RAND_write_file(
const char *filename) {
1705 if (K_RAND_write_file)
return (K_RAND_write_file)(filename);
1706 kdWarning() <<
"RAND_write_file not defined!" << endl;
1711 int KOpenSSLProxy::X509_PURPOSE_get_count() {
1712 if (K_X509_PURPOSE_get_count)
return (K_X509_PURPOSE_get_count)();
1713 kdWarning() <<
"X509_PURPOSE_get_count not defined!" << endl;
1718 int KOpenSSLProxy::X509_PURPOSE_get_id(X509_PURPOSE *p) {
1719 if (K_X509_PURPOSE_get_id)
return (K_X509_PURPOSE_get_id)(p);
1720 kdWarning() <<
"X509_PURPOSE_get_id not defined!" << endl;
1725 int KOpenSSLProxy::X509_check_purpose(X509 *x,
int id,
int ca) {
1726 if (K_X509_check_purpose)
return (K_X509_check_purpose)(x, id, ca);
1727 kdWarning() <<
"X509_check_purpose not defined!" << endl;
1732 X509_PURPOSE *KOpenSSLProxy::X509_PURPOSE_get0(
int idx) {
1733 if (K_X509_PURPOSE_get0)
return (K_X509_PURPOSE_get0)(idx);
1734 kdWarning() <<
"X509_PURPOSE_get0 not defined!" << endl;
1739 int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey,
int type,
char *key) {
1740 if (K_EVP_PKEY_assign)
return (K_EVP_PKEY_assign)(pkey, type, key);
1741 kdWarning() <<
"EVP_PKEY_assign not defined!" << endl;
1746 int KOpenSSLProxy::X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) {
1747 if (K_X509_REQ_set_pubkey)
return (K_X509_REQ_set_pubkey)(x, pkey);
1748 kdWarning() <<
"X509_REQ_set_pubkey not defined!" << endl;
1753 void KOpenSSLProxy::RSA_get0_key(
const RSA *r,
1754 const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d) {
1755 if (K_RSA_get0_key) {
1756 (K_RSA_get0_key)(r, n, e, d);
1759 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1766 kdWarning() <<
"REG_get0_key not defined!" << endl;
1770 RSA* KOpenSSLProxy::RSA_generate_key(
int bits,
unsigned long e,
void
1771 (*callback)(
int,
int,
void *),
void *cb_arg) {
1772 if (K_RSA_generate_key)
return (K_RSA_generate_key)(bits, e, callback, cb_arg);
1773 kdWarning() <<
"RSA_generate_key not defined!" << endl;
1778 void KOpenSSLProxy::DSA_get0_pqg(
const DSA *d,
1779 const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g) {
1780 if (K_DSA_get0_pqg) {
1781 (K_DSA_get0_pqg)(d, p, q, g);
1784 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1791 kdWarning() <<
"DSA_get0_pqg not defined!" << endl;
1795 void KOpenSSLProxy::DSA_get0_key(
const DSA *d,
1796 const BIGNUM **pub_key,
const BIGNUM **priv_key) {
1797 if (K_DSA_get0_key) {
1798 (K_DSA_get0_key)(d, pub_key, priv_key);
1801 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1803 if (pub_key) *pub_key = d->pub_key;
1804 if (priv_key) *priv_key = d->priv_key;
1807 kdWarning() <<
"DSA_get0_key not defined!" << endl;
1811 STACK *KOpenSSLProxy::X509_get1_email(X509 *x) {
1812 if (K_X509_get1_email)
return (K_X509_get1_email)(x);
1813 kdWarning() <<
"X509_get1_email not defined!" << endl;
1817 void KOpenSSLProxy::X509_email_free(STACK *sk) {
1818 if (K_X509_email_free) (K_X509_email_free)(sk);
1819 else kdWarning() <<
"X509_email_free not defined!" << endl;
1822 EVP_CIPHER *KOpenSSLProxy::EVP_des_ede3_cbc() {
1823 if (K_EVP_des_ede3_cbc)
return (K_EVP_des_ede3_cbc)();
1824 kdWarning() <<
"EVM_des_ede3_cbc not defined!" << endl;
1828 EVP_CIPHER *KOpenSSLProxy::EVP_des_cbc() {
1829 if (K_EVP_des_cbc)
return (K_EVP_des_cbc)();
1830 kdWarning() <<
"EVP_des_cbc not defined!" << endl;
1834 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_cbc() {
1835 if (K_EVP_rc2_cbc)
return (K_EVP_rc2_cbc)();
1836 kdWarning() <<
"EVP_rc2_cbc not defined!" << endl;
1840 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_64_cbc() {
1841 if (K_EVP_rc2_64_cbc)
return (K_EVP_rc2_64_cbc)();
1842 kdWarning() <<
"EVP_rc2_64_cbc not defined!" << endl;
1846 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_40_cbc() {
1847 if (K_EVP_rc2_40_cbc)
return (K_EVP_rc2_40_cbc)();
1848 kdWarning() <<
"EVP_rc2_40_cbc not defined!" << endl;
1852 int KOpenSSLProxy::i2d_X509_REQ_fp(FILE *fp, X509_REQ *x) {
1853 if (K_i2d_X509_REQ_fp)
return (K_i2d_X509_REQ_fp)(fp,x);
1854 kdWarning() <<
"i2d_X509_REQ_fp not defined!" << endl;
1859 void KOpenSSLProxy::ERR_clear_error() {
1860 if (K_ERR_clear_error) (K_ERR_clear_error)();
1861 else kdWarning() <<
"ERR_clear_error not defined!" << endl;
1865 unsigned long KOpenSSLProxy::ERR_get_error() {
1866 if (K_ERR_get_error)
return (K_ERR_get_error)();
1867 kdWarning() <<
"ERR_get_error not defined!" << endl;
1872 void KOpenSSLProxy::ERR_print_errors_fp(FILE* fp) {
1873 if (K_ERR_print_errors_fp) (K_ERR_print_errors_fp)(fp);
1874 else kdWarning() <<
"ERR_print_errors_fp not defined!" << endl;
1878 SSL_SESSION *KOpenSSLProxy::SSL_get1_session(SSL *ssl) {
1879 if (K_SSL_get1_session)
return (K_SSL_get1_session)(ssl);
1880 kdWarning() <<
"SSL_get1_session not defined!" << endl;
1885 void KOpenSSLProxy::SSL_SESSION_free(SSL_SESSION *session) {
1886 if (K_SSL_SESSION_free) (K_SSL_SESSION_free)(session);
1887 else kdWarning() <<
"SSL_SESSION_free not defined!" << endl;
1891 int KOpenSSLProxy::SSL_set_session(SSL *ssl, SSL_SESSION *session) {
1892 if (K_SSL_set_session)
return (K_SSL_set_session)(ssl, session);
1893 kdWarning() <<
"SSL_set_session not defined!" << endl;
1898 SSL_SESSION *KOpenSSLProxy::d2i_SSL_SESSION(SSL_SESSION **a,
unsigned char **pp,
long length) {
1899 if (K_d2i_SSL_SESSION)
return (K_d2i_SSL_SESSION)(a, pp, length);
1900 kdWarning() <<
"d2i_SSL_SESSION not defined!" << endl;
1905 int KOpenSSLProxy::i2d_SSL_SESSION(SSL_SESSION *in,
unsigned char **pp) {
1906 if (K_i2d_SSL_SESSION)
return (K_i2d_SSL_SESSION)(in, pp);
1907 kdWarning() <<
"i2d_SSL_SESSION not defined!" << endl;
1912 int KOpenSSLProxy::i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *p) {
1913 if (K_i2d_PrivateKey_fp)
return (K_i2d_PrivateKey_fp)(fp, p);
1914 kdWarning() <<
"i2d_PrivateKey not defined!" << endl;
1919 int KOpenSSLProxy::i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *p,
const EVP_CIPHER *c,
char *k,
int klen, pem_password_cb *cb,
void *u) {
1920 if (K_i2d_PKCS8PrivateKey_fp)
return (K_i2d_PKCS8PrivateKey_fp)(fp, p, c, k, klen, cb, u);
1921 kdWarning() <<
"i2d_PKCS8PrivateKey_fp not defined!" << endl;
1926 void KOpenSSLProxy::RSA_free(RSA *rsa) {
1927 if (K_RSA_free) (K_RSA_free)(rsa);
1928 else kdWarning() <<
"RSA_free not defined!" << endl;
1932 EVP_CIPHER *KOpenSSLProxy::EVP_bf_cbc() {
1933 if (K_EVP_bf_cbc)
return (K_EVP_bf_cbc)();
1934 kdWarning() <<
"EVP_bf_cbc not defined!" << endl;
1939 int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey,
const EVP_MD *md) {
1940 if (K_X509_REQ_sign)
return (K_X509_REQ_sign)(x, pkey, md);
1941 kdWarning() <<
"X509_REQ_sign not defined!" << endl;
1946 int KOpenSSLProxy::X509_NAME_add_entry_by_txt(X509_NAME *name,
char *field,
1947 int type,
unsigned char *bytes,
int len,
int loc,
int set) {
1948 if (K_X509_NAME_add_entry_by_txt)
return (K_X509_NAME_add_entry_by_txt)(name, field, type, bytes, len, loc, set);
1949 kdWarning() <<
"X509_NAME_add_entry not defined!" << endl;
1954 X509_NAME *KOpenSSLProxy::X509_NAME_new() {
1955 if (K_X509_NAME_new)
return (K_X509_NAME_new)();
1956 kdWarning() <<
"X509_NAME_new not defined!" << endl;
1961 int KOpenSSLProxy::X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name) {
1962 if (K_X509_REQ_set_subject_name)
return (K_X509_REQ_set_subject_name)(req, name);
1963 kdWarning() <<
"X509_REQ_set_subject_name not defined!" << endl;
1968 unsigned char *KOpenSSLProxy::ASN1_STRING_data(ASN1_STRING *x) {
1969 if (K_ASN1_STRING_data)
return (K_ASN1_STRING_data)(x);
1970 kdWarning() <<
"ASN1_STRING_data not defined!" << endl;
1974 int KOpenSSLProxy::ASN1_STRING_length(ASN1_STRING *x) {
1975 if (K_ASN1_STRING_length)
return (K_ASN1_STRING_length)(x);
1976 kdWarning() <<
"ASN1_STRING_length not defined!" << endl;
1980 STACK_OF(SSL_CIPHER) *KOpenSSLProxy::SSL_get_ciphers(
const SSL* ssl) {
1981 if (K_SSL_get_ciphers)
return (K_SSL_get_ciphers)(ssl);
1982 kdWarning() <<
"SSL_get_ciphers not defined!" << endl;
1986 const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_lastUpdate(
const X509_CRL *crl) {
1987 if (K_X509_CRL_get0_lastUpdate)
return (K_X509_CRL_get0_lastUpdate)(crl);
1988 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1989 return X509_CRL_get_lastUpdate(crl);
1991 kdWarning() <<
"X509_CRL_get_lastUpdate not defined!" << endl;
1995 const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_nextUpdate(
const X509_CRL *crl) {
1996 if (K_X509_CRL_get0_nextUpdate)
return (K_X509_CRL_get0_nextUpdate)(crl);
1997 #if OPENSSL_VERSION_NUMBER < 0x10100000L
1998 return X509_CRL_get_nextUpdate(crl);
2000 kdWarning() <<
"X509_CRL_get_nextUpdate not defined!" << endl;
2004 X509* KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) {
2005 if (K_X509_STORE_CTX_get_current_cert)
return (K_X509_STORE_CTX_get_current_cert)(ctx);
2006 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2007 return ctx->current_cert;
2009 kdWarning() <<
"X509_STORE_CTX_get_current_cert not defined!" << endl;
2013 int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) {
2014 if (K_X509_STORE_CTX_get_error)
return (K_X509_STORE_CTX_get_error)(ctx);
2015 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2018 kdWarning() <<
"X509k_STORE_CTX_get_error not defined!" << endl;
2022 int KOpenSSLProxy::X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) {
2023 if (K_X509_STORE_CTX_get_error_depth)
return (K_X509_STORE_CTX_get_error_depth)(ctx);
2024 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2025 return ctx->error_depth;
2027 kdWarning() <<
"X509_STORE_CTX_get_error_depth not defined!" << endl;
2031 void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,
int s) {
2032 if (K_X509_STORE_CTX_set_error) {
2033 (K_X509_STORE_CTX_set_error)(ctx, s);
2036 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2040 kdWarning() <<
"X509_STORE_CTX_set_error not defined!" << endl;
2043 void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *ctx,
2044 X509_STORE_CTX_verify_cb verify_cb) {
2045 if (K_X509_STORE_set_verify_cb) {
2046 (K_X509_STORE_set_verify_cb)(ctx, verify_cb);
2049 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2050 X509_STORE_set_verify_cb_func(ctx, verify_cb);
2053 kdWarning() <<
"X590_STORE_set_verify_cb not defined!" << endl;
2056 STACK_OF(X509_OBJECT)* KOpenSSLProxy::X509_STORE_get0_objects(X509_STORE *v) {
2057 if (K_X509_STORE_get0_objects)
return (K_X509_STORE_get0_objects)(v);
2058 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2061 kdWarning() <<
"X509_STORE_get0_objects not defined!" << endl;
2065 X509_LOOKUP_TYPE KOpenSSLProxy::X509_OBJECT_get_type(
const X509_OBJECT *a) {
2066 if (K_X509_OBJECT_get_type)
return (K_X509_OBJECT_get_type)(a);
2067 #if OPENSSL_VERSION_NUMBER < 0x10100000L
2070 kdWarning() <<
"X509_OBJECT_get_type not defined!" << endl;
2071 #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
2072 return X509_LU_NONE;
2078 X509* KOpenSSLProxy::X509_OBJECT_get0_X509(
const X509_OBJECT *a) {
2079 if (K_X509_OBJECT_get0_X509)
return (K_X509_OBJECT_get0_X509)(a);
2080 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
2081 return a->data.x509;
2083 kdWarning() <<
"X509_OBJECT_get0_X509 not defined!" << endl;
2088 ASN1_TIME* KOpenSSLProxy::X509_getm_notAfter(
const X509 *x) {
2089 if (K_X509_getm_notAfter)
return (K_X509_getm_notAfter)(x);
2090 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
2091 return X509_get_notAfter(x);
2093 kdWarning() <<
"X509_get_notAfter not defined!" << endl;
2097 ASN1_TIME* KOpenSSLProxy::X509_getm_notBefore(
const X509 *x) {
2098 if (K_X509_getm_notBefore)
return (K_X509_getm_notBefore)(x);
2099 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
2100 return X509_get_notBefore(x);
2102 kdWarning() <<
"X509_get_notBefore not defined!" << endl;
2107 STACK* KOpenSSLProxy::sk_dup(
const STACK *s) {
2108 return OPENSSL_sk_dup(s);
2111 void KOpenSSLProxy::sk_free(STACK *s) {
2115 STACK* KOpenSSLProxy::sk_new(
int (*cmp)()) {
2116 return OPENSSL_sk_new(cmp);
2119 int KOpenSSLProxy::sk_num(STACK *s) {
2120 return OPENSSL_sk_num(s);
2123 char* KOpenSSLProxy::sk_pop(STACK *s) {
2124 return OPENSSL_sk_pop(s);
2127 int KOpenSSLProxy::sk_push(STACK *s,
char *d) {
2128 return OPENSSL_sk_push(s, d);
2131 char* KOpenSSLProxy::sk_value(STACK *s,
int n) {
2132 return OPENSSL_sk_value(s, n);
2135 void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) {
2136 X509_STORE_CTX_set0_untrusted(v, x);
2139 SSL_METHOD* KOpenSSLProxy::SSLv23_client_method() {
2140 return TLS_client_method();
Dynamically load and wrap OpenSSL.
void destroy()
Destroy the class and start over - don't use this unless you know what you are doing.
bool hasLibSSL() const
Return true of libssl was found and loaded.
bool hasLibCrypto() const
Return true of libcrypto was found and loaded.
static KOpenSSLProxy * self()
Return an instance of class KOpenSSLProxy * You cannot delete this object.