1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526
|
/* source: sslcls.c */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */
/* explicit system call and C library trace function, for those who miss strace
*/
#include "config.h"
#include "xioconfig.h" /* what features are enabled */
#if WITH_SYCLS && WITH_OPENSSL
#include "sysincludes.h"
#include "mytypes.h"
#include "compat.h"
#include "errno.h"
#include "error.h"
#include "filan.h"
#include "sysutils.h"
#include "sycls.h"
#if HAVE_OPENSSL_INIT_SSL
/* OpenBSD 7.2 does not know OPENSSL_INIT_SETTING */
int sycOPENSSL_init_ssl(uint64_t opts, const void *settings) {
int result;
Debug2("OPENSSL_init_ssl("F_uint64_t", %p)", opts, settings);
result = OPENSSL_init_ssl(opts, settings);
Debug1("OPENSSL_init_ssl() -> %d", result);
return result;
}
#endif
#if !(defined(HAVE_OPENSSL_INIT_SSL) && defined(HAVE_OPENSSL_INIT_new))
void sycSSL_load_error_strings(void) {
Debug("SSL_load_error_strings()");
SSL_load_error_strings();
Debug("SSL_load_error_strings() ->");
}
#endif
#if HAVE_SSL_library_init
int sycSSL_library_init(void) {
int result;
Debug("SSL_library_init()");
result = SSL_library_init();
Debug1("SSL_library_init() -> %d", result);
return result;
}
#endif
#if HAVE_TLS_client_method
const SSL_METHOD *sycTLS_client_method(void) {
const SSL_METHOD *result;
Debug("TLS_client_method()");
result = TLS_client_method();
Debug1("TLS_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLS_server_method
const SSL_METHOD *sycTLS_server_method(void) {
const SSL_METHOD *result;
Debug("TLS_server_method()");
result = TLS_server_method();
Debug1("TLS_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_SSLv2_client_method
const SSL_METHOD *sycSSLv2_client_method(void) {
const SSL_METHOD *result;
Debug("SSLv2_client_method()");
result = SSLv2_client_method();
Debug1("SSLv2_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_SSLv2_server_method
const SSL_METHOD *sycSSLv2_server_method(void) {
const SSL_METHOD *result;
Debug("SSLv2_server_method()");
result = SSLv2_server_method();
Debug1("SSLv2_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_SSLv3_client_method
const SSL_METHOD *sycSSLv3_client_method(void) {
const SSL_METHOD *result;
Debug("SSLv3_client_method()");
result = SSLv3_client_method();
Debug1("SSLv3_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_SSLv3_server_method
const SSL_METHOD *sycSSLv3_server_method(void) {
const SSL_METHOD *result;
Debug("SSLv3_server_method()");
result = SSLv3_server_method();
Debug1("SSLv3_server_method() -> %p", result);
return result;
}
#endif
const SSL_METHOD *sycSSLv23_client_method(void) {
const SSL_METHOD *result;
Debug("SSLv23_client_method()");
result = SSLv23_client_method();
Debug1("SSLv23_client_method() -> %p", result);
return result;
}
const SSL_METHOD *sycSSLv23_server_method(void) {
const SSL_METHOD *result;
Debug("SSLv23_server_method()");
result = SSLv23_server_method();
Debug1("SSLv23_server_method() -> %p", result);
return result;
}
#if HAVE_TLSv1_client_method
const SSL_METHOD *sycTLSv1_client_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_client_method()");
result = TLSv1_client_method();
Debug1("TLSv1_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLSv1_server_method
const SSL_METHOD *sycTLSv1_server_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_server_method()");
result = TLSv1_server_method();
Debug1("TLSv1_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLSv1_1_client_method
const SSL_METHOD *sycTLSv1_1_client_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_1_client_method()");
result = TLSv1_1_client_method();
Debug1("TLSv1_1_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLSv1_1_server_method
const SSL_METHOD *sycTLSv1_1_server_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_1_server_method()");
result = TLSv1_1_server_method();
Debug1("TLSv1_1_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLSv1_2_client_method
const SSL_METHOD *sycTLSv1_2_client_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_2_client_method()");
result = TLSv1_2_client_method();
Debug1("TLSv1_2_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_TLSv1_2_server_method
const SSL_METHOD *sycTLSv1_2_server_method(void) {
const SSL_METHOD *result;
Debug("TLSv1_2_server_method()");
result = TLSv1_2_server_method();
Debug1("TLSv1_2_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLS_client_method
const SSL_METHOD *sycDTLS_client_method(void) {
const SSL_METHOD *result;
Debug("DTLS_client_method()");
result = DTLS_client_method();
Debug1("DTLS_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLS_server_method
const SSL_METHOD *sycDTLS_server_method(void) {
const SSL_METHOD *result;
Debug("DTLS_server_method()");
result = DTLS_server_method();
Debug1("DTLS_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLSv1_client_method
const SSL_METHOD *sycDTLSv1_client_method(void) {
const SSL_METHOD *result;
Debug("DTLSv1_client_method()");
result = DTLSv1_client_method();
Debug1("DTLSv1_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLSv1_server_method
const SSL_METHOD *sycDTLSv1_server_method(void) {
const SSL_METHOD *result;
Debug("DTLSv1_server_method()");
result = DTLSv1_server_method();
Debug1("DTLSv1_server_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLSv1_2_client_method
const SSL_METHOD *sycDTLSv1_2_client_method(void) {
const SSL_METHOD *result;
Debug("DTLSv1_2_client_method()");
result = DTLSv1_2_client_method();
Debug1("DTLSv1_2_client_method() -> %p", result);
return result;
}
#endif
#if HAVE_DTLSv1_2_server_method
const SSL_METHOD *sycDTLSv1_2_server_method(void) {
const SSL_METHOD *result;
Debug("DTLSv1_2_server_method()");
result = DTLSv1_2_server_method();
Debug1("DTLSv1_2_server_method() -> %p", result);
return result;
}
#endif
SSL_CTX *sycSSL_CTX_new(const SSL_METHOD *method) {
SSL_CTX *result;
Debug1("SSL_CTX_new(%p)", method);
result = SSL_CTX_new(method);
Debug1("SSL_CTX_new() -> %p", result);
return result;
}
SSL *sycSSL_new(SSL_CTX *ctx) {
SSL *result;
Debug1("SSL_new(%p)", ctx);
result = SSL_new(ctx);
Debug1("SSL_new() -> %p", result);
return result;
}
int sycSSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
const char *CApath) {
int result;
Debug7("SSL_CTX_load_verify_locations(%p, %s%s%s, %s%s%s)", ctx,
CAfile?"\"":"", CAfile?CAfile:"", CAfile?"\"":"",
CApath?"\"":"", CApath?CApath:"", CApath?"\"":"");
result = SSL_CTX_load_verify_locations(ctx, CAfile, CApath);
Debug1("SSL_CTX_load_verify_locations() -> %d", result);
return result;
}
int sycSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) {
int result;
Debug3("SSL_CTX_use_certificate_file(%p, \"%s\", %d)", ctx, file, type);
result = SSL_CTX_use_certificate_file(ctx, file, type);
Debug1("SSL_CTX_use_certificate_file() -> %d", result);
return result;
}
int sycSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file) {
int result;
Debug2("SSL_CTX_use_certificate_chain_file(%p, \"%s\")", ctx, file);
result = SSL_CTX_use_certificate_chain_file(ctx, file);
Debug1("SSL_CTX_use_certificate_chain_file() -> %d", result);
return result;
}
int sycSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type) {
int result;
Debug3("SSL_CTX_use_PrivateKey_file(%p, \"%s\", %d)", ctx, file, type);
result = SSL_CTX_use_PrivateKey_file(ctx, file, type);
Debug1("SSL_CTX_use_PrivateKey_file() -> %d", result);
return result;
}
void sycSSL_CTX_set_verify(SSL_CTX *ctx, int mode,
int (*verify_callback)(int, X509_STORE_CTX *)) {
Debug3("SSL_CTX_set_verify(%p, %u, %p)", ctx, mode, verify_callback);
SSL_CTX_set_verify(ctx, mode, verify_callback);
Debug("SSL_CTX_set_verify() -> ");
}
int sycSSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) {
int result;
Debug2("SSL_CTX_set_cipher_list(%p, \"%s\")", ctx, str);
result = SSL_CTX_set_cipher_list(ctx, str);
Debug1("SSL_CTX_set_cipher_list() -> %d", result);
return result;
}
int sycSSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh) {
int result;
Debug2("SSL_CTX_set_tmp_dh(%p, %p)", ctx, dh);
result = SSL_CTX_set_tmp_dh(ctx, dh);
Debug1("SSL_CTX_set_tmp_dh() -> %d", result);
return result;
}
#if HAVE_SSL_CTX_set_tlsext_max_fragment_length || defined(SSL_CTX_set_tlsext_max_fragment_length)
int sycSSL_CTX_set_tlsext_max_fragment_length(SSL_CTX *ctx, uint8_t mode) {
int result;
Debug2("SSL_CTX_set_tlsext_max_fragment_length(%p, %u)", ctx, mode);
result = SSL_CTX_set_tlsext_max_fragment_length(ctx, mode);
Debug1("SSL_CTX_set_tlsext_max_fragment_length() -> %d", result);
return result;
}
#endif
#if HAVE_SSL_CTX_set_max_send_fragment || defined(SSL_CTX_set_max_send_fragment)
int sycSSL_CTX_set_max_send_fragment(SSL_CTX *ctx, long msf) {
int result;
Debug2("SSL_CTX_set_max_send_fragment(%p, %ld)", ctx, msf);
result = SSL_CTX_set_max_send_fragment(ctx, msf);
Debug1("SSL_CTX_set_max_send_fragment() -> %d", result);
return result;
}
#endif
int sycSSL_set_cipher_list(SSL *ssl, const char *str) {
int result;
Debug2("SSL_set_cipher_list(%p, \"%s\")", ssl, str);
result = SSL_set_cipher_list(ssl, str);
Debug1("SSL_set_cipher_list() -> %d", result);
return result;
}
long sycSSL_get_verify_result(SSL *ssl) {
long result;
Debug1("SSL_get_verify_result(%p)", ssl);
result = SSL_get_verify_result(ssl);
Debug1("SSL_get_verify_result() -> %lx", result);
return result;
}
int sycSSL_set_fd(SSL *ssl, int fd) {
int result;
Debug2("SSL_set_fd(%p, %d)", ssl, fd);
result = SSL_set_fd(ssl, fd);
Debug1("SSL_set_fd() -> %d", result);
return result;
}
int sycSSL_connect(SSL *ssl) {
int result;
Debug1("SSL_connect(%p)", ssl);
result = SSL_connect(ssl);
if (!diag_in_handler) diag_flush();
Debug1("SSL_connect() -> %d", result);
return result;
}
int sycSSL_accept(SSL *ssl) {
int result;
Debug1("SSL_accept(%p)", ssl);
result = SSL_accept(ssl);
Debug1("SSL_accept() -> %d", result);
return result;
}
int sycSSL_read(SSL *ssl, void *buf, int num) {
int result;
Debug3("SSL_read(%p, %p, %d)", ssl, buf, num);
result = SSL_read(ssl, buf, num);
Debug1("SSL_read() -> %d", result);
return result;
}
int sycSSL_pending(SSL *ssl) {
int result;
Debug1("SSL_pending(%p)", ssl);
result = SSL_pending(ssl);
Debug1("SSL_pending() -> %d", result);
return result;
}
int sycSSL_write(SSL *ssl, const void *buf, int num) {
int result;
Debug3("SSL_write(%p, %p, %d)", ssl, buf, num);
result = SSL_write(ssl, buf, num);
Debug1("SSL_write() -> %d", result);
return result;
}
X509 *sycSSL_get_peer_certificate(SSL *ssl) {
X509 *result;
Debug1("SSL_get_peer_certificate(%p)", ssl);
result = SSL_get_peer_certificate(ssl);
if (result) {
Debug1("SSL_get_peer_certificate() -> %p", result);
} else {
Debug("SSL_get_peer_certificate() -> NULL");
}
return result;
}
int sycSSL_shutdown(SSL *ssl) {
int result;
Debug1("SSL_shutdown(%p)", ssl);
result = SSL_shutdown(ssl);
Debug1("SSL_shutdown() -> %d", result);
return result;
}
void sycSSL_CTX_free(SSL_CTX *ctx) {
Debug1("SSL_CTX_free(%p)", ctx);
SSL_CTX_free(ctx);
Debug("SSL_CTX_free() -> void");
return;
}
void sycSSL_free(SSL *ssl) {
Debug1("SSL_free(%p)", ssl);
SSL_free(ssl);
Debug("SSL_free() -> void");
return;
}
#if !defined(OPENSSL_NO_EGD) && HAVE_RAND_egd
int sycRAND_egd(const char *path) {
int result;
Debug1("RAND_egd(\"%s\")", path);
result = RAND_egd(path);
Debug1("RAND_egd() -> %d", result);
return result;
}
#endif
DH *sycPEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u) {
DH *result;
Debug4("PEM_read_bio_DHparams(%p, %p, %p, %p)",
bp, x, cb, u);
result = PEM_read_bio_DHparams(bp, x, cb, u);
if (result) {
/*Debug2("PEM_read_bio_DHparams(, {%p},,) -> %p", *x, result);*/
Debug1("PEM_read_bio_DHparams() -> %p", result);
} else {
Debug("PEM_read_bio_DHparams() -> NULL");
}
return result;
}
BIO *sycBIO_new_file(const char *filename, const char *mode) {
BIO *result;
Debug2("BIO_new_file(\"%s\", \"%s\")", filename, mode);
result = BIO_new_file(filename, mode);
if (result) {
Debug1("BIO_new_file() -> %p", result);
} else {
Debug("BIO_new_file() -> NULL");
}
return result;
}
#if WITH_FIPS
int sycFIPS_mode_set(int onoff) {
int result;
Debug1("FIPS_mode_set(%d)", onoff);
result = FIPS_mode_set(onoff);
Debug1("FIPS_mode_set() -> %d", result);
return result;
}
#endif /* WITH_FIPS */
#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_COMP)
const COMP_METHOD *sycSSL_get_current_compression(SSL *ssl) {
const COMP_METHOD *result;
Debug1("SSL_get_current_compression(%p)", ssl);
result = SSL_get_current_compression(ssl);
if (result) {
Debug1("SSL_get_current_compression() -> %p", result);
} else {
Debug("SSL_get_current_compression() -> NULL");
}
return result;
}
const COMP_METHOD *sycSSL_get_current_expansion(SSL *ssl) {
const COMP_METHOD *result;
Debug1("SSL_get_current_expansion(%p)", ssl);
result = SSL_get_current_expansion(ssl);
if (result) {
Debug1("SSL_get_current_expansion() -> %p", result);
} else {
Debug("SSL_get_current_expansion() -> NULL");
}
return result;
}
const char *sycSSL_COMP_get_name(const COMP_METHOD *comp) {
const char *result;
Debug1("SSL_COMP_get_name(%p)", comp);
result = SSL_COMP_get_name(comp);
if (result) {
Debug1("SSL_COMP_get_name() -> \"%s\"", result);
} else {
Debug("SSL_COMP_get_name() -> NULL");
}
return result;
}
#endif
#endif /* WITH_SYCLS && WITH_OPENSSL */
|