24 #include <openssl/opensslv.h> 28 #include <tdeconfig.h> 29 #include <kstaticdeleter.h> 37 #define GET_CRYPTOLIB_SYMBOL(a) ((_cryptoLib->hasSymbol(a)) ? _cryptoLib->symbol(a) : NULL) 38 #define GET_SSLLIB_SYMBOL(a) ((_sslLib->hasSymbol(a)) ? _sslLib->symbol(a) : NULL) 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_set_options)(SSL *ssl,
long options) = 0L;
60 static int (*K_SSL_session_reused)(SSL *ssl) = 0L;
61 static long (*K_SSL_ctrl) (SSL *,int, long,
void *) = 0L;
62 static int (*K_RAND_egd) (
const char *) = 0L;
63 static const char* (*K_RAND_file_name) (
char *, size_t) = 0L;
64 static int (*K_RAND_load_file) (
const char *, long) = 0L;
65 static int (*K_RAND_write_file) (
const char *) = 0L;
66 static SSL_METHOD * (*K_TLSv1_client_method) () = 0L;
67 static SSL_METHOD * (*K_SSLv2_client_method) () = 0L;
68 static SSL_METHOD * (*K_SSLv3_client_method) () = 0L;
69 static SSL_METHOD * (*K_TLS_client_method) () = 0L;
70 static X509 * (*K_SSL_get_peer_certificate) (SSL *) = 0L;
71 static int (*K_SSL_CIPHER_get_bits) (SSL_CIPHER *,
int *) = 0L;
72 static char * (*K_SSL_CIPHER_get_version) (SSL_CIPHER *) = 0L;
73 static const char * (*K_SSL_CIPHER_get_name) (SSL_CIPHER *) = 0L;
74 static char * (*K_SSL_CIPHER_description) (SSL_CIPHER *,
char *, int) = 0L;
75 static X509 * (*K_d2i_X509) (X509 **,
unsigned char **,long) = 0L;
76 static X509_CRL * (*K_d2i_X509_CRL) (X509_CRL **,
unsigned char **,long) = 0L;
77 static int (*K_i2d_X509) (X509 *,
unsigned char **) = 0L;
78 static int (*K_X509_cmp) (X509 *, X509 *) = 0L;
79 static int (*K_X509_subject_name_cmp) (
const X509 *,
const X509 *) = 0L;
80 static void (*K_X509_STORE_CTX_free) (X509_STORE_CTX *) = 0L;
81 static int (*K_X509_verify_cert) (X509_STORE_CTX *) = 0L;
82 static X509_STORE_CTX *(*K_X509_STORE_CTX_new) (void) = 0L;
83 static void (*K_X509_STORE_free) (X509_STORE *) = 0L;
84 static X509_STORE *(*K_X509_STORE_new) (void) = 0L;
85 static void (*K_X509_free) (X509 *) = 0L;
86 static void (*K_X509_CRL_free) (X509_CRL *) = 0L;
87 static char *(*K_X509_NAME_oneline) (X509_NAME *,
char *,int) = 0L;
88 static X509_NAME *(*K_X509_get_subject_name) (X509 *) = 0L;
89 static X509_NAME *(*K_X509_get_issuer_name) (X509 *) = 0L;
90 static X509_LOOKUP *(*K_X509_STORE_add_lookup) (X509_STORE *, X509_LOOKUP_METHOD *) = 0L;
91 static X509_LOOKUP_METHOD *(*K_X509_LOOKUP_file)(void) = 0L;
92 static void (*K_X509_LOOKUP_free)(X509_LOOKUP *) = 0L;
93 static int (*K_X509_LOOKUP_ctrl)(X509_LOOKUP *, int,
const char *, long,
char **) = 0L;
94 static void (*K_X509_STORE_CTX_init)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *) = 0L;
95 static void (*K_CRYPTO_free) (
void *) = 0L;
96 static X509* (*K_X509_dup) (X509 *) = 0L;
97 static void (*K_X509_get0_signature)(
const ASN1_BIT_STRING **psig,
98 const X509_ALGOR **palg,
const X509 *x) = 0L;
99 static BIO_METHOD *(*K_BIO_s_mem) (void) = 0L;
100 static BIO* (*K_BIO_new) (BIO_METHOD *) = 0L;
101 static BIO* (*K_BIO_new_fp) (FILE *, int) = 0L;
102 static BIO* (*K_BIO_new_mem_buf) (
void *, int) = 0L;
103 static int (*K_BIO_free) (BIO *) = 0L;
104 static long (*K_BIO_ctrl) (BIO *,int,long,
void *) = 0L;
105 static int (*K_BIO_write) (BIO *b,
const void *data,
int len) = 0L;
106 static void* (*K_BIO_get_data) (BIO *a) = 0L;
107 static int (*K_PEM_ASN1_write_bio) (int (*)(),
const char *,BIO *,
char *,
108 const EVP_CIPHER *,
unsigned char *,
int ,
109 pem_password_cb *,
void *) = 0L;
110 #if OPENSSL_VERSION_NUMBER >= 0x10000000L 111 static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,
unsigned char *) = 0L;
112 static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
114 static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
115 static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,
unsigned char *) = 0L;
116 static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *,
unsigned char **) = 0L;
118 static int (*K_X509_print_fp) (FILE *, X509*) = 0L;
119 static int (*K_i2d_PKCS12) (PKCS12*,
unsigned char**) = 0L;
120 static int (*K_i2d_PKCS12_fp) (FILE *, PKCS12*) = 0L;
121 static int (*K_PKCS12_newpass) (PKCS12*,
char*,
char*) = 0L;
122 static PKCS12* (*K_d2i_PKCS12_fp) (FILE*, PKCS12**) = 0L;
123 static PKCS12* (*K_PKCS12_new) (void) = 0L;
124 static void (*K_PKCS12_free) (PKCS12 *) = 0L;
125 static int (*K_PKCS12_parse) (PKCS12*,
const char *, EVP_PKEY**,
126 X509**, STACK_OF(X509)**) = 0L;
127 static void (*K_EVP_PKEY_free) (EVP_PKEY *) = 0L;
128 static EVP_PKEY* (*K_EVP_PKEY_new) () = 0L;
129 static int (*K_EVP_PKEY_base_id)(
const EVP_PKEY *pkey) = 0L;
130 static RSA* (*K_EVP_PKEY_get0_RSA)(EVP_PKEY *pkey) = 0L;
131 static DSA* (*K_EVP_PKEY_get0_DSA)(EVP_PKEY *pkey) = 0L;
132 static void (*K_X509_REQ_free) (X509_REQ *) = 0L;
133 static X509_REQ* (*K_X509_REQ_new) () = 0L;
134 static int (*K_SSL_CTX_use_PrivateKey) (SSL_CTX*, EVP_PKEY*) = 0L;
135 static int (*K_SSL_CTX_use_certificate) (SSL_CTX*, X509*) = 0L;
136 static int (*K_SSL_get_error) (SSL*, int) = 0L;
137 static STACK_OF(X509)* (*K_SSL_get_peer_cert_chain) (SSL*) = 0L;
138 static void (*K_X509_STORE_CTX_set0_untrusted) (X509_STORE_CTX *, STACK_OF(X509)*) = 0L;
139 static void (*K_X509_STORE_CTX_set_purpose) (X509_STORE_CTX *, int) = 0L;
140 static void (*K_sk_free) (STACK*) = 0L;
141 static int (*K_sk_num) (STACK*) = 0L;
142 static char* (*K_sk_pop) (STACK*) = 0L;
143 static char* (*K_sk_value) (STACK*, int) = 0L;
144 static STACK* (*K_sk_new) (int (*)()) = 0L;
145 static int (*K_sk_push) (STACK*,
char*) = 0L;
146 static STACK* (*K_sk_dup) (
const STACK *) = 0L;
147 static char * (*K_i2s_ASN1_INTEGER) (X509V3_EXT_METHOD *, ASN1_INTEGER *) =0L;
148 static ASN1_INTEGER * (*K_X509_get_serialNumber) (X509 *) = 0L;
149 static EVP_PKEY *(*K_X509_get_pubkey)(X509 *) = 0L;
150 static int (*K_i2d_PublicKey)(EVP_PKEY *,
unsigned char **) = 0L;
151 static int (*K_X509_check_private_key)(X509 *, EVP_PKEY *) = 0L;
152 static char * (*K_BN_bn2hex)(
const BIGNUM *) = 0L;
153 static int (*K_X509_digest)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *) = 0L;
154 static EVP_MD* (*K_EVP_md5)() = 0L;
155 static void (*K_ASN1_INTEGER_free)(ASN1_INTEGER *) = 0L;
156 static int (*K_OBJ_obj2nid)(ASN1_OBJECT *) = 0L;
157 static const char * (*K_OBJ_nid2ln)(int) = 0L;
158 static int (*K_X509_get_ext_count)(X509*) = 0L;
159 static int (*K_X509_get_ext_by_NID)(X509*, int, int) = 0L;
160 static int (*K_X509_get_ext_by_OBJ)(X509*,ASN1_OBJECT*,int) = 0L;
161 static X509_EXTENSION *(*K_X509_get_ext)(X509*,
int loc) = 0L;
162 static X509_EXTENSION *(*K_X509_delete_ext)(X509*, int) = 0L;
163 static int (*K_X509_add_ext)(X509*, X509_EXTENSION*, int) = 0L;
164 static void *(*K_X509_get_ext_d2i)(X509*, int,
int*,
int*) = 0L;
165 static char *(*K_i2s_ASN1_OCTET_STRING)(X509V3_EXT_METHOD*, ASN1_OCTET_STRING*) = 0L;
166 static int (*K_ASN1_BIT_STRING_get_bit)(ASN1_BIT_STRING*, int) = 0L;
167 static PKCS7 *(*K_PKCS7_new)() = 0L;
168 static void (*K_PKCS7_free)(PKCS7*) = 0L;
169 static void (*K_PKCS7_content_free)(PKCS7*) = 0L;
170 static int (*K_i2d_PKCS7)(PKCS7*,
unsigned char**) = 0L;
171 static PKCS7 *(*K_d2i_PKCS7)(PKCS7**,
unsigned char**,long) = 0L;
172 static int (*K_i2d_PKCS7_fp)(FILE*,PKCS7*) = 0L;
173 static PKCS7* (*K_d2i_PKCS7_fp)(FILE*,PKCS7**) = 0L;
174 static int (*K_i2d_PKCS7_bio)(BIO *bp,PKCS7 *p7) = 0L;
175 static PKCS7 *(*K_d2i_PKCS7_bio)(BIO *bp,PKCS7 **p7) = 0L;
176 static PKCS7* (*K_PKCS7_dup)(PKCS7*) = 0L;
177 static STACK_OF(X509_NAME) *(*K_SSL_load_client_CA_file)(
const char*) = 0L;
178 static STACK_OF(X509_INFO) *(*K_PEM_X509_INFO_read)(FILE*, STACK_OF(X509_INFO)*, pem_password_cb*,
void*) = 0L;
179 static char *(*K_ASN1_d2i_fp)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**) = 0L;
180 static X509 *(*K_X509_new)() = 0L;
181 static int (*K_X509_PURPOSE_get_count)() = 0L;
182 static int (*K_X509_PURPOSE_get_id)(X509_PURPOSE *) = 0L;
183 static int (*K_X509_check_purpose)(X509*,int,int) = 0L;
184 static X509_PURPOSE* (*K_X509_PURPOSE_get0)(int) = 0L;
185 static int (*K_EVP_PKEY_assign)(EVP_PKEY*, int,
char*) = 0L;
186 static int (*K_X509_REQ_set_pubkey)(X509_REQ*, EVP_PKEY*) = 0L;
187 static void (*K_RSA_get0_key)(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d) = 0L;
188 static RSA *(*K_RSA_generate_key)(int,
unsigned long, void (*)(int,int,
void *),
void *) = 0L;
189 static void (*K_DSA_get0_pqg)(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g) = 0L;
190 static void (*K_DSA_get0_key)(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key) = 0L;
191 static int (*K_i2d_X509_REQ_fp)(FILE*, X509_REQ*) = 0L;
192 static void (*K_ERR_clear_error)() = 0L;
193 static unsigned long (*K_ERR_get_error)() = 0L;
194 static void (*K_ERR_print_errors_fp)(FILE*) = 0L;
195 static PKCS7 *(*K_PKCS7_sign)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int) = 0L;
196 static int (*K_PKCS7_verify)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int) = 0L;
197 static STACK_OF(X509) *(*K_PKCS7_get0_signers)(PKCS7 *, STACK_OF(X509) *, int) = 0L;
198 static PKCS7 *(*K_PKCS7_encrypt)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int) = 0L;
199 static int (*K_PKCS7_decrypt)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int) = 0L;
200 static SSL_SESSION* (*K_SSL_get1_session)(SSL*) = 0L;
201 static void (*K_SSL_SESSION_free)(SSL_SESSION*) = 0L;
202 static int (*K_SSL_set_session)(SSL*,SSL_SESSION*) = 0L;
203 static SSL_SESSION* (*K_d2i_SSL_SESSION)(SSL_SESSION**,
unsigned char**, long) = 0L;
204 static int (*K_i2d_SSL_SESSION)(SSL_SESSION*,
unsigned char**) = 0L;
205 static STACK *(*K_X509_get1_email)(X509 *x) = 0L;
206 static void (*K_X509_email_free)(STACK *sk) = 0L;
207 static EVP_CIPHER *(*K_EVP_des_ede3_cbc)() = 0L;
208 static EVP_CIPHER *(*K_EVP_des_cbc)() = 0L;
209 static EVP_CIPHER *(*K_EVP_rc2_cbc)() = 0L;
210 static EVP_CIPHER *(*K_EVP_rc2_64_cbc)() = 0L;
211 static EVP_CIPHER *(*K_EVP_rc2_40_cbc)() = 0L;
212 static int (*K_i2d_PrivateKey_fp)(FILE*,EVP_PKEY*) = 0L;
213 static int (*K_i2d_PKCS8PrivateKey_fp)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*) = 0L;
214 static void (*K_RSA_free)(RSA*) = 0L;
215 static EVP_CIPHER *(*K_EVP_bf_cbc)() = 0L;
216 static int (*K_X509_REQ_sign)(X509_REQ*, EVP_PKEY*,
const EVP_MD*) = 0L;
217 static int (*K_X509_NAME_add_entry_by_txt)(X509_NAME*,
char*, int,
unsigned char*, int, int, int) = 0L;
218 static X509_NAME *(*K_X509_NAME_new)() = 0L;
219 static int (*K_X509_REQ_set_subject_name)(X509_REQ*,X509_NAME*) = 0L;
220 static unsigned char *(*K_ASN1_STRING_data)(ASN1_STRING*) = 0L;
221 static int (*K_ASN1_STRING_length)(ASN1_STRING*) = 0L;
222 static STACK_OF(SSL_CIPHER) *(*K_SSL_get_ciphers)(
const SSL *ssl) = 0L;
223 static const ASN1_TIME* (*K_X509_CRL_get0_lastUpdate)(
const X509_CRL *crl) = 0L;
224 static const ASN1_TIME* (*K_X509_CRL_get0_nextUpdate)(
const X509_CRL *crl) = 0L;
225 static X509* (*K_X509_STORE_CTX_get_current_cert)(X509_STORE_CTX *ctx) = 0L;
226 static int (*K_X509_STORE_CTX_get_error)(X509_STORE_CTX *ctx) = 0L;
227 static int (*K_X509_STORE_CTX_get_error_depth)(X509_STORE_CTX *ctx) = 0L;
228 static void (*K_X509_STORE_CTX_set_error)(X509_STORE_CTX *ctx,
int s) = 0L;
229 static void (*K_X509_STORE_set_verify_cb)(X509_STORE *ctx,
230 X509_STORE_CTX_verify_cb verify_cb) = 0L;
231 static STACK_OF(X509_OBJECT)* (*K_X509_STORE_get0_objects)(X509_STORE *v) = 0L;
232 static X509_LOOKUP_TYPE (*K_X509_OBJECT_get_type)(
const X509_OBJECT *a) = 0L;
233 static X509* (*K_X509_OBJECT_get0_X509)(
const X509_OBJECT *a) = 0L;
234 static ASN1_TIME* (*K_X509_getm_notAfter)(
const X509 *x) = 0L;
235 static ASN1_TIME* (*K_X509_getm_notBefore)(
const X509 *x) = 0L;
241 return _sslLib != 0L;
246 return _cryptoLib != 0L;
257 #include <tqstring.h> 258 #include <tqstringlist.h> 260 static TQString findMostRecentLib(TQString dir, TQString name)
263 TQString filter =
"lib"+name+
".so.*";
264 TQDir d(dir, filter);
267 TQStringList l = d.entryList();
274 uint s = filter.length()-1;
275 for (TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
276 TQString numberpart = (*it).mid(s);
277 uint endmaj = numberpart.find(
'.');
281 int maj = numberpart.left(endmaj).toInt(&ok);
284 int min = numberpart.mid(endmaj+1).toInt(&ok);
287 if (maj > bestmaj || (maj == bestmaj && min > bestmin)) {
301 KOpenSSLProxy::KOpenSSLProxy() {
302 KLibLoader *ll = KLibLoader::self();
304 TQStringList libpaths, libnamesc, libnamess;
310 cfg =
new TDEConfig(
"cryptodefaults",
false,
false);
311 cfg->setGroup(
"OpenSSL");
312 TQString upath = cfg->readPathEntry(
"Path");
313 if (!upath.isEmpty())
320 TQString libname = findMostRecentLib(
"/usr/lib" KDELIBSUFF,
"crypto");
321 if (!libname.isNull())
322 _cryptoLib = ll->globalLibrary(libname.latin1());
324 #elif defined(__CYGWIN__) 325 libpaths <<
"/usr/bin/" 327 <<
"/usr/local/openssl/bin" 328 <<
"/opt/openssl/bin" 329 <<
"/opt/trinity/bin" 332 libnamess <<
"cygssl-0.9.7.dll" 337 libnamesc <<
"cygcrypto.dll" 343 <<
"/opt/freeware/lib/" 345 <<
"/usr/lib" KDELIBSUFF
"/" 346 <<
"/usr/ssl/lib" KDELIBSUFF
"/" 347 <<
"/usr/local/lib" KDELIBSUFF
"/" 348 <<
"/usr/local/openssl/lib" KDELIBSUFF
"/" 349 <<
"/usr/local/ssl/lib" KDELIBSUFF
"/" 350 <<
"/opt/openssl/lib" KDELIBSUFF
"/" 351 <<
"/lib" KDELIBSUFF
"/" 359 <<
"libssl.a(libssl.so.0)" 360 #elif defined(__APPLE__) 362 <<
"libssl.0.9.dylib" 364 #ifdef SHLIB_VERSION_NUMBER 365 <<
"libssl.so." SHLIB_VERSION_NUMBER
376 <<
"libcrypto.a(libcrypto.so.0)" 377 #elif defined(__APPLE__) 379 <<
"libcrypto.0.9.dylib" 381 #ifdef SHLIB_VERSION_NUMBER 382 <<
"libcrypto.so." SHLIB_VERSION_NUMBER
390 for (TQStringList::Iterator it = libpaths.begin();
391 it != libpaths.end();
393 for (TQStringList::Iterator shit = libnamesc.begin();
394 shit != libnamesc.end();
397 if (!alib.isEmpty() && !alib.endsWith(
"/"))
400 TQString tmpStr(alib.latin1());
401 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
402 if (!access(tmpStr.latin1(), R_OK))
403 _cryptoLib = ll->globalLibrary(alib.latin1());
407 TQStringList multiarchdirs = madir.entryList(
"*-*-*", TQDir::Dirs);
408 for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
409 TQString malib = *it + *mait +
"/" + *shit;
410 TQString tmpStr(malib.latin1());
411 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
412 if (!access(tmpStr.latin1(), R_OK))
413 _cryptoLib = ll->globalLibrary(malib.latin1());
416 if (_cryptoLib)
break;
418 if (_cryptoLib)
break;
423 K_X509_free = (void (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_free");
424 K_X509_CRL_free = (void (*) (X509_CRL *)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_free");
425 K_RAND_egd = (int (*)(
const char *)) GET_CRYPTOLIB_SYMBOL(
"RAND_egd");
426 K_RAND_load_file = (int (*)(
const char *, long)) GET_CRYPTOLIB_SYMBOL(
"RAND_load_file");
427 K_RAND_file_name = (
const char* (*)(
char *, size_t)) GET_CRYPTOLIB_SYMBOL(
"RAND_file_name");
428 K_RAND_write_file = (int (*)(
const char *)) GET_CRYPTOLIB_SYMBOL(
"RAND_write_file");
429 K_CRYPTO_free = (void (*) (
void *)) GET_CRYPTOLIB_SYMBOL(
"CRYPTO_free");
430 K_d2i_X509 = (X509 * (*)(X509 **,
unsigned char **,long)) GET_CRYPTOLIB_SYMBOL(
"d2i_X509");
431 K_d2i_X509_CRL = (X509_CRL * (*)(X509_CRL **,
unsigned char **,long)) GET_CRYPTOLIB_SYMBOL(
"d2i_X509_CRL");
432 K_i2d_X509 = (int (*)(X509 *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_X509");
433 K_X509_cmp = (int (*)(X509 *, X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_cmp");
434 K_X509_subject_name_cmp = (int (*)(
const X509 *,
const X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_subject_name_cmp");
435 K_X509_STORE_CTX_new = (X509_STORE_CTX * (*) (void)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_new");
436 K_X509_STORE_CTX_free = (void (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_free");
437 K_X509_verify_cert = (int (*) (X509_STORE_CTX *)) GET_CRYPTOLIB_SYMBOL(
"X509_verify_cert");
438 K_X509_STORE_new = (X509_STORE * (*) (void)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_new");
439 K_X509_STORE_free = (void (*) (X509_STORE *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_free");
440 K_X509_NAME_oneline = (
char * (*) (X509_NAME *,
char *,int)) GET_CRYPTOLIB_SYMBOL(
"X509_NAME_oneline");
441 K_X509_get_subject_name = (X509_NAME * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_subject_name");
442 K_X509_get_issuer_name = (X509_NAME * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_issuer_name");
443 K_X509_STORE_add_lookup = (X509_LOOKUP *(*) (X509_STORE *, X509_LOOKUP_METHOD *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_add_lookup");
444 K_X509_LOOKUP_file = (X509_LOOKUP_METHOD *(*)(void)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_file");
445 K_X509_LOOKUP_free = (void (*)(X509_LOOKUP *)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_free");
446 K_X509_LOOKUP_ctrl = (int (*)(X509_LOOKUP *, int,
const char *, long,
char **)) GET_CRYPTOLIB_SYMBOL(
"X509_LOOKUP_ctrl");
447 K_X509_STORE_CTX_init = (void (*)(X509_STORE_CTX *, X509_STORE *, X509 *, STACK_OF(X509) *)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_init");
448 K_X509_dup = (X509* (*)(X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_dup");
449 K_X509_get0_signature = (void (*)(
const ASN1_BIT_STRING **psig,
450 const X509_ALGOR **palg,
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_get0_signature");
451 K_BIO_s_mem = (BIO_METHOD *(*) (void)) GET_CRYPTOLIB_SYMBOL(
"BIO_s_mem");
452 K_BIO_new = (BIO* (*)(BIO_METHOD *)) GET_CRYPTOLIB_SYMBOL(
"BIO_new");
453 K_BIO_new_fp = (BIO* (*)(FILE*, int)) GET_CRYPTOLIB_SYMBOL(
"BIO_new_fp");
454 K_BIO_new_mem_buf = (BIO* (*)(
void *, int)) GET_CRYPTOLIB_SYMBOL(
"BIO_new_mem_buf");
455 K_BIO_free = (int (*)(BIO*)) GET_CRYPTOLIB_SYMBOL(
"BIO_free");
456 K_BIO_ctrl = (long (*) (BIO *,int,long,
void *)) GET_CRYPTOLIB_SYMBOL(
"BIO_ctrl");
457 K_BIO_write = (int (*) (BIO *b,
const void *data,
int len)) GET_CRYPTOLIB_SYMBOL(
"BIO_write");
458 K_BIO_get_data = (
void* (*)(BIO *a)) GET_CRYPTOLIB_SYMBOL(
"BIO_get_data");
459 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");
460 #if OPENSSL_VERSION_NUMBER >= 0x10000000L 461 K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*,
unsigned char *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_item_i2d_fp");
462 K_NETSCAPE_X509_it = (ASN1_ITEM *) GET_CRYPTOLIB_SYMBOL(
"NETSCAPE_X509_it");
464 K_X509_asn1_meth = (ASN1_METHOD* (*)(void)) GET_CRYPTOLIB_SYMBOL(
"X509_asn1_meth");
465 K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*,
unsigned char *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_i2d_fp");
466 K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_ASN1_HEADER");
468 K_X509_print_fp = (int (*)(FILE*, X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_print_fp");
469 K_i2d_PKCS12 = (int (*)(PKCS12*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS12");
470 K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS12_fp");
471 K_PKCS12_newpass = (int (*)(PKCS12*,
char*,
char*)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_newpass");
472 K_d2i_PKCS12_fp = (PKCS12* (*)(FILE*, PKCS12**)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS12_fp");
473 K_PKCS12_new = (PKCS12* (*)()) GET_CRYPTOLIB_SYMBOL(
"PKCS12_new");
474 K_PKCS12_free = (void (*)(PKCS12 *)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_free");
475 K_PKCS12_parse = (int (*)(PKCS12*,
const char *, EVP_PKEY**,
476 X509**, STACK_OF(X509)**)) GET_CRYPTOLIB_SYMBOL(
"PKCS12_parse");
477 K_EVP_PKEY_free = (void (*) (EVP_PKEY *)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_free");
478 K_EVP_PKEY_new = (EVP_PKEY* (*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_new");
479 K_EVP_PKEY_base_id = (int (*)(
const EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_base_id");
480 K_EVP_PKEY_get0_RSA = (RSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_get0_RSA");
481 K_EVP_PKEY_get0_DSA = (DSA* (*)(EVP_PKEY *pkey)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_get0_DSA");
482 K_X509_REQ_free = (void (*)(X509_REQ*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_free");
483 K_X509_REQ_new = (X509_REQ* (*)()) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_new");
484 K_X509_STORE_CTX_set0_untrusted = (void (*)(X509_STORE_CTX *, STACK_OF(X509)*)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set0_untrusted");
485 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");
486 K_X509_STORE_CTX_set_purpose = (void (*)(X509_STORE_CTX *, int)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set_purpose");
487 K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_free");
488 if (!K_sk_free) K_sk_free = (void (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_free");
489 K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_num");
490 if (!K_sk_num) K_sk_num = (int (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_num");
491 K_sk_pop = (
char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_pop");
492 if (!K_sk_pop) K_sk_pop = (
char* (*) (STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_pop");
493 K_sk_value = (
char* (*) (STACK *, int)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_value");
494 if (!K_sk_value) K_sk_value = (
char* (*) (STACK *, int)) GET_CRYPTOLIB_SYMBOL(
"sk_value");
495 K_sk_new = (STACK* (*) (int (*)())) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_new");
496 if (!K_sk_new) K_sk_new = (STACK* (*) (int (*)())) GET_CRYPTOLIB_SYMBOL(
"sk_new");
497 K_sk_push = (int (*) (STACK*,
char*)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_push");
498 if (!K_sk_push) K_sk_push = (int (*) (STACK*,
char*)) GET_CRYPTOLIB_SYMBOL(
"sk_push");
499 K_sk_dup = (STACK* (*) (
const STACK *)) GET_CRYPTOLIB_SYMBOL(
"OPENSSL_sk_dup");
500 if (!K_sk_dup) K_sk_dup = (STACK* (*) (
const STACK *)) GET_CRYPTOLIB_SYMBOL(
"sk_dup");
501 K_i2s_ASN1_INTEGER = (
char *(*) (X509V3_EXT_METHOD *, ASN1_INTEGER *)) GET_CRYPTOLIB_SYMBOL(
"i2s_ASN1_INTEGER");
502 K_X509_get_serialNumber = (ASN1_INTEGER * (*) (X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_serialNumber");
503 K_X509_get_pubkey = (EVP_PKEY *(*)(X509 *)) GET_CRYPTOLIB_SYMBOL(
"X509_get_pubkey");
504 K_i2d_PublicKey = (int (*)(EVP_PKEY *,
unsigned char **)) GET_CRYPTOLIB_SYMBOL(
"i2d_PublicKey");
505 K_X509_check_private_key = (int (*)(X509 *, EVP_PKEY *)) GET_CRYPTOLIB_SYMBOL(
"X509_check_private_key");
506 K_BN_bn2hex = (
char *(*)(
const BIGNUM *)) GET_CRYPTOLIB_SYMBOL(
"BN_bn2hex");
507 K_X509_digest = (int (*)(
const X509 *,
const EVP_MD *,
unsigned char *,
unsigned int *)) GET_CRYPTOLIB_SYMBOL(
"X509_digest");
508 K_EVP_md5 = (EVP_MD *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_md5");
509 K_ASN1_INTEGER_free = (void (*)(ASN1_INTEGER *)) GET_CRYPTOLIB_SYMBOL(
"ASN1_INTEGER_free");
510 K_OBJ_obj2nid = (int (*)(ASN1_OBJECT *)) GET_CRYPTOLIB_SYMBOL(
"OBJ_obj2nid");
511 K_OBJ_nid2ln = (
const char *(*)(int)) GET_CRYPTOLIB_SYMBOL(
"OBJ_nid2ln");
512 K_X509_get_ext_count = (int (*)(X509*)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_count");
513 K_X509_get_ext_by_NID = (int (*)(X509*,int,int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_by_NID");
514 K_X509_get_ext_by_OBJ = (int (*)(X509*,ASN1_OBJECT*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_by_OBJ");
515 K_X509_get_ext = (X509_EXTENSION* (*)(X509*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext");
516 K_X509_delete_ext = (X509_EXTENSION* (*)(X509*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_delete_ext");
517 K_X509_add_ext = (int (*)(X509*,X509_EXTENSION*,int)) GET_CRYPTOLIB_SYMBOL(
"X509_add_ext");
518 K_X509_get_ext_d2i = (
void* (*)(X509*,int,
int*,
int*)) GET_CRYPTOLIB_SYMBOL(
"X509_get_ext_d2i");
519 K_i2s_ASN1_OCTET_STRING = (
char *(*)(X509V3_EXT_METHOD*,ASN1_OCTET_STRING*)) GET_CRYPTOLIB_SYMBOL(
"i2s_ASN1_OCTET_STRING");
520 K_ASN1_BIT_STRING_get_bit = (int (*)(ASN1_BIT_STRING*,int)) GET_CRYPTOLIB_SYMBOL(
"ASN1_BIT_STRING_get_bit");
521 K_PKCS7_new = (PKCS7 *(*)()) GET_CRYPTOLIB_SYMBOL(
"PKCS7_new");
522 K_PKCS7_free = (void (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_free");
523 K_PKCS7_content_free = (void (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_content_free");
524 K_i2d_PKCS7 = (int (*)(PKCS7*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7");
525 K_i2d_PKCS7_fp = (int (*)(FILE*,PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7_fp");
526 K_i2d_PKCS7_bio = (int (*)(BIO *bp,PKCS7 *p7)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS7_bio");
527 K_d2i_PKCS7 = (PKCS7* (*)(PKCS7**,
unsigned char**,long)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7");
528 K_d2i_PKCS7_fp = (PKCS7 *(*)(FILE *,PKCS7**)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7_fp");
529 K_d2i_PKCS7_bio = (PKCS7 *(*)(BIO *bp,PKCS7 **p7)) GET_CRYPTOLIB_SYMBOL(
"d2i_PKCS7_bio");
530 K_PKCS7_dup = (PKCS7* (*)(PKCS7*)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_dup");
531 K_PKCS7_sign = (PKCS7 *(*)(X509*, EVP_PKEY*, STACK_OF(X509)*, BIO*, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_sign");
532 K_PKCS7_verify = (int (*)(PKCS7*,STACK_OF(X509)*,X509_STORE*,BIO*,BIO*,int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_verify");
533 K_PKCS7_get0_signers = (STACK_OF(X509) *(*)(PKCS7 *, STACK_OF(X509) *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_get0_signers");
534 K_PKCS7_encrypt = (PKCS7* (*)(STACK_OF(X509) *, BIO *, EVP_CIPHER *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_encrypt");
535 K_PKCS7_decrypt = (int (*)(PKCS7 *, EVP_PKEY *, X509 *, BIO *, int)) GET_CRYPTOLIB_SYMBOL(
"PKCS7_decrypt");
536 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");
537 K_ASN1_d2i_fp = (
char *(*)(
char *(*)(),
char *(*)(),FILE*,
unsigned char**)) GET_CRYPTOLIB_SYMBOL(
"ASN1_d2i_fp");
538 K_X509_new = (X509 *(*)()) GET_CRYPTOLIB_SYMBOL(
"X509_new");
539 K_X509_PURPOSE_get_count = (int (*)()) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get_count");
540 K_X509_PURPOSE_get_id = (int (*)(X509_PURPOSE *)) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get_id");
541 K_X509_check_purpose = (int (*)(X509*,int,int)) GET_CRYPTOLIB_SYMBOL(
"X509_check_purpose");
542 K_X509_PURPOSE_get0 = (X509_PURPOSE *(*)(int)) GET_CRYPTOLIB_SYMBOL(
"X509_PURPOSE_get0");
543 K_EVP_PKEY_assign = (int (*)(EVP_PKEY*, int,
char*)) GET_CRYPTOLIB_SYMBOL(
"EVP_PKEY_assign");
544 K_X509_REQ_set_pubkey = (int (*)(X509_REQ*, EVP_PKEY*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_set_pubkey");
545 K_RSA_get0_key = (void (*)(
const RSA *r,
const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d)) GET_CRYPTOLIB_SYMBOL(
"RSA_get0_key");
546 K_RSA_generate_key = (RSA* (*)(int,
unsigned long, void (*)(int,int,
void *),
void *)) GET_CRYPTOLIB_SYMBOL(
"RSA_generate_key");
547 K_DSA_get0_pqg = (void (*)(
const DSA *d,
const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g)) GET_CRYPTOLIB_SYMBOL(
"DSA_get0_pqg");
548 K_DSA_get0_key = (void (*)(
const DSA *d,
const BIGNUM **pub_key,
const BIGNUM **priv_key)) GET_CRYPTOLIB_SYMBOL(
"DSA_get0_key");
549 K_i2d_X509_REQ_fp = (int (*)(FILE *, X509_REQ *)) GET_CRYPTOLIB_SYMBOL(
"i2d_X509_REQ_fp");
550 K_ERR_clear_error = (void (*)()) GET_CRYPTOLIB_SYMBOL(
"ERR_clear_error");
551 K_ERR_get_error = (
unsigned long (*)()) GET_CRYPTOLIB_SYMBOL(
"ERR_get_error");
552 K_ERR_print_errors_fp = (void (*)(FILE*)) GET_CRYPTOLIB_SYMBOL(
"ERR_print_errors_fp");
553 K_X509_get1_email = (STACK *(*)(X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_get1_email");
554 K_X509_email_free = (void (*)(STACK *sk)) GET_CRYPTOLIB_SYMBOL(
"X509_email_free");
555 K_EVP_des_ede3_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_des_ede3_cbc");
556 K_EVP_des_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_des_cbc");
557 K_EVP_rc2_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_cbc");
558 K_EVP_rc2_64_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_64_cbc");
559 K_EVP_rc2_40_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_rc2_40_cbc");
560 K_i2d_PrivateKey_fp = (int (*)(FILE*,EVP_PKEY*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PrivateKey_fp");
561 K_i2d_PKCS8PrivateKey_fp = (int (*)(FILE*, EVP_PKEY*,
const EVP_CIPHER*,
char*, int, pem_password_cb*,
void*)) GET_CRYPTOLIB_SYMBOL(
"i2d_PKCS8PrivateKey_fp");
562 K_RSA_free = (void (*)(RSA*)) GET_CRYPTOLIB_SYMBOL(
"RSA_free");
563 K_EVP_bf_cbc = (EVP_CIPHER *(*)()) GET_CRYPTOLIB_SYMBOL(
"EVP_bf_cbc");
564 K_X509_REQ_sign = (int (*)(X509_REQ*, EVP_PKEY*,
const EVP_MD*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_sign");
565 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");
566 K_X509_NAME_new = (X509_NAME *(*)()) GET_CRYPTOLIB_SYMBOL(
"X509_NAME_new");
567 K_X509_REQ_set_subject_name = (int (*)(X509_REQ*,X509_NAME*)) GET_CRYPTOLIB_SYMBOL(
"X509_REQ_set_subject_name");
568 K_ASN1_STRING_data = (
unsigned char *(*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL(
"ASN1_STRING_data");
569 K_ASN1_STRING_length = (int (*)(ASN1_STRING*)) GET_CRYPTOLIB_SYMBOL(
"ASN1_STRING_length");
570 K_X509_CRL_get0_lastUpdate = (
const ASN1_TIME* (*)(
const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_get0_lastUpdate");
571 K_X509_CRL_get0_nextUpdate = (
const ASN1_TIME* (*)(
const X509_CRL *crl)) GET_CRYPTOLIB_SYMBOL(
"X509_CRL_get0_nextUpdate");
572 K_X509_STORE_CTX_get_current_cert = (X509* (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_current_cert");
573 K_X509_STORE_CTX_get_error = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_error");
574 K_X509_STORE_CTX_get_error_depth = (int (*)(X509_STORE_CTX *ctx)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_get_error_depth");
575 K_X509_STORE_CTX_set_error = (void (*)(X509_STORE_CTX *ctx,
int s)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_CTX_set_error");
576 K_X509_STORE_set_verify_cb = (void (*)(X509_STORE *ctx,
577 X509_STORE_CTX_verify_cb verify_cb)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_set_verify_cb");
578 K_X509_STORE_get0_objects = (STACK_OF(X509_OBJECT)* (*)(X509_STORE *v)) GET_CRYPTOLIB_SYMBOL(
"X509_STORE_get0_objects");
579 K_X509_OBJECT_get_type = (X509_LOOKUP_TYPE (*)(
const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL(
"X509_OBJECT_get_type");
580 K_X509_OBJECT_get0_X509 = (X509* (*)(
const X509_OBJECT *a)) GET_CRYPTOLIB_SYMBOL(
"X509_OBJECT_get0_X509");
581 K_X509_getm_notAfter = (ASN1_TIME* (*)(
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_getm_notAfter");
582 K_X509_getm_notBefore = (ASN1_TIME* (*)(
const X509 *x)) GET_CRYPTOLIB_SYMBOL(
"X509_getm_notBefore");
588 TQString libname = findMostRecentLib(
"/usr/lib",
"ssl");
589 if (!libname.isNull())
590 _sslLib = ll->globalLibrary(libname.latin1());
593 for (TQStringList::Iterator it = libpaths.begin();
594 it != libpaths.end();
596 for (TQStringList::Iterator shit = libnamess.begin();
597 shit != libnamess.end();
600 if (!alib.isEmpty() && !alib.endsWith(
"/"))
603 TQString tmpStr(alib.latin1());
604 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
605 if (!access(tmpStr.latin1(), R_OK))
606 _sslLib = ll->globalLibrary(alib.latin1());
610 TQStringList multiarchdirs = madir.entryList(
"*-*-*", TQDir::Dirs);
611 for (TQStringList::Iterator mait = multiarchdirs.begin(); mait != multiarchdirs.end(); ++mait ) {
612 TQString malib = *it + *mait +
"/" + *shit;
613 TQString tmpStr(malib.latin1());
614 tmpStr.replace(TQRegExp(
"\\(.*\\)"),
"");
615 if (!access(tmpStr.latin1(), R_OK))
616 _sslLib = ll->globalLibrary(malib.latin1());
628 K_SSL_connect = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_connect");
629 K_SSL_accept = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_accept");
630 K_SSL_read = (int (*)(SSL *,
void *, int)) GET_SSLLIB_SYMBOL(
"SSL_read");
631 K_SSL_write = (int (*)(SSL *,
const void *, int))
632 GET_SSLLIB_SYMBOL(
"SSL_write");
633 K_SSL_new = (SSL* (*)(SSL_CTX *)) GET_SSLLIB_SYMBOL(
"SSL_new");
634 K_SSL_free = (void (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_free");
635 K_SSL_shutdown = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_shutdown");
636 K_SSL_CTX_new = (SSL_CTX* (*)(SSL_METHOD*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_new");
637 K_SSL_CTX_free = (void (*)(SSL_CTX*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_free");
638 K_SSL_set_fd = (int (*)(SSL *, int)) GET_SSLLIB_SYMBOL(
"SSL_set_fd");
639 K_SSL_pending = (int (*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_pending");
640 K_SSL_CTX_set_cipher_list = (int (*)(SSL_CTX *,
const char *))
641 GET_SSLLIB_SYMBOL(
"SSL_CTX_set_cipher_list");
642 K_SSL_CTX_set_verify = (void (*)(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*))) GET_SSLLIB_SYMBOL(
"SSL_CTX_set_verify");
643 K_SSL_use_certificate = (int (*)(SSL*, X509*))
644 GET_SSLLIB_SYMBOL(
"SSL_CTX_use_certificate");
645 K_SSL_get_current_cipher = (SSL_CIPHER *(*)(SSL *))
646 GET_SSLLIB_SYMBOL(
"SSL_get_current_cipher");
647 K_SSL_set_options = (long (*)(SSL *ssl,
long options)) GET_SSLLIB_SYMBOL(
"SSL_set_options");
648 K_SSL_session_reused = (int (*)(SSL *ssl)) GET_SSLLIB_SYMBOL(
"SSL_session_reused");
649 K_SSL_ctrl = (long (*)(SSL * ,int, long,
void *))
650 GET_SSLLIB_SYMBOL(
"SSL_ctrl");
651 K_TLSv1_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"TLSv1_client_method");
652 K_SSLv2_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv2_client_method");
653 K_SSLv3_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv3_client_method");
654 K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"TLS_client_method");
655 if (!K_TLS_client_method) K_TLS_client_method = (SSL_METHOD *(*)()) GET_SSLLIB_SYMBOL(
"SSLv23_client_method");
656 K_SSL_get_peer_certificate = (X509 *(*)(SSL *)) GET_SSLLIB_SYMBOL(
"SSL_get_peer_certificate");
657 K_SSL_CIPHER_get_bits = (int (*)(SSL_CIPHER *,
int *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_bits");
658 K_SSL_CIPHER_get_version = (
char * (*)(SSL_CIPHER *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_version");
659 K_SSL_CIPHER_get_name = (
const char * (*)(SSL_CIPHER *)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_get_name");
660 K_SSL_CIPHER_description = (
char * (*)(SSL_CIPHER *,
char *, int)) GET_SSLLIB_SYMBOL(
"SSL_CIPHER_description");
661 K_SSL_CTX_use_PrivateKey = (int (*)(SSL_CTX*, EVP_PKEY*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_use_PrivateKey");
662 K_SSL_CTX_use_certificate = (int (*)(SSL_CTX*, X509*)) GET_SSLLIB_SYMBOL(
"SSL_CTX_use_certificate");
663 K_SSL_get_error = (int (*)(SSL*, int)) GET_SSLLIB_SYMBOL(
"SSL_get_error");
664 K_SSL_get_peer_cert_chain = (STACK_OF(X509)* (*)(SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get_peer_cert_chain");
665 K_SSL_load_client_CA_file = (STACK_OF(X509_NAME)* (*)(
const char *)) GET_SSLLIB_SYMBOL(
"SSL_load_client_CA_file");
666 K_SSL_peek = (int (*)(SSL*,
void*,int)) GET_SSLLIB_SYMBOL(
"SSL_peek");
667 K_SSL_get1_session = (SSL_SESSION* (*)(SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get1_session");
668 K_SSL_SESSION_free = (void (*)(SSL_SESSION*)) GET_SSLLIB_SYMBOL(
"SSL_SESSION_free");
669 K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) GET_SSLLIB_SYMBOL(
"SSL_set_session");
670 K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,
unsigned char**, long)) GET_SSLLIB_SYMBOL(
"d2i_SSL_SESSION");
671 K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,
unsigned char**)) GET_SSLLIB_SYMBOL(
"i2d_SSL_SESSION");
672 K_SSL_get_ciphers = (STACK_OF(SSL_CIPHER) *(*)(
const SSL*)) GET_SSLLIB_SYMBOL(
"SSL_get_ciphers");
678 x = GET_SSLLIB_SYMBOL(
"SSL_library_init");
680 if (x) ((int (*)())x)();
681 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms");
683 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms");
687 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms_conf");
689 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms_conf");
693 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_algorithms_noconf");
695 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_algorithms_noconf");
700 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_ciphers");
702 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_ciphers");
703 if (x) ((void (*)())x)();
704 x = GET_CRYPTOLIB_SYMBOL(
"OpenSSL_add_all_digests");
706 x = GET_CRYPTOLIB_SYMBOL(
"OPENSSL_add_all_digests");
707 if (x) ((void (*)())x)();
715 static KStaticDeleter<KOpenSSLProxy> medProxy;
719 KOpenSSLProxy::~KOpenSSLProxy() {
724 _cryptoLib->unload();
726 medProxy.setObject(0);
751 int KOpenSSLProxy::SSL_connect(SSL *ssl) {
752 if (K_SSL_connect)
return (K_SSL_connect)(ssl);
753 kdWarning() <<
"SSL_connect not defined!" << endl;
758 int KOpenSSLProxy::SSL_accept(SSL *ssl) {
759 if (K_SSL_accept)
return (K_SSL_accept)(ssl);
760 kdWarning() <<
"SSL_accept not defined!" << endl;
765 int KOpenSSLProxy::SSL_read(SSL *ssl,
void *buf,
int num) {
766 if (K_SSL_read)
return (K_SSL_read)(ssl, buf, num);
767 kdWarning() <<
"SSL_read not defined!" << endl;
772 int KOpenSSLProxy::SSL_write(SSL *ssl,
const void *buf,
int num) {
773 if (K_SSL_write)
return (K_SSL_write)(ssl, buf, num);
774 kdWarning() <<
"SSL_write not defined!" << endl;
779 SSL *KOpenSSLProxy::SSL_new(SSL_CTX *ctx) {
780 if (K_SSL_new)
return (K_SSL_new)(ctx);
781 kdWarning() <<
"SSL_new not defined!" << endl;
786 void KOpenSSLProxy::SSL_free(SSL *ssl) {
787 if (K_SSL_free) (K_SSL_free)(ssl);
788 else kdWarning() <<
"SSL_free not defined!" << endl;
792 int KOpenSSLProxy::SSL_shutdown(SSL *ssl) {
793 if (K_SSL_shutdown)
return (K_SSL_shutdown)(ssl);
794 kdWarning() <<
"SSL_shutdown not defined!" << endl;
799 SSL_CTX *KOpenSSLProxy::SSL_CTX_new(SSL_METHOD *method) {
800 if (K_SSL_CTX_new)
return (K_SSL_CTX_new)(method);
801 kdWarning() <<
"SSL_CTX_new not defined!" << endl;
806 void KOpenSSLProxy::SSL_CTX_free(SSL_CTX *ctx) {
807 if (K_SSL_CTX_free) (K_SSL_CTX_free)(ctx);
808 else kdWarning() <<
"SSL_CTX_free not defined!" << endl;
812 int KOpenSSLProxy::SSL_set_fd(SSL *ssl,
int fd) {
813 if (K_SSL_set_fd)
return (K_SSL_set_fd)(ssl, fd);
814 kdWarning() <<
"SSL_sed_fd not defined!" << endl;
819 int KOpenSSLProxy::SSL_pending(SSL *ssl) {
820 if (K_SSL_pending)
return (K_SSL_pending)(ssl);
821 kdWarning() <<
"SSL_pending not defined!" << endl;
826 int KOpenSSLProxy::SSL_CTX_set_cipher_list(SSL_CTX *ctx,
const char *str) {
827 if (K_SSL_CTX_set_cipher_list)
return (K_SSL_CTX_set_cipher_list)(ctx, str);
828 kdWarning() <<
"SSL_CTX_set_cipher_list not defined!" << endl;
833 void KOpenSSLProxy::SSL_CTX_set_verify(SSL_CTX *ctx,
int mode,
834 int (*verify_callback)(
int, X509_STORE_CTX *)) {
835 if (K_SSL_CTX_set_verify) (K_SSL_CTX_set_verify)(ctx, mode, verify_callback);
836 else kdWarning() <<
"SSL_CTX_set_verify not defined!" << endl;
840 int KOpenSSLProxy::SSL_use_certificate(SSL *ssl, X509 *x) {
841 if (K_SSL_use_certificate)
return (K_SSL_use_certificate)(ssl, x);
842 kdWarning() <<
"SSL_use_certificate not defined!" << endl;
847 SSL_CIPHER *KOpenSSLProxy::SSL_get_current_cipher(SSL *ssl) {
848 if (K_SSL_get_current_cipher)
return (K_SSL_get_current_cipher)(ssl);
849 kdWarning() <<
"SSL_get_current_cipher not defined!" << endl;
854 long KOpenSSLProxy::_SSL_set_options(SSL *ssl,
long options) {
855 if (K_SSL_set_options)
return (K_SSL_set_options)(ssl, options);
856 #if OPENSSL_VERSION_NUMBER < 0x10100000L 857 return this->SSL_set_options(ssl, options);
859 kdWarning() <<
"SSL_set_options not defined!" << endl;
864 int KOpenSSLProxy::_SSL_session_reused(SSL *ssl) {
865 if (K_SSL_session_reused)
return (K_SSL_session_reused)(ssl);
866 #if OPENSSL_VERSION_NUMBER < 0x10100000L 867 return this->SSL_session_reused(ssl);
869 kdWarning() <<
"SSL_session_reused not defined!" << endl;
874 long KOpenSSLProxy::SSL_ctrl(SSL *ssl,
int cmd,
long larg,
void *parg) {
875 if (K_SSL_ctrl)
return (K_SSL_ctrl)(ssl, cmd, larg, parg);
876 kdWarning() <<
"SSL_ctrl not defined!" << endl;
881 int KOpenSSLProxy::RAND_egd(
const char *path) {
882 if (K_RAND_egd)
return (K_RAND_egd)(path);
883 kdWarning() <<
"RAND_egd not defined!" << endl;
888 SSL_METHOD *KOpenSSLProxy::TLSv1_client_method() {
889 if (K_TLSv1_client_method)
return (K_TLSv1_client_method)();
890 kdWarning() <<
"TLSv1_client_method not defined!" << endl;
895 SSL_METHOD *KOpenSSLProxy::SSLv2_client_method() {
896 if (K_SSLv2_client_method)
return (K_SSLv2_client_method)();
897 kdWarning() <<
"SSLv2_client_method not defined!" << endl;
902 SSL_METHOD *KOpenSSLProxy::SSLv3_client_method() {
903 if (K_SSLv3_client_method)
return (K_SSLv3_client_method)();
904 kdWarning() <<
"SSLv3_client_method not defined!" << endl;
909 SSL_METHOD *KOpenSSLProxy::TLS_client_method() {
910 if (K_TLS_client_method)
return (K_TLS_client_method)();
911 kdWarning() <<
"TLS_client_method not defined!" << endl;
916 X509 *KOpenSSLProxy::SSL_get_peer_certificate(SSL *s) {
917 if (K_SSL_get_peer_certificate)
return (K_SSL_get_peer_certificate)(s);
918 kdWarning() <<
"SSL_get_peer_certificate not defined!" << endl;
923 int KOpenSSLProxy::SSL_CIPHER_get_bits(SSL_CIPHER *c,
int *alg_bits) {
924 if (K_SSL_CIPHER_get_bits)
return (K_SSL_CIPHER_get_bits)(c, alg_bits);
925 kdWarning() <<
"SSL_CIPHER_get_bits not defined!" << endl;
930 char * KOpenSSLProxy::SSL_CIPHER_get_version(SSL_CIPHER *c) {
931 if (K_SSL_CIPHER_get_version)
return (K_SSL_CIPHER_get_version)(c);
932 kdWarning() <<
"SSL_CIPHER_get_version not defined!" << endl;
937 const char * KOpenSSLProxy::SSL_CIPHER_get_name(SSL_CIPHER *c) {
938 if (K_SSL_CIPHER_get_name)
return (K_SSL_CIPHER_get_name)(c);
939 kdWarning() <<
"SSL_CIPHER_get_name not defined!" << endl;
944 char * KOpenSSLProxy::SSL_CIPHER_description(SSL_CIPHER *c,
char *buf,
int size) {
945 if (K_SSL_CIPHER_description)
return (K_SSL_CIPHER_description)(c,buf,size);
946 kdWarning() <<
"SSL_CIPHER_description not defined!" << endl;
951 X509 * KOpenSSLProxy::d2i_X509(X509 **a,
unsigned char **pp,
long length) {
952 if (K_d2i_X509)
return (K_d2i_X509)(a,pp,length);
953 kdWarning() <<
"d2i_X509 not defined!" << endl;
958 X509_CRL * KOpenSSLProxy::d2i_X509_CRL(X509_CRL **a,
unsigned char **pp,
long length) {
959 if (K_d2i_X509_CRL)
return (K_d2i_X509_CRL)(a,pp,length);
960 kdWarning() <<
"d2i_X509_CRL not defined!" << endl;
965 int KOpenSSLProxy::i2d_X509(X509 *a,
unsigned char **pp) {
966 if (K_i2d_X509)
return (K_i2d_X509)(a,pp);
967 kdWarning() <<
"i2d_X509 not defined!" << endl;
972 int KOpenSSLProxy::X509_cmp(X509 *a, X509 *b) {
973 if (K_X509_cmp)
return (K_X509_cmp)(a,b);
974 kdWarning() <<
"X509_cmp not defined!" << endl;
979 int KOpenSSLProxy::X509_subject_name_cmp(
const X509 *a,
const X509 *b) {
980 if (K_X509_subject_name_cmp)
return (K_X509_subject_name_cmp)(a, b);
981 kdWarning() <<
"X509_subject_name_cmp not defined!" << endl;
986 X509_STORE *KOpenSSLProxy::X509_STORE_new(
void) {
987 if (K_X509_STORE_new)
return (K_X509_STORE_new)();
988 kdWarning() <<
"X509_STORE_new not defined!" << endl;
993 void KOpenSSLProxy::X509_STORE_free(X509_STORE *v) {
994 if (K_X509_STORE_free) (K_X509_STORE_free)(v);
995 else kdWarning() <<
"X509_STORE_free not defined!" << endl;
999 X509_STORE_CTX *KOpenSSLProxy::X509_STORE_CTX_new(
void) {
1000 if (K_X509_STORE_CTX_new)
return (K_X509_STORE_CTX_new)();
1001 kdWarning() <<
"X509_STORE_CTX_new not defined!" << endl;
1006 void KOpenSSLProxy::X509_STORE_CTX_free(X509_STORE_CTX *ctx) {
1007 if (K_X509_STORE_CTX_free) (K_X509_STORE_CTX_free)(ctx);
1008 else kdWarning() <<
"X509_STORE_CTX_free not defined!" << endl;
1012 int KOpenSSLProxy::X509_verify_cert(X509_STORE_CTX *ctx) {
1013 if (K_X509_verify_cert)
return (K_X509_verify_cert)(ctx);
1014 kdWarning() <<
"X509_verify_cert not defined!" << endl;
1019 void KOpenSSLProxy::X509_free(X509 *a) {
1020 if (K_X509_free) (K_X509_free)(a);
1021 else kdWarning() <<
"X509_free not defined!" << endl;
1025 void KOpenSSLProxy::X509_CRL_free(X509_CRL *a) {
1026 if (K_X509_CRL_free) (K_X509_CRL_free)(a);
1027 else kdWarning() <<
"X509_CRL_free not defined!" << endl;
1031 char *KOpenSSLProxy::X509_NAME_oneline(X509_NAME *a,
char *buf,
int size) {
1032 if (K_X509_NAME_oneline)
return (K_X509_NAME_oneline)(a,buf,size);
1033 kdWarning() <<
"X509_NAME_online not defined!" << endl;
1038 X509_NAME *KOpenSSLProxy::X509_get_subject_name(X509 *a) {
1039 if (K_X509_get_subject_name)
return (K_X509_get_subject_name)(a);
1040 kdWarning() <<
"X509_get_subject not defined!" << endl;
1045 X509_NAME *KOpenSSLProxy::X509_get_issuer_name(X509 *a) {
1046 if (K_X509_get_issuer_name)
return (K_X509_get_issuer_name)(a);
1047 kdWarning() <<
"X509_get_issuer not defined!" << endl;
1052 X509_LOOKUP *KOpenSSLProxy::X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) {
1053 if (K_X509_STORE_add_lookup)
return (K_X509_STORE_add_lookup)(v,m);
1054 kdWarning() <<
"X509_STORE_add_lookup not defined!" << endl;
1059 X509_LOOKUP_METHOD *KOpenSSLProxy::X509_LOOKUP_file(
void) {
1060 if (K_X509_LOOKUP_file)
return (K_X509_LOOKUP_file)();
1061 kdWarning() <<
"X509_LOOKUP_file not defined!" << endl;
1066 void KOpenSSLProxy::X509_LOOKUP_free(X509_LOOKUP *x) {
1067 if (K_X509_LOOKUP_free) (K_X509_LOOKUP_free)(x);
1068 else kdWarning() <<
"X509_LOOKUP_free not defined!" << endl;
1072 int KOpenSSLProxy::X509_LOOKUP_ctrl(X509_LOOKUP *ctx,
int cmd,
const char *argc,
long argl,
char **ret) {
1073 if (K_X509_LOOKUP_ctrl)
return (K_X509_LOOKUP_ctrl)(ctx,cmd,argc,argl,ret);
1074 kdWarning() <<
"X509_LOOKUP_ctrl not defined!" << endl;
1079 void KOpenSSLProxy::X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, STACK_OF(X509) *chain) {
1080 if (K_X509_STORE_CTX_init) (K_X509_STORE_CTX_init)(ctx,store,x509,chain);
1081 else kdWarning() <<
"X509_STORE_CTX_init not defined!" << endl;
1085 void KOpenSSLProxy::CRYPTO_free(
void *x) {
1086 if (K_CRYPTO_free) (K_CRYPTO_free)(x);
1087 else kdWarning() <<
"CRYPTO_free not defined!" << endl;
1091 X509 *KOpenSSLProxy::X509_dup(X509 *x509) {
1092 if (K_X509_dup)
return (K_X509_dup)(x509);
1093 kdWarning() <<
"X509_dup not defined!" << endl;
1098 void KOpenSSLProxy::X509_get0_signature(
const ASN1_BIT_STRING **psig,
1099 const X509_ALGOR **palg,
const X509 *x) {
1100 if (K_X509_get0_signature) {
1101 (X509_get0_signature)(psig, palg, x);
1104 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1106 if (psig) *psig = x->signature;
1107 if (palg) *palg = x->sig_alg;
1110 kdWarning() <<
"X509_get0_signature not defined!" << endl;
1114 BIO *KOpenSSLProxy::BIO_new(BIO_METHOD *type) {
1115 if (K_BIO_new)
return (K_BIO_new)(type);
1116 kdWarning() <<
"BIO_new not defined!" << endl;
1121 BIO_METHOD *KOpenSSLProxy::BIO_s_mem(
void) {
1122 if (K_BIO_s_mem)
return (K_BIO_s_mem)();
1123 kdWarning() <<
"BIO_s_mem not defined!" << endl;
1128 BIO *KOpenSSLProxy::BIO_new_fp(FILE *stream,
int close_flag) {
1129 if (K_BIO_new_fp)
return (K_BIO_new_fp)(stream, close_flag);
1130 kdWarning() <<
"BIO_new_fp not defined!" << endl;
1135 BIO *KOpenSSLProxy::BIO_new_mem_buf(
void *buf,
int len) {
1136 if (K_BIO_new_mem_buf)
return (K_BIO_new_mem_buf)(buf,len);
1137 kdWarning() <<
"BIO_new_mem_buf not defined!" << endl;
1142 int KOpenSSLProxy::BIO_free(BIO *a) {
1143 if (K_BIO_free)
return (K_BIO_free)(a);
1144 kdWarning() <<
"BIO_free not defined!" << endl;
1149 long KOpenSSLProxy::BIO_ctrl(BIO *bp,
int cmd,
long larg,
void *parg) {
1150 if (K_BIO_ctrl)
return (K_BIO_ctrl)(bp,cmd,larg,parg);
1151 kdWarning() <<
"BIO_ctrl not defined!" << endl;
1156 int KOpenSSLProxy::BIO_write(BIO *b,
const void *data,
int len) {
1157 if (K_BIO_write)
return (K_BIO_write)(b, data, len);
1158 kdWarning() <<
"BIO_write not defined!" << endl;
1163 void *KOpenSSLProxy::BIO_get_data(BIO *a) {
1164 if (K_BIO_get_data)
return (K_BIO_get_data)(a);
1165 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1168 kdWarning() <<
"BIO_get_data not defined!" << endl;
1173 int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) {
1174 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);
1175 kdWarning() <<
"PEM_write_bio_X509 not defined!" << endl;
1179 #if OPENSSL_VERSION_NUMBER >= 0x10000000L 1180 int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,
unsigned char *x) {
1181 if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
1182 return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
1183 kdWarning() <<
"ANS1_i2d_fp not defined!" << endl;
1187 ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(
void) {
1188 if (K_X509_asn1_meth)
return (K_X509_asn1_meth)();
1189 kdWarning() <<
"X509_ans1_meth not defined!" << endl;
1194 int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,
unsigned char *x) {
1195 if (K_ASN1_i2d_fp && K_i2d_ASN1_HEADER)
1196 return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
1197 kdWarning() <<
"ANS1_i2d_fp not defined!" << endl;
1202 int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
1203 if (K_X509_print_fp)
return (K_X509_print_fp)(fp, x);
1204 kdWarning() <<
"X509_print not defined!" << endl;
1209 PKCS12 *KOpenSSLProxy::d2i_PKCS12_fp(FILE *fp, PKCS12 **p12) {
1210 if (K_d2i_PKCS12_fp)
return (K_d2i_PKCS12_fp)(fp, p12);
1211 kdWarning() <<
"d2i_PKCS12_fp not defined!" << endl;
1216 int KOpenSSLProxy::PKCS12_newpass(PKCS12 *p12,
char *oldpass,
char *newpass) {
1217 if (K_PKCS12_newpass)
return (K_PKCS12_newpass)(p12, oldpass, newpass);
1218 kdWarning() <<
"PKCS12_newpass not defined!" << endl;
1223 int KOpenSSLProxy::i2d_PKCS12(PKCS12 *p12,
unsigned char **p) {
1224 if (K_i2d_PKCS12)
return (K_i2d_PKCS12)(p12, p);
1225 kdWarning() <<
"i2d_PKCS12 not defined!" << endl;
1230 int KOpenSSLProxy::i2d_PKCS12_fp(FILE *fp, PKCS12 *p12) {
1231 if (K_i2d_PKCS12_fp)
return (K_i2d_PKCS12_fp)(fp, p12);
1232 kdWarning() <<
"i2d_PKCS12_fp not defined!" << endl;
1237 PKCS12 *KOpenSSLProxy::PKCS12_new(
void) {
1238 if (K_PKCS12_new)
return (K_PKCS12_new)();
1239 kdWarning() <<
"PKCS12_new not defined!" << endl;
1244 void KOpenSSLProxy::PKCS12_free(PKCS12 *a) {
1245 if (K_PKCS12_free) (K_PKCS12_free)(a);
1246 else kdWarning() <<
"PKCS12_free not defined!" << endl;
1250 int KOpenSSLProxy::PKCS12_parse(PKCS12 *p12,
const char *pass, EVP_PKEY **pkey,
1251 X509 **cert, STACK_OF(X509) **ca) {
1252 if (K_PKCS12_parse)
return (K_PKCS12_parse) (p12, pass, pkey, cert, ca);
1253 kdWarning() <<
"PKCS12_parse not defined!" << endl;
1258 void KOpenSSLProxy::EVP_PKEY_free(EVP_PKEY *x) {
1259 if (K_EVP_PKEY_free) (K_EVP_PKEY_free)(x);
1260 else kdWarning() <<
"EVP_PKEY_free not defined!" << endl;
1264 EVP_PKEY* KOpenSSLProxy::EVP_PKEY_new() {
1265 if (K_EVP_PKEY_new)
return (K_EVP_PKEY_new)();
1266 kdWarning() <<
"EVP_PKEY_new not defined!" << endl;
1271 int KOpenSSLProxy::EVP_PKEY_base_id(
const EVP_PKEY *pkey) {
1272 if (K_EVP_PKEY_base_id)
return (K_EVP_PKEY_base_id)(pkey);
1273 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1276 kdWarning() <<
"EVP_PKEY_base_id not defined!" << endl;
1281 RSA* KOpenSSLProxy::EVP_PKEY_get0_RSA(EVP_PKEY *pkey) {
1282 if (K_EVP_PKEY_get0_RSA)
return (K_EVP_PKEY_get0_RSA)(pkey);
1283 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1284 return pkey->pkey.rsa;
1286 kdWarning() <<
"EVP_PKEY_get0_RSA not defined!" << endl;
1291 DSA* KOpenSSLProxy::EVP_PKEY_get0_DSA(EVP_PKEY *pkey) {
1292 if (K_EVP_PKEY_get0_DSA)
return (K_EVP_PKEY_get0_DSA)(pkey);
1293 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1294 return pkey->pkey.dsa;
1296 kdWarning() <<
"EVP_PKEY_get0_DSA not defined!" << endl;
1301 void KOpenSSLProxy::X509_REQ_free(X509_REQ *x) {
1302 if (K_X509_REQ_free) (K_X509_REQ_free)(x);
1303 else kdWarning() <<
"X509_REQ_free not defined!" << endl;
1307 X509_REQ* KOpenSSLProxy::X509_REQ_new() {
1308 if (K_X509_REQ_new)
return (K_X509_REQ_new)();
1309 kdWarning() <<
"X509_REQ_new not defined!" << endl;
1314 int KOpenSSLProxy::SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey) {
1315 if (K_SSL_CTX_use_PrivateKey)
return (K_SSL_CTX_use_PrivateKey)(ctx,pkey);
1316 kdWarning() <<
"SSL_CTX_use_PrivateKey not defined!" << endl;
1321 int KOpenSSLProxy::SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) {
1322 if (K_SSL_CTX_use_certificate)
return (K_SSL_CTX_use_certificate)(ctx,x);
1323 kdWarning() <<
"SSL_CTX_use_certificate not defined!" << endl;
1328 int KOpenSSLProxy::SSL_get_error(SSL *ssl,
int rc) {
1329 if (K_SSL_get_error)
return (K_SSL_get_error)(ssl,rc);
1330 kdWarning() <<
"SSL_get_error not defined!" << endl;
1335 STACK_OF(X509) *KOpenSSLProxy::SSL_get_peer_cert_chain(SSL *s) {
1336 if (K_SSL_get_peer_cert_chain)
return (K_SSL_get_peer_cert_chain)(s);
1337 kdWarning() <<
"SSL_get_peer_cert_chain not defined!" << endl;
1342 void KOpenSSLProxy::OPENSSL_sk_free(STACK *s) {
1343 if (K_sk_free) (K_sk_free)(s);
1344 else kdWarning() <<
"OPENSSL_sk_free not defined!" << endl;
1348 int KOpenSSLProxy::OPENSSL_sk_num(STACK *s) {
1349 if (K_sk_num)
return (K_sk_num)(s);
1350 kdWarning() <<
"OPENSSL_sk_num not defined!" << endl;
1355 char *KOpenSSLProxy::OPENSSL_sk_pop(STACK *s) {
1356 if (K_sk_pop)
return (K_sk_pop)(s);
1357 kdWarning() <<
"OPENSSL_sk_pop not defined!" << endl;
1362 char *KOpenSSLProxy::OPENSSL_sk_value(STACK *s,
int n) {
1363 if (K_sk_value)
return (K_sk_value)(s, n);
1364 kdWarning() <<
"OPENSSL_sk_value not defined!" << endl;
1369 void KOpenSSLProxy::X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *v, STACK_OF(X509)* x) {
1370 if (K_X509_STORE_CTX_set0_untrusted) (K_X509_STORE_CTX_set0_untrusted)(v,x);
1371 else kdWarning() <<
"X509_STORE_CTX_set0_untrusted not defined!" << endl;
1374 void KOpenSSLProxy::X509_STORE_CTX_set_purpose(X509_STORE_CTX *v,
int purpose) {
1375 if (K_X509_STORE_CTX_set_purpose) (K_X509_STORE_CTX_set_purpose)(v,purpose);
1376 else kdWarning() <<
"X509_STORE_CTX_set_purpose not defined!" << endl;
1380 STACK* KOpenSSLProxy::OPENSSL_sk_dup(
const STACK *s) {
1381 if (K_sk_dup)
return (K_sk_dup)(s);
1382 kdWarning() <<
"OPENSSL_sk_dup not defined!" << endl;
1387 STACK* KOpenSSLProxy::OPENSSL_sk_new(
int (*cmp)()) {
1388 if (K_sk_new)
return (K_sk_new)(cmp);
1389 kdWarning() <<
"OPENSSL_sk_new not defined!" << endl;
1394 int KOpenSSLProxy::OPENSSL_sk_push(STACK* s,
char* d) {
1395 if (K_sk_push)
return (K_sk_push)(s,d);
1396 kdWarning() <<
"OPENSSL_sk_push not defined!" << endl;
1401 char *KOpenSSLProxy::i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint) {
1402 if (K_i2s_ASN1_INTEGER)
return (K_i2s_ASN1_INTEGER)(meth, aint);
1403 kdWarning() <<
"i2s_ANS1_INTEGER not defined!" << endl;
1408 ASN1_INTEGER *KOpenSSLProxy::X509_get_serialNumber(X509 *x) {
1409 if (K_X509_get_serialNumber)
return (K_X509_get_serialNumber)(x);
1410 kdWarning() <<
"X509_get_serialNumber not defined!" << endl;
1415 EVP_PKEY *KOpenSSLProxy::X509_get_pubkey(X509 *x) {
1416 if (K_X509_get_pubkey)
return (K_X509_get_pubkey)(x);
1417 kdWarning() <<
"X59_get_pubkey not defined!" << endl;
1422 int KOpenSSLProxy::i2d_PublicKey(EVP_PKEY *a,
unsigned char **pp) {
1423 if (K_i2d_PublicKey)
return (K_i2d_PublicKey)(a,pp);
1424 kdWarning() <<
"i2d_PublicKey not defined!" << endl;
1429 int KOpenSSLProxy::X509_check_private_key(X509 *x, EVP_PKEY *p) {
1430 if (K_X509_check_private_key)
return (K_X509_check_private_key)(x,p);
1431 kdWarning() <<
"X509_check_private_key not defined!" << endl;
1436 char *KOpenSSLProxy::BN_bn2hex(
const BIGNUM *a) {
1437 if (K_BN_bn2hex)
return (K_BN_bn2hex)(a);
1438 kdWarning() <<
"BN_bn2hex not defined!" << endl;
1443 int KOpenSSLProxy::X509_digest(
const X509 *x,
const EVP_MD *t,
unsigned char *md,
unsigned int *len) {
1444 if (K_X509_digest)
return (K_X509_digest)(x, t, md, len);
1445 kdWarning() <<
"X509_digest not defined!" << endl;
1450 EVP_MD *KOpenSSLProxy::EVP_md5() {
1451 if (K_EVP_md5)
return (K_EVP_md5)();
1452 kdWarning() <<
"EVP_md5 not defined!" << endl;
1457 void KOpenSSLProxy::ASN1_INTEGER_free(ASN1_INTEGER *a) {
1458 if (K_ASN1_INTEGER_free) (K_ASN1_INTEGER_free)(a);
1459 else kdWarning() <<
"ANS1_INTEGER_free not defined!" << endl;
1463 int KOpenSSLProxy::OBJ_obj2nid(ASN1_OBJECT *o) {
1464 if (K_OBJ_obj2nid)
return (K_OBJ_obj2nid)(o);
1465 kdWarning() <<
"OBJ_obj2nid not defined!" << endl;
1470 const char * KOpenSSLProxy::OBJ_nid2ln(
int n) {
1471 if (K_OBJ_nid2ln)
return (K_OBJ_nid2ln)(n);
1472 kdWarning() <<
"OBJ_nid2ln not defined!" << endl;
1477 int KOpenSSLProxy::X509_get_ext_count(X509 *x) {
1478 if (K_X509_get_ext_count)
return (K_X509_get_ext_count)(x);
1479 kdWarning() <<
"X509_get_ext_count not defined!" << endl;
1484 int KOpenSSLProxy::X509_get_ext_by_NID(X509 *x,
int nid,
int lastpos) {
1485 if (K_X509_get_ext_by_NID)
return (K_X509_get_ext_by_NID)(x,nid,lastpos);
1486 kdWarning() <<
"X509_get_ext_by_NID not defined!" << endl;
1491 int KOpenSSLProxy::X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,
int lastpos) {
1492 if (K_X509_get_ext_by_OBJ)
return (K_X509_get_ext_by_OBJ)(x,obj,lastpos);
1493 kdWarning() <<
"X509_get_ext_by_OBJ not defined!" << endl;
1498 X509_EXTENSION *KOpenSSLProxy::X509_get_ext(X509 *x,
int loc) {
1499 if (K_X509_get_ext)
return (K_X509_get_ext)(x,loc);
1500 kdWarning() <<
"X509_get_ext not defined!" << endl;
1505 X509_EXTENSION *KOpenSSLProxy::X509_delete_ext(X509 *x,
int loc) {
1506 if (K_X509_delete_ext)
return (K_X509_delete_ext)(x,loc);
1507 kdWarning() <<
"X509_delete_ext not defined!" << endl;
1512 int KOpenSSLProxy::X509_add_ext(X509 *x, X509_EXTENSION *ex,
int loc) {
1513 if (K_X509_add_ext)
return (K_X509_add_ext)(x,ex,loc);
1514 kdWarning() <<
"X509_add_ext not defined!" << endl;
1519 void *KOpenSSLProxy::X509_get_ext_d2i(X509 *x,
int nid,
int *crit,
int *idx) {
1520 if (K_X509_get_ext_d2i)
return (K_X509_get_ext_d2i)(x,nid,crit,idx);
1521 kdWarning() <<
"X509_get_ext_d2i not defined!" << endl;
1526 char *KOpenSSLProxy::i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5) {
1527 if (K_i2s_ASN1_OCTET_STRING)
return (K_i2s_ASN1_OCTET_STRING)(method,ia5);
1528 kdWarning() <<
"i2s_ANS1_OCTET_STRING not defined!" << endl;
1533 int KOpenSSLProxy::ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a,
int n) {
1534 if (K_ASN1_BIT_STRING_get_bit)
return (K_ASN1_BIT_STRING_get_bit)(a,n);
1535 kdWarning() <<
"ANS1_BIT_STRING_get_bit not defined!" << endl;
1540 PKCS7 *KOpenSSLProxy::PKCS7_new(
void) {
1541 if (K_PKCS7_new)
return (K_PKCS7_new)();
1542 kdWarning() <<
"PKCS7_new not defined!" << endl;
1547 void KOpenSSLProxy::PKCS7_free(PKCS7 *a) {
1548 if (K_PKCS7_free) (K_PKCS7_free)(a);
1549 else kdWarning() <<
"PKCS7_free not defined!" << endl;
1553 void KOpenSSLProxy::PKCS7_content_free(PKCS7 *a) {
1554 if (K_PKCS7_content_free) (K_PKCS7_content_free)(a);
1555 else kdWarning() <<
"PKCS7_content_free not defined!" << endl;
1559 int KOpenSSLProxy::i2d_PKCS7(PKCS7 *a,
unsigned char **pp) {
1560 if (K_i2d_PKCS7)
return (K_i2d_PKCS7)(a,pp);
1561 kdWarning() <<
"i2d_PKCS7 not defined!" << endl;
1566 PKCS7 *KOpenSSLProxy::d2i_PKCS7(PKCS7 **a,
unsigned char **pp,
long length) {
1567 if (K_d2i_PKCS7)
return (K_d2i_PKCS7)(a,pp,length);
1568 kdWarning() <<
"d2i_PKCS7 not defined!" << endl;
1573 int KOpenSSLProxy::i2d_PKCS7_fp(FILE *fp,PKCS7 *p7) {
1574 if (K_i2d_PKCS7_fp)
return (K_i2d_PKCS7_fp)(fp,p7);
1575 kdWarning() <<
"i2d_PKCS7_fd not defined!" << endl;
1580 PKCS7 *KOpenSSLProxy::d2i_PKCS7_fp(FILE *fp,PKCS7 **p7) {
1581 if (K_d2i_PKCS7_fp)
return (K_d2i_PKCS7_fp)(fp,p7);
1582 kdWarning() <<
"d2i_PKCS7_fp not defined!" << endl;
1587 int KOpenSSLProxy::i2d_PKCS7_bio(BIO *bp,PKCS7 *p7) {
1588 if (K_i2d_PKCS7_bio)
return (K_i2d_PKCS7_bio)(bp, p7);
1589 kdWarning() <<
"i2d_PKCS7_bio not defined!" << endl;
1594 PKCS7 *KOpenSSLProxy::d2i_PKCS7_bio(BIO *bp,PKCS7 **p7) {
1595 if (K_d2i_PKCS7_bio)
return (K_d2i_PKCS7_bio)(bp, p7);
1596 kdWarning() <<
"d2i_PKCS7_bio not defined!" << endl;
1601 PKCS7 *KOpenSSLProxy::PKCS7_dup(PKCS7 *p7) {
1602 if (K_PKCS7_dup)
return (K_PKCS7_dup)(p7);
1603 kdWarning() <<
"PKCS7_dup not defined!" << endl;
1608 PKCS7 *KOpenSSLProxy::PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
1609 BIO *data,
int flags) {
1610 if (K_PKCS7_sign)
return (K_PKCS7_sign)(signcert,pkey,certs,data,flags);
1611 kdWarning() <<
"PKCS7_sign not defined!" << endl;
1616 int KOpenSSLProxy::PKCS7_verify(PKCS7* p, STACK_OF(X509)* st, X509_STORE* s, BIO* in, BIO *out,
int flags) {
1617 if (K_PKCS7_verify)
return (K_PKCS7_verify)(p,st,s,in,out,flags);
1618 kdWarning() <<
"PKCS7_verify not defined!" << endl;
1623 STACK_OF(X509) *KOpenSSLProxy::PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs,
int flags) {
1624 if (K_PKCS7_get0_signers)
return (K_PKCS7_get0_signers)(p7,certs,flags);
1625 kdWarning() <<
"PKCS7_get0_signers not defined!" << endl;
1630 PKCS7 *KOpenSSLProxy::PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
1632 if (K_PKCS7_encrypt)
return (K_PKCS7_encrypt)(certs,in,cipher,flags);
1633 kdWarning() <<
"PKCS7_encrypt not defined!" << endl;
1638 int KOpenSSLProxy::PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
int flags) {
1639 if (K_PKCS7_decrypt)
return (K_PKCS7_decrypt)(p7,pkey,cert,data,flags);
1640 kdWarning() <<
"PKCS7_decrypt not defined!" << endl;
1645 STACK_OF(X509_NAME) *KOpenSSLProxy::SSL_load_client_CA_file(
const char *file) {
1646 if (K_SSL_load_client_CA_file)
return (K_SSL_load_client_CA_file)(file);
1647 kdWarning() <<
"SSL_load_client_CA_file not defined!" << endl;
1652 STACK_OF(X509_INFO) *KOpenSSLProxy::PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
void *u) {
1653 if (K_PEM_X509_INFO_read)
return (K_PEM_X509_INFO_read)(fp,sk,cb,u);
1654 kdWarning() <<
"PEM_X509_INFO_read not defined!" << endl;
1659 X509 *KOpenSSLProxy::X509_d2i_fp(FILE *out, X509** buf) {
1660 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)));
1661 kdWarning() <<
"X509_d2i_fp not defined!" << endl;
1666 int KOpenSSLProxy::SSL_peek(SSL *ssl,
void *buf,
int num) {
1667 if (K_SSL_peek)
return (K_SSL_peek)(ssl,buf,num);
1668 kdWarning() <<
"SSL_peek not defined!" << endl;
1673 const char *KOpenSSLProxy::RAND_file_name(
char *buf,
size_t num) {
1674 if (K_RAND_file_name)
return (K_RAND_file_name)(buf, num);
1675 kdWarning() <<
"RAND_file_name not defined!" << endl;
1680 int KOpenSSLProxy::RAND_load_file(
const char *filename,
long max_bytes) {
1681 if (K_RAND_load_file)
return (K_RAND_load_file)(filename, max_bytes);
1682 kdWarning() <<
"REND_load_file not defined!" << endl;
1687 int KOpenSSLProxy::RAND_write_file(
const char *filename) {
1688 if (K_RAND_write_file)
return (K_RAND_write_file)(filename);
1689 kdWarning() <<
"RAND_write_file not defined!" << endl;
1694 int KOpenSSLProxy::X509_PURPOSE_get_count() {
1695 if (K_X509_PURPOSE_get_count)
return (K_X509_PURPOSE_get_count)();
1696 kdWarning() <<
"X509_PURPOSE_get_count not defined!" << endl;
1701 int KOpenSSLProxy::X509_PURPOSE_get_id(X509_PURPOSE *p) {
1702 if (K_X509_PURPOSE_get_id)
return (K_X509_PURPOSE_get_id)(p);
1703 kdWarning() <<
"X509_PURPOSE_get_id not defined!" << endl;
1708 int KOpenSSLProxy::X509_check_purpose(X509 *x,
int id,
int ca) {
1709 if (K_X509_check_purpose)
return (K_X509_check_purpose)(x, id, ca);
1710 kdWarning() <<
"X509_check_purpose not defined!" << endl;
1715 X509_PURPOSE *KOpenSSLProxy::X509_PURPOSE_get0(
int idx) {
1716 if (K_X509_PURPOSE_get0)
return (K_X509_PURPOSE_get0)(idx);
1717 kdWarning() <<
"X509_PURPOSE_get0 not defined!" << endl;
1722 int KOpenSSLProxy::EVP_PKEY_assign(EVP_PKEY *pkey,
int type,
char *key) {
1723 if (K_EVP_PKEY_assign)
return (K_EVP_PKEY_assign)(pkey, type, key);
1724 kdWarning() <<
"EVP_PKEY_assign not defined!" << endl;
1729 int KOpenSSLProxy::X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) {
1730 if (K_X509_REQ_set_pubkey)
return (K_X509_REQ_set_pubkey)(x, pkey);
1731 kdWarning() <<
"X509_REQ_set_pubkey not defined!" << endl;
1736 void KOpenSSLProxy::RSA_get0_key(
const RSA *r,
1737 const BIGNUM **n,
const BIGNUM **e,
const BIGNUM **d) {
1738 if (K_RSA_get0_key) {
1739 (K_RSA_get0_key)(r, n, e, d);
1742 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1749 kdWarning() <<
"REG_get0_key not defined!" << endl;
1753 RSA* KOpenSSLProxy::RSA_generate_key(
int bits,
unsigned long e,
void 1754 (*callback)(
int,
int,
void *),
void *cb_arg) {
1755 if (K_RSA_generate_key)
return (K_RSA_generate_key)(bits, e, callback, cb_arg);
1756 kdWarning() <<
"RSA_generate_key not defined!" << endl;
1761 void KOpenSSLProxy::DSA_get0_pqg(
const DSA *d,
1762 const BIGNUM **p,
const BIGNUM **q,
const BIGNUM **g) {
1763 if (K_DSA_get0_pqg) {
1764 (K_DSA_get0_pqg)(d, p, q, g);
1767 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1774 kdWarning() <<
"DSA_get0_pqg not defined!" << endl;
1778 void KOpenSSLProxy::DSA_get0_key(
const DSA *d,
1779 const BIGNUM **pub_key,
const BIGNUM **priv_key) {
1780 if (K_DSA_get0_key) {
1781 (K_DSA_get0_key)(d, pub_key, priv_key);
1784 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1786 if (pub_key) *pub_key = d->pub_key;
1787 if (priv_key) *priv_key = d->priv_key;
1790 kdWarning() <<
"DSA_get0_key not defined!" << endl;
1794 STACK *KOpenSSLProxy::X509_get1_email(X509 *x) {
1795 if (K_X509_get1_email)
return (K_X509_get1_email)(x);
1796 kdWarning() <<
"X509_get1_email not defined!" << endl;
1800 void KOpenSSLProxy::X509_email_free(STACK *sk) {
1801 if (K_X509_email_free) (K_X509_email_free)(sk);
1802 else kdWarning() <<
"X509_email_free not defined!" << endl;
1805 EVP_CIPHER *KOpenSSLProxy::EVP_des_ede3_cbc() {
1806 if (K_EVP_des_ede3_cbc)
return (K_EVP_des_ede3_cbc)();
1807 kdWarning() <<
"EVM_des_ede3_cbc not defined!" << endl;
1811 EVP_CIPHER *KOpenSSLProxy::EVP_des_cbc() {
1812 if (K_EVP_des_cbc)
return (K_EVP_des_cbc)();
1813 kdWarning() <<
"EVP_des_cbc not defined!" << endl;
1817 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_cbc() {
1818 if (K_EVP_rc2_cbc)
return (K_EVP_rc2_cbc)();
1819 kdWarning() <<
"EVP_rc2_cbc not defined!" << endl;
1823 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_64_cbc() {
1824 if (K_EVP_rc2_64_cbc)
return (K_EVP_rc2_64_cbc)();
1825 kdWarning() <<
"EVP_rc2_64_cbc not defined!" << endl;
1829 EVP_CIPHER *KOpenSSLProxy::EVP_rc2_40_cbc() {
1830 if (K_EVP_rc2_40_cbc)
return (K_EVP_rc2_40_cbc)();
1831 kdWarning() <<
"EVP_rc2_40_cbc not defined!" << endl;
1835 int KOpenSSLProxy::i2d_X509_REQ_fp(FILE *fp, X509_REQ *x) {
1836 if (K_i2d_X509_REQ_fp)
return (K_i2d_X509_REQ_fp)(fp,x);
1837 kdWarning() <<
"i2d_X509_REQ_fp not defined!" << endl;
1842 void KOpenSSLProxy::ERR_clear_error() {
1843 if (K_ERR_clear_error) (K_ERR_clear_error)();
1844 else kdWarning() <<
"ERR_clear_error not defined!" << endl;
1848 unsigned long KOpenSSLProxy::ERR_get_error() {
1849 if (K_ERR_get_error)
return (K_ERR_get_error)();
1850 kdWarning() <<
"ERR_get_error not defined!" << endl;
1855 void KOpenSSLProxy::ERR_print_errors_fp(FILE* fp) {
1856 if (K_ERR_print_errors_fp) (K_ERR_print_errors_fp)(fp);
1857 else kdWarning() <<
"ERR_print_errors_fp not defined!" << endl;
1861 SSL_SESSION *KOpenSSLProxy::SSL_get1_session(SSL *ssl) {
1862 if (K_SSL_get1_session)
return (K_SSL_get1_session)(ssl);
1863 kdWarning() <<
"SSL_get1_session not defined!" << endl;
1868 void KOpenSSLProxy::SSL_SESSION_free(SSL_SESSION *session) {
1869 if (K_SSL_SESSION_free) (K_SSL_SESSION_free)(session);
1870 else kdWarning() <<
"SSL_SESSION_free not defined!" << endl;
1874 int KOpenSSLProxy::SSL_set_session(SSL *ssl, SSL_SESSION *session) {
1875 if (K_SSL_set_session)
return (K_SSL_set_session)(ssl, session);
1876 kdWarning() <<
"SSL_set_session not defined!" << endl;
1881 SSL_SESSION *KOpenSSLProxy::d2i_SSL_SESSION(SSL_SESSION **a,
unsigned char **pp,
long length) {
1882 if (K_d2i_SSL_SESSION)
return (K_d2i_SSL_SESSION)(a, pp, length);
1883 kdWarning() <<
"d2i_SSL_SESSION not defined!" << endl;
1888 int KOpenSSLProxy::i2d_SSL_SESSION(SSL_SESSION *in,
unsigned char **pp) {
1889 if (K_i2d_SSL_SESSION)
return (K_i2d_SSL_SESSION)(in, pp);
1890 kdWarning() <<
"i2d_SSL_SESSION not defined!" << endl;
1895 int KOpenSSLProxy::i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *p) {
1896 if (K_i2d_PrivateKey_fp)
return (K_i2d_PrivateKey_fp)(fp, p);
1897 kdWarning() <<
"i2d_PrivateKey not defined!" << endl;
1902 int KOpenSSLProxy::i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *p,
const EVP_CIPHER *c,
char *k,
int klen, pem_password_cb *cb,
void *u) {
1903 if (K_i2d_PKCS8PrivateKey_fp)
return (K_i2d_PKCS8PrivateKey_fp)(fp, p, c, k, klen, cb, u);
1904 kdWarning() <<
"i2d_PKCS8PrivateKey_fp not defined!" << endl;
1909 void KOpenSSLProxy::RSA_free(RSA *rsa) {
1910 if (K_RSA_free) (K_RSA_free)(rsa);
1911 else kdWarning() <<
"RSA_free not defined!" << endl;
1915 EVP_CIPHER *KOpenSSLProxy::EVP_bf_cbc() {
1916 if (K_EVP_bf_cbc)
return (K_EVP_bf_cbc)();
1917 kdWarning() <<
"EVP_bf_cbc not defined!" << endl;
1922 int KOpenSSLProxy::X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey,
const EVP_MD *md) {
1923 if (K_X509_REQ_sign)
return (K_X509_REQ_sign)(x, pkey, md);
1924 kdWarning() <<
"X509_REQ_sign not defined!" << endl;
1929 int KOpenSSLProxy::X509_NAME_add_entry_by_txt(X509_NAME *name,
char *field,
1930 int type,
unsigned char *bytes,
int len,
int loc,
int set) {
1931 if (K_X509_NAME_add_entry_by_txt)
return (K_X509_NAME_add_entry_by_txt)(name, field, type, bytes, len, loc,
set);
1932 kdWarning() <<
"X509_NAME_add_entry not defined!" << endl;
1937 X509_NAME *KOpenSSLProxy::X509_NAME_new() {
1938 if (K_X509_NAME_new)
return (K_X509_NAME_new)();
1939 kdWarning() <<
"X509_NAME_new not defined!" << endl;
1944 int KOpenSSLProxy::X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name) {
1945 if (K_X509_REQ_set_subject_name)
return (K_X509_REQ_set_subject_name)(req, name);
1946 kdWarning() <<
"X509_REQ_set_subject_name not defined!" << endl;
1951 unsigned char *KOpenSSLProxy::ASN1_STRING_data(ASN1_STRING *x) {
1952 if (K_ASN1_STRING_data)
return (K_ASN1_STRING_data)(x);
1953 kdWarning() <<
"ASN1_STRING_data not defined!" << endl;
1957 int KOpenSSLProxy::ASN1_STRING_length(ASN1_STRING *x) {
1958 if (K_ASN1_STRING_length)
return (K_ASN1_STRING_length)(x);
1959 kdWarning() <<
"ASN1_STRING_length not defined!" << endl;
1963 STACK_OF(SSL_CIPHER) *KOpenSSLProxy::SSL_get_ciphers(
const SSL* ssl) {
1964 if (K_SSL_get_ciphers)
return (K_SSL_get_ciphers)(ssl);
1965 kdWarning() <<
"SSL_get_ciphers not defined!" << endl;
1969 const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_lastUpdate(
const X509_CRL *crl) {
1970 if (K_X509_CRL_get0_lastUpdate)
return (K_X509_CRL_get0_lastUpdate)(crl);
1971 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1972 return X509_CRL_get_lastUpdate(crl);
1974 kdWarning() <<
"X509_CRL_get_lastUpdate not defined!" << endl;
1978 const ASN1_TIME* KOpenSSLProxy::X509_CRL_get0_nextUpdate(
const X509_CRL *crl) {
1979 if (K_X509_CRL_get0_nextUpdate)
return (K_X509_CRL_get0_nextUpdate)(crl);
1980 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1981 return X509_CRL_get_nextUpdate(crl);
1983 kdWarning() <<
"X509_CRL_get_nextUpdate not defined!" << endl;
1987 X509* KOpenSSLProxy::X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) {
1988 if (K_X509_STORE_CTX_get_current_cert)
return (K_X509_STORE_CTX_get_current_cert)(ctx);
1989 #if OPENSSL_VERSION_NUMBER < 0x10100000L 1990 return ctx->current_cert;
1992 kdWarning() <<
"X509_STORE_CTX_get_current_cert not defined!" << endl;
1996 int KOpenSSLProxy::X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) {
1997 if (K_X509_STORE_CTX_get_error)
return (K_X509_STORE_CTX_get_error)(ctx);
1998 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2001 kdWarning() <<
"X509k_STORE_CTX_get_error not defined!" << endl;
2005 int KOpenSSLProxy::X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) {
2006 if (K_X509_STORE_CTX_get_error_depth)
return (K_X509_STORE_CTX_get_error_depth)(ctx);
2007 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2008 return ctx->error_depth;
2010 kdWarning() <<
"X509_STORE_CTX_get_error_depth not defined!" << endl;
2014 void KOpenSSLProxy::X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,
int s) {
2015 if (K_X509_STORE_CTX_set_error) {
2016 (K_X509_STORE_CTX_set_error)(ctx, s);
2019 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2023 kdWarning() <<
"X509_STORE_CTX_set_error not defined!" << endl;
2026 void KOpenSSLProxy::X509_STORE_set_verify_cb(X509_STORE *ctx,
2027 X509_STORE_CTX_verify_cb verify_cb) {
2028 if (K_X509_STORE_set_verify_cb) {
2029 (K_X509_STORE_set_verify_cb)(ctx, verify_cb);
2032 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2033 X509_STORE_set_verify_cb_func(ctx, verify_cb);
2036 kdWarning() <<
"X590_STORE_set_verify_cb not defined!" << endl;
2039 STACK_OF(X509_OBJECT)* KOpenSSLProxy::X509_STORE_get0_objects(X509_STORE *v) {
2040 if (K_X509_STORE_get0_objects)
return (K_X509_STORE_get0_objects)(v);
2041 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2044 kdWarning() <<
"X509_STORE_get0_objects not defined!" << endl;
2047 X509_LOOKUP_TYPE KOpenSSLProxy::X509_OBJECT_get_type(
const X509_OBJECT *a) {
2048 if (K_X509_OBJECT_get_type)
return (K_X509_OBJECT_get_type)(a);
2049 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2052 kdWarning() <<
"X509_OBJECT_get_type not defined!" << endl;
2055 X509* KOpenSSLProxy::X509_OBJECT_get0_X509(
const X509_OBJECT *a) {
2056 if (K_X509_OBJECT_get0_X509)
return (K_X509_OBJECT_get0_X509)(a);
2057 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2058 return a->data.x509;
2060 kdWarning() <<
"X509_OBJECT_get0_X509 not defined!" << endl;
2064 ASN1_TIME* KOpenSSLProxy::X509_getm_notAfter(
const X509 *x) {
2065 if (K_X509_getm_notAfter)
return (K_X509_getm_notAfter)(x);
2066 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2067 return X509_get_notAfter(x);
2069 kdWarning() <<
"X509_get_notAfter not defined!" << endl;
2073 ASN1_TIME* KOpenSSLProxy::X509_getm_notBefore(
const X509 *x) {
2074 if (K_X509_getm_notBefore)
return (K_X509_getm_notBefore)(x);
2075 #if OPENSSL_VERSION_NUMBER < 0x10100000L 2076 return X509_get_notBefore(x);
2078 kdWarning() <<
"X509_get_notBefore not defined!" << endl;
2083 STACK* KOpenSSLProxy::sk_dup(
const STACK *s) {
2084 return OPENSSL_sk_dup(s);
2087 void KOpenSSLProxy::sk_free(STACK *s) {
2091 STACK* KOpenSSLProxy::sk_new(
int (*cmp)()) {
2092 return OPENSSL_sk_new(cmp);
2095 int KOpenSSLProxy::sk_num(STACK *s) {
2096 return OPENSSL_sk_num(s);
2099 char* KOpenSSLProxy::sk_pop(STACK *s) {
2100 return OPENSSL_sk_pop(s);
2103 int KOpenSSLProxy::sk_push(STACK *s,
char *d) {
2104 return OPENSSL_sk_push(s, d);
2107 char* KOpenSSLProxy::sk_value(STACK *s,
int n) {
2108 return OPENSSL_sk_value(s, n);
2111 void KOpenSSLProxy::X509_STORE_CTX_set_chain(X509_STORE_CTX *v, STACK_OF(X509)* x) {
2112 X509_STORE_CTX_set0_untrusted(v, x);
2115 SSL_METHOD* KOpenSSLProxy::SSLv23_client_method() {
2116 return TLS_client_method();
Dynamically load and wrap OpenSSL.
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.
void destroy()
Destroy the class and start over - don't use this unless you know what you are doing.