2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 /* explicit system call and C library trace function, for those who miss strace
9 #include "xioconfig.h" /* what features are enabled */
11 #if WITH_SYCLS && WITH_OPENSSL
13 #include "sysincludes.h"
24 void sycSSL_load_error_strings(void) {
25 Debug("SSL_load_error_strings()");
26 SSL_load_error_strings();
27 Debug("SSL_load_error_strings() ->");
30 int sycSSL_library_init(void) {
32 Debug("SSL_library_init()");
33 result
= SSL_library_init();
34 Debug1("SSL_library_init() -> %d", result
);
38 #if HAVE_SSLv2_client_method
39 const SSL_METHOD
*sycSSLv2_client_method(void) {
40 const SSL_METHOD
*result
;
41 Debug("SSLv2_client_method()");
42 result
= SSLv2_client_method();
43 Debug1("SSLv2_client_method() -> %p", result
);
48 #if HAVE_SSLv2_server_method
49 const SSL_METHOD
*sycSSLv2_server_method(void) {
50 const SSL_METHOD
*result
;
51 Debug("SSLv2_server_method()");
52 result
= SSLv2_server_method();
53 Debug1("SSLv2_server_method() -> %p", result
);
58 #if HAVE_SSLv3_client_method
59 const SSL_METHOD
*sycSSLv3_client_method(void) {
60 const SSL_METHOD
*result
;
61 Debug("SSLv3_client_method()");
62 result
= SSLv3_client_method();
63 Debug1("SSLv3_client_method() -> %p", result
);
68 #if HAVE_SSLv3_server_method
69 const SSL_METHOD
*sycSSLv3_server_method(void) {
70 const SSL_METHOD
*result
;
71 Debug("SSLv3_server_method()");
72 result
= SSLv3_server_method();
73 Debug1("SSLv3_server_method() -> %p", result
);
78 const SSL_METHOD
*sycSSLv23_client_method(void) {
79 const SSL_METHOD
*result
;
80 Debug("SSLv23_client_method()");
81 result
= SSLv23_client_method();
82 Debug1("SSLv23_client_method() -> %p", result
);
86 const SSL_METHOD
*sycSSLv23_server_method(void) {
87 const SSL_METHOD
*result
;
88 Debug("SSLv23_server_method()");
89 result
= SSLv23_server_method();
90 Debug1("SSLv23_server_method() -> %p", result
);
94 #if HAVE_TLSv1_client_method
95 const SSL_METHOD
*sycTLSv1_client_method(void) {
96 const SSL_METHOD
*result
;
97 Debug("TLSv1_client_method()");
98 result
= TLSv1_client_method();
99 Debug1("TLSv1_client_method() -> %p", result
);
104 #if HAVE_TLSv1_server_method
105 const SSL_METHOD
*sycTLSv1_server_method(void) {
106 const SSL_METHOD
*result
;
107 Debug("TLSv1_server_method()");
108 result
= TLSv1_server_method();
109 Debug1("TLSv1_server_method() -> %p", result
);
114 #if HAVE_TLSv1_1_client_method
115 const SSL_METHOD
*sycTLSv1_1_client_method(void) {
116 const SSL_METHOD
*result
;
117 Debug("TLSv1_1_client_method()");
118 result
= TLSv1_1_client_method();
119 Debug1("TLSv1_1_client_method() -> %p", result
);
124 #if HAVE_TLSv1_1_server_method
125 const SSL_METHOD
*sycTLSv1_1_server_method(void) {
126 const SSL_METHOD
*result
;
127 Debug("TLSv1_1_server_method()");
128 result
= TLSv1_1_server_method();
129 Debug1("TLSv1_1_server_method() -> %p", result
);
134 #if HAVE_TLSv1_2_client_method
135 const SSL_METHOD
*sycTLSv1_2_client_method(void) {
136 const SSL_METHOD
*result
;
137 Debug("TLSv1_2_client_method()");
138 result
= TLSv1_2_client_method();
139 Debug1("TLSv1_2_client_method() -> %p", result
);
144 #if HAVE_TLSv1_2_server_method
145 const SSL_METHOD
*sycTLSv1_2_server_method(void) {
146 const SSL_METHOD
*result
;
147 Debug("TLSv1_2_server_method()");
148 result
= TLSv1_2_server_method();
149 Debug1("TLSv1_2_server_method() -> %p", result
);
154 #if HAVE_DTLSv1_client_method
155 const SSL_METHOD
*sycDTLSv1_client_method(void) {
156 const SSL_METHOD
*result
;
157 Debug("DTLSv1_client_method()");
158 result
= DTLSv1_client_method();
159 Debug1("DTLSv1_client_method() -> %p", result
);
164 #if HAVE_DTLSv1_server_method
165 const SSL_METHOD
*sycDTLSv1_server_method(void) {
166 const SSL_METHOD
*result
;
167 Debug("DTLSv1_server_method()");
168 result
= DTLSv1_server_method();
169 Debug1("DTLSv1_server_method() -> %p", result
);
174 SSL_CTX
*sycSSL_CTX_new(const SSL_METHOD
*method
) {
176 Debug1("SSL_CTX_new(%p)", method
);
177 result
= SSL_CTX_new(method
);
178 Debug1("SSL_CTX_new() -> %p", result
);
182 SSL
*sycSSL_new(SSL_CTX
*ctx
) {
184 Debug1("SSL_new(%p)", ctx
);
185 result
= SSL_new(ctx
);
186 Debug1("SSL_new() -> %p", result
);
190 int sycSSL_CTX_load_verify_locations(SSL_CTX
*ctx
, const char *CAfile
,
191 const char *CApath
) {
193 Debug7("SSL_CTX_load_verify_locations(%p, %s%s%s, %s%s%s)", ctx
,
194 CAfile
?"\"":"", CAfile
?CAfile
:"", CAfile
?"\"":"",
195 CApath
?"\"":"", CApath
?CApath
:"", CApath
?"\"":"");
196 result
= SSL_CTX_load_verify_locations(ctx
, CAfile
, CApath
);
197 Debug1("SSL_CTX_load_verify_locations() -> %d", result
);
201 int sycSSL_CTX_use_certificate_file(SSL_CTX
*ctx
, const char *file
, int type
) {
203 Debug3("SSL_CTX_use_certificate_file(%p, \"%s\", %d)", ctx
, file
, type
);
204 result
= SSL_CTX_use_certificate_file(ctx
, file
, type
);
205 Debug1("SSL_CTX_use_certificate_file() -> %d", result
);
209 int sycSSL_CTX_use_certificate_chain_file(SSL_CTX
*ctx
, const char *file
) {
211 Debug2("SSL_CTX_use_certificate_chain_file(%p, \"%s\")", ctx
, file
);
212 result
= SSL_CTX_use_certificate_chain_file(ctx
, file
);
213 Debug1("SSL_CTX_use_certificate_chain_file() -> %d", result
);
217 int sycSSL_CTX_use_PrivateKey_file(SSL_CTX
*ctx
, const char *file
, int type
) {
219 Debug3("SSL_CTX_use_PrivateKey_file(%p, \"%s\", %d)", ctx
, file
, type
);
220 result
= SSL_CTX_use_PrivateKey_file(ctx
, file
, type
);
221 Debug1("SSL_CTX_use_PrivateKey_file() -> %d", result
);
225 void sycSSL_CTX_set_verify(SSL_CTX
*ctx
, int mode
,
226 int (*verify_callback
)(int, X509_STORE_CTX
*)) {
227 Debug3("SSL_CTX_set_verify(%p, %u, %p)", ctx
, mode
, verify_callback
);
228 SSL_CTX_set_verify(ctx
, mode
, verify_callback
);
229 Debug("SSL_CTX_set_verify() -> ");
232 int sycSSL_CTX_set_cipher_list(SSL_CTX
*ctx
, const char *str
) {
234 Debug2("SSL_CTX_set_cipher_list(%p, \"%s\")", ctx
, str
);
235 result
= SSL_CTX_set_cipher_list(ctx
, str
);
236 Debug1("SSL_CTX_set_cipher_list() -> %d", result
);
240 int sycSSL_CTX_set_tmp_dh(SSL_CTX
*ctx
, DH
*dh
) {
242 Debug2("SSL_CTX_set_tmp_dh(%p, %p)", ctx
, dh
);
243 result
= SSL_CTX_set_tmp_dh(ctx
, dh
);
244 Debug1("SSL_CTX_set_tmp_dh() -> %d", result
);
248 int sycSSL_set_cipher_list(SSL
*ssl
, const char *str
) {
250 Debug2("SSL_set_cipher_list(%p, \"%s\")", ssl
, str
);
251 result
= SSL_set_cipher_list(ssl
, str
);
252 Debug1("SSL_set_cipher_list() -> %d", result
);
256 long sycSSL_get_verify_result(SSL
*ssl
) {
258 Debug1("SSL_get_verify_result(%p)", ssl
);
259 result
= SSL_get_verify_result(ssl
);
260 Debug1("SSL_get_verify_result() -> %lx", result
);
264 int sycSSL_set_fd(SSL
*ssl
, int fd
) {
266 Debug2("SSL_set_fd(%p, %d)", ssl
, fd
);
267 result
= SSL_set_fd(ssl
, fd
);
268 Debug1("SSL_set_fd() -> %d", result
);
272 int sycSSL_connect(SSL
*ssl
) {
274 Debug1("SSL_connect(%p)", ssl
);
275 result
= SSL_connect(ssl
);
276 Debug1("SSL_connect() -> %d", result
);
280 int sycSSL_accept(SSL
*ssl
) {
282 Debug1("SSL_accept(%p)", ssl
);
283 result
= SSL_accept(ssl
);
284 Debug1("SSL_accept() -> %d", result
);
288 int sycSSL_read(SSL
*ssl
, void *buf
, int num
) {
290 Debug3("SSL_read(%p, %p, %d)", ssl
, buf
, num
);
291 result
= SSL_read(ssl
, buf
, num
);
292 Debug1("SSL_read() -> %d", result
);
296 int sycSSL_pending(SSL
*ssl
) {
298 Debug1("SSL_pending(%p)", ssl
);
299 result
= SSL_pending(ssl
);
300 Debug1("SSL_pending() -> %d", result
);
304 int sycSSL_write(SSL
*ssl
, const void *buf
, int num
) {
306 Debug3("SSL_write(%p, %p, %d)", ssl
, buf
, num
);
307 result
= SSL_write(ssl
, buf
, num
);
308 Debug1("SSL_write() -> %d", result
);
312 X509
*sycSSL_get_peer_certificate(SSL
*ssl
) {
314 Debug1("SSL_get_peer_certificate(%p)", ssl
);
315 result
= SSL_get_peer_certificate(ssl
);
317 Debug1("SSL_get_peer_certificate() -> %p", result
);
319 Debug("SSL_get_peer_certificate() -> NULL");
324 int sycSSL_shutdown(SSL
*ssl
) {
326 Debug1("SSL_shutdown(%p)", ssl
);
327 result
= SSL_shutdown(ssl
);
328 Debug1("SSL_shutdown() -> %d", result
);
332 void sycSSL_CTX_free(SSL_CTX
*ctx
) {
333 Debug1("SSL_CTX_free(%p)", ctx
);
335 Debug("SSL_CTX_free() -> void");
339 void sycSSL_free(SSL
*ssl
) {
340 Debug1("SSL_free(%p)", ssl
);
342 Debug("SSL_free() -> void");
346 #if !defined(OPENSSL_NO_EGD) && HAVE_RAND_egd
347 int sycRAND_egd(const char *path
) {
349 Debug1("RAND_egd(\"%s\")", path
);
350 result
= RAND_egd(path
);
351 Debug1("RAND_egd() -> %d", result
);
356 DH
*sycPEM_read_bio_DHparams(BIO
*bp
, DH
**x
, pem_password_cb
*cb
, void *u
) {
358 Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
360 result
= PEM_read_bio_DHparams(bp
, x
, cb
, u
);
362 /*Debug2("PEM_read_bio_DHparams(, {%p},,) -> %p", *x, result);*/
363 Debug1("PEM_read_bio_DHparams() -> %p", result
);
365 Debug("PEM_read_bio_DHparams() -> NULL");
370 BIO
*sycBIO_new_file(const char *filename
, const char *mode
) {
372 Debug2("BIO_new_file(\"%s\", \"%s\")", filename
, mode
);
373 result
= BIO_new_file(filename
, mode
);
375 Debug1("BIO_new_file() -> %p", result
);
377 Debug("BIO_new_file() -> NULL");
383 int sycFIPS_mode_set(int onoff
) {
385 Debug1("FIPS_mode_set(%d)", onoff
);
386 result
= FIPS_mode_set(onoff
);
387 Debug1("FIPS_mode_set() -> %d", result
);
390 #endif /* WITH_FIPS */
392 #if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_COMP)
393 const COMP_METHOD
*sycSSL_get_current_compression(SSL
*ssl
) {
394 const COMP_METHOD
*result
;
395 Debug1("SSL_get_current_compression(%p)", ssl
);
396 result
= SSL_get_current_compression(ssl
);
398 Debug1("SSL_get_current_compression() -> %p", result
);
400 Debug("SSL_get_current_compression() -> NULL");
405 const COMP_METHOD
*sycSSL_get_current_expansion(SSL
*ssl
) {
406 const COMP_METHOD
*result
;
407 Debug1("SSL_get_current_expansion(%p)", ssl
);
408 result
= SSL_get_current_expansion(ssl
);
410 Debug1("SSL_get_current_expansion() -> %p", result
);
412 Debug("SSL_get_current_expansion() -> NULL");
417 const char *sycSSL_COMP_get_name(const COMP_METHOD
*comp
) {
419 Debug1("SSL_COMP_get_name(%p)", comp
);
420 result
= SSL_COMP_get_name(comp
);
422 Debug1("SSL_COMP_get_name() -> \"%s\"", result
);
424 Debug("SSL_COMP_get_name() -> NULL");
430 #endif /* WITH_SYCLS && WITH_OPENSSL */