Function amqp_uninitialize_ssl_library

Synopsis

#include <librabbitmq/amqp_ssl_socket.h>

int amqp_uninitialize_ssl_library(void)

Description

Uninitialize the underlying SSL/TLS library.

Return
AMQP_STATUS_OK on success.
Since
v0.9.0

Mentioned in

Source

Lines 740-790 in librabbitmq/amqp_openssl.c. Line 282 in librabbitmq/amqp_ssl_socket.h.

int amqp_uninitialize_ssl_library(void) {
  int status;
  CHECK_SUCCESS(pthread_mutex_lock(&openssl_init_mutex));

  if (openssl_connections > 0) {
    status = AMQP_STATUS_SOCKET_INUSE;
    goto out;
  }

  amqp_openssl_bio_destroy();
  openssl_bio_initialized = 0;

#ifndef AMQP_OPENSSL_V110
  ERR_remove_state(0);
#endif

#ifndef LIBRESSL_VERSION_NUMBER
  FIPS_mode_set(0);
#endif

  CRYPTO_set_locking_callback(NULL);
  CRYPTO_set_id_callback(NULL);
  {
    int i;
    for (i = 0; i < CRYPTO_num_locks(); i++) {
      pthread_mutex_destroy(&amqp_openssl_lockarray[i]);
    }
    free(amqp_openssl_lockarray);
  }

  if (openssl_engine != NULL) {
    ENGINE_free(openssl_engine);
    openssl_engine = NULL;
  }

  ENGINE_cleanup();
  CONF_modules_free();
  EVP_cleanup();
  CRYPTO_cleanup_all_ex_data();
  ERR_free_strings();
#if (OPENSSL_VERSION_NUMBER >= 0x10002003L) && !defined(LIBRESSL_VERSION_NUMBER)
  SSL_COMP_free_compression_methods();
#endif

  openssl_initialized = 0;

  status = AMQP_STATUS_OK;
out:
  CHECK_SUCCESS(pthread_mutex_unlock(&openssl_init_mutex));
  return status;
}





Add Discussion as Guest

Log in to DocsForge