2 /* Copyright Gerhard Rieger */
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 const SSL_METHOD
*sycSSLv3_client_method(void) {
59 const SSL_METHOD
*result
;
60 Debug("SSLv3_client_method()");
61 result
= SSLv3_client_method();
62 Debug1("SSLv3_client_method() -> %p", result
);
66 const SSL_METHOD
*sycSSLv3_server_method(void) {
67 const SSL_METHOD
*result
;
68 Debug("SSLv3_server_method()");
69 result
= SSLv3_server_method();
70 Debug1("SSLv3_server_method() -> %p", result
);
74 const SSL_METHOD
*sycSSLv23_client_method(void) {
75 const SSL_METHOD
*result
;
76 Debug("SSLv23_client_method()");
77 result
= SSLv23_client_method();
78 Debug1("SSLv23_client_method() -> %p", result
);
82 const SSL_METHOD
*sycSSLv23_server_method(void) {
83 const SSL_METHOD
*result
;
84 Debug("SSLv23_server_method()");
85 result
= SSLv23_server_method();
86 Debug1("SSLv23_server_method() -> %p", result
);
90 const SSL_METHOD
*sycTLSv1_client_method(void) {
91 const SSL_METHOD
*result
;
92 Debug("TLSv1_client_method()");
93 result
= TLSv1_client_method();
94 Debug1("TLSv1_client_method() -> %p", result
);
98 const SSL_METHOD
*sycTLSv1_server_method(void) {
99 const SSL_METHOD
*result
;
100 Debug("TLSv1_server_method()");
101 result
= TLSv1_server_method();
102 Debug1("TLSv1_server_method() -> %p", result
);
106 #if HAVE_TLSv1_1_client_method
107 const SSL_METHOD
*sycTLSv1_1_client_method(void) {
108 const SSL_METHOD
*result
;
109 Debug("TLSv1_1_client_method()");
110 result
= TLSv1_1_client_method();
111 Debug1("TLSv1_1_client_method() -> %p", result
);
116 #if HAVE_TLSv1_1_server_method
117 const SSL_METHOD
*sycTLSv1_1_server_method(void) {
118 const SSL_METHOD
*result
;
119 Debug("TLSv1_1_server_method()");
120 result
= TLSv1_1_server_method();
121 Debug1("TLSv1_1_server_method() -> %p", result
);
126 #if HAVE_TLSv1_2_client_method
127 const SSL_METHOD
*sycTLSv1_2_client_method(void) {
128 const SSL_METHOD
*result
;
129 Debug("TLSv1_2_client_method()");
130 result
= TLSv1_2_client_method();
131 Debug1("TLSv1_2_client_method() -> %p", result
);
136 #if HAVE_TLSv1_2_server_method
137 const SSL_METHOD
*sycTLSv1_2_server_method(void) {
138 const SSL_METHOD
*result
;
139 Debug("TLSv1_2_server_method()");
140 result
= TLSv1_2_server_method();
141 Debug1("TLSv1_2_server_method() -> %p", result
);
146 const SSL_METHOD
*sycDTLSv1_client_method(void) {
147 const SSL_METHOD
*result
;
148 Debug("DTLSv1_client_method()");
149 result
= DTLSv1_client_method();
150 Debug1("DTLSv1_client_method() -> %p", result
);
154 const SSL_METHOD
*sycDTLSv1_server_method(void) {
155 const SSL_METHOD
*result
;
156 Debug("DTLSv1_server_method()");
157 result
= DTLSv1_server_method();
158 Debug1("DTLSv1_server_method() -> %p", result
);
162 SSL_CTX
*sycSSL_CTX_new(const SSL_METHOD
*method
) {
164 Debug1("SSL_CTX_new(%p)", method
);
165 result
= SSL_CTX_new(method
);
166 Debug1("SSL_CTX_new() -> %p", result
);
170 SSL
*sycSSL_new(SSL_CTX
*ctx
) {
172 Debug1("SSL_new(%p)", ctx
);
173 result
= SSL_new(ctx
);
174 Debug1("SSL_new() -> %p", result
);
178 int sycSSL_CTX_load_verify_locations(SSL_CTX
*ctx
, const char *CAfile
,
179 const char *CApath
) {
181 Debug7("SSL_CTX_load_verify_locations(%p, %s%s%s, %s%s%s)", ctx
,
182 CAfile
?"\"":"", CAfile
?CAfile
:"", CAfile
?"\"":"",
183 CApath
?"\"":"", CApath
?CApath
:"", CApath
?"\"":"");
184 result
= SSL_CTX_load_verify_locations(ctx
, CAfile
, CApath
);
185 Debug1("SSL_CTX_load_verify_locations() -> %d", result
);
189 int sycSSL_CTX_use_certificate_file(SSL_CTX
*ctx
, const char *file
, int type
) {
191 Debug3("SSL_CTX_use_certificate_file(%p, \"%s\", %d)", ctx
, file
, type
);
192 result
= SSL_CTX_use_certificate_file(ctx
, file
, type
);
193 Debug1("SSL_CTX_use_certificate_file() -> %d", result
);
197 int sycSSL_CTX_use_certificate_chain_file(SSL_CTX
*ctx
, const char *file
) {
199 Debug2("SSL_CTX_use_certificate_chain_file(%p, \"%s\")", ctx
, file
);
200 result
= SSL_CTX_use_certificate_chain_file(ctx
, file
);
201 Debug1("SSL_CTX_use_certificate_chain_file() -> %d", result
);
205 int sycSSL_CTX_use_PrivateKey_file(SSL_CTX
*ctx
, const char *file
, int type
) {
207 Debug3("SSL_CTX_use_PrivateKey_file(%p, \"%s\", %d)", ctx
, file
, type
);
208 result
= SSL_CTX_use_PrivateKey_file(ctx
, file
, type
);
209 Debug1("SSL_CTX_use_PrivateKey_file() -> %d", result
);
213 void sycSSL_CTX_set_verify(SSL_CTX
*ctx
, int mode
,
214 int (*verify_callback
)(int, X509_STORE_CTX
*)) {
215 Debug3("SSL_CTX_set_verify(%p, %u, %p)", ctx
, mode
, verify_callback
);
216 SSL_CTX_set_verify(ctx
, mode
, verify_callback
);
217 Debug("SSL_CTX_set_verify() -> ");
220 int sycSSL_CTX_set_cipher_list(SSL_CTX
*ctx
, const char *str
) {
222 Debug2("SSL_CTX_set_cipher_list(%p, \"%s\")", ctx
, str
);
223 result
= SSL_CTX_set_cipher_list(ctx
, str
);
224 Debug1("SSL_CTX_set_cipher_list() -> %d", result
);
228 int sycSSL_CTX_set_tmp_dh(SSL_CTX
*ctx
, DH
*dh
) {
230 Debug2("SSL_CTX_set_tmp_dh(%p, %p)", ctx
, dh
);
231 result
= SSL_CTX_set_tmp_dh(ctx
, dh
);
232 Debug1("SSL_CTX_set_tmp_dh() -> %d", result
);
236 int sycSSL_set_cipher_list(SSL
*ssl
, const char *str
) {
238 Debug2("SSL_set_cipher_list(%p, \"%s\")", ssl
, str
);
239 result
= SSL_set_cipher_list(ssl
, str
);
240 Debug1("SSL_set_cipher_list() -> %d", result
);
244 long sycSSL_get_verify_result(SSL
*ssl
) {
246 Debug1("SSL_get_verify_result(%p)", ssl
);
247 result
= SSL_get_verify_result(ssl
);
248 Debug1("SSL_get_verify_result() -> %lx", result
);
252 int sycSSL_set_fd(SSL
*ssl
, int fd
) {
254 Debug2("SSL_set_fd(%p, %d)", ssl
, fd
);
255 result
= SSL_set_fd(ssl
, fd
);
256 Debug1("SSL_set_fd() -> %d", result
);
260 int sycSSL_connect(SSL
*ssl
) {
262 Debug1("SSL_connect(%p)", ssl
);
263 result
= SSL_connect(ssl
);
264 Debug1("SSL_connect() -> %d", result
);
268 int sycSSL_accept(SSL
*ssl
) {
270 Debug1("SSL_accept(%p)", ssl
);
271 result
= SSL_accept(ssl
);
272 Debug1("SSL_accept() -> %d", result
);
276 int sycSSL_read(SSL
*ssl
, void *buf
, int num
) {
278 Debug3("SSL_read(%p, %p, %d)", ssl
, buf
, num
);
279 result
= SSL_read(ssl
, buf
, num
);
280 Debug1("SSL_read() -> %d", result
);
284 int sycSSL_pending(SSL
*ssl
) {
286 Debug1("SSL_pending(%p)", ssl
);
287 result
= SSL_pending(ssl
);
288 Debug1("SSL_pending() -> %d", result
);
292 int sycSSL_write(SSL
*ssl
, const void *buf
, int num
) {
294 Debug3("SSL_write(%p, %p, %d)", ssl
, buf
, num
);
295 result
= SSL_write(ssl
, buf
, num
);
296 Debug1("SSL_write() -> %d", result
);
300 X509
*sycSSL_get_peer_certificate(SSL
*ssl
) {
302 Debug1("SSL_get_peer_certificate(%p)", ssl
);
303 result
= SSL_get_peer_certificate(ssl
);
305 Debug1("SSL_get_peer_certificate() -> %p", result
);
307 Debug("SSL_get_peer_certificate() -> NULL");
312 int sycSSL_shutdown(SSL
*ssl
) {
314 Debug1("SSL_shutdown(%p)", ssl
);
315 result
= SSL_shutdown(ssl
);
316 Debug1("SSL_shutdown() -> %d", result
);
320 void sycSSL_CTX_free(SSL_CTX
*ctx
) {
321 Debug1("SSL_CTX_free(%p)", ctx
);
323 Debug("SSL_CTX_free() -> void");
327 void sycSSL_free(SSL
*ssl
) {
328 Debug1("SSL_free(%p)", ssl
);
330 Debug("SSL_free() -> void");
334 int sycRAND_egd(const char *path
) {
336 Debug1("RAND_egd(\"%s\")", path
);
337 result
= RAND_egd(path
);
338 Debug1("RAND_egd() -> %d", result
);
342 DH
*sycPEM_read_bio_DHparams(BIO
*bp
, DH
**x
, pem_password_cb
*cb
, void *u
) {
344 Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
346 result
= PEM_read_bio_DHparams(bp
, x
, cb
, u
);
348 /*Debug2("PEM_read_bio_DHparams(, {%p},,) -> %p", *x, result);*/
349 Debug1("PEM_read_bio_DHparams() -> %p", result
);
351 Debug("PEM_read_bio_DHparams() -> NULL");
356 BIO
*sycBIO_new_file(const char *filename
, const char *mode
) {
358 Debug2("BIO_new_file(\"%s\", \"%s\")", filename
, mode
);
359 result
= BIO_new_file(filename
, mode
);
361 Debug1("BIO_new_file() -> %p", result
);
363 Debug("BIO_new_file() -> NULL");
369 int sycFIPS_mode_set(int onoff
) {
371 Debug1("FIPS_mode_set(%d)", onoff
);
372 result
= FIPS_mode_set(onoff
);
373 Debug1("FIPS_mode_set() -> %d", result
);
376 #endif /* WITH_FIPS */
378 #if OPENSSL_VERSION_NUMBER >= 0x00908000L
379 const COMP_METHOD
*sycSSL_get_current_compression(SSL
*ssl
) {
380 const COMP_METHOD
*result
;
381 Debug1("SSL_get_current_compression(%p)", ssl
);
382 result
= SSL_get_current_compression(ssl
);
384 Debug1("SSL_get_current_compression() -> %p", result
);
386 Debug("SSL_get_current_compression() -> NULL");
391 const COMP_METHOD
*sycSSL_get_current_expansion(SSL
*ssl
) {
392 const COMP_METHOD
*result
;
393 Debug1("SSL_get_current_expansion(%p)", ssl
);
394 result
= SSL_get_current_expansion(ssl
);
396 Debug1("SSL_get_current_expansion() -> %p", result
);
398 Debug("SSL_get_current_expansion() -> NULL");
403 const char *sycSSL_COMP_get_name(const COMP_METHOD
*comp
) {
405 Debug1("SSL_COMP_get_name(%p)", comp
);
406 result
= SSL_COMP_get_name(comp
);
408 Debug1("SSL_COMP_get_name() -> \"%s\"", result
);
410 Debug("SSL_COMP_get_name() -> NULL");
416 #endif /* WITH_SYCLS && WITH_OPENSSL */