openssl.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include <openssl/opensslv.h>
  2. #if OPENSSL_VERSION_NUMBER < 0x10100000L
  3. #include <stdlib.h>
  4. #include <stdint.h>
  5. #include "dl.h"
  6. extern "C" {
  7. typedef int (*OPENSSL_init_ssl_t)(uint64_t a1, const void *a2);
  8. int _OPENSSL_init_ssl(uint64_t a1 __unused, const void *a2 __unused) {
  9. if (DLSYM_VAR(OPENSSL_init_ssl) == NULL)
  10. if (DLSYM_GLOBAL_SIMPLE(RTLD_NEXT, OPENSSL_init_ssl) == NULL)
  11. return 0;
  12. return DLSYM_VAR(OPENSSL_init_ssl)(a1, a2);
  13. }
  14. void _ERR_free_strings(void) {
  15. }
  16. void _EVP_cleanup(void) {
  17. }
  18. void _CRYPTO_cleanup_all_ex_data(void) {
  19. }
  20. int _SSL_library_init(void) {
  21. return _OPENSSL_init_ssl(0, NULL);
  22. }
  23. #define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
  24. #define OPENSSL_INIT_LOAD_SSL_STRINGS 0x00200000L
  25. void _SSL_load_error_strings(void) {
  26. _OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
  27. | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  28. }
  29. typedef void *(*TLS_client_method_t)(void);
  30. const void *_TLS_client_method(void) {
  31. if (DLSYM_VAR(TLS_client_method) == NULL)
  32. if (DLSYM_GLOBAL_SIMPLE(RTLD_NEXT, TLS_client_method) == NULL)
  33. return NULL;
  34. return DLSYM_VAR(TLS_client_method)();
  35. }
  36. const void *_SSLv23_client_method(void) {
  37. return _TLS_client_method();
  38. }
  39. } /* extern "C" */
  40. #endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */