Subject: patch to add libssh2_init() and libssh2_exit()

patch to add libssh2_init() and libssh2_exit()

From: Lars Nordin <>
Date: Wed, 10 Mar 2010 12:26:22 +0100

Please find attached patch to make libssh2 have a clean way of
initialize the library.

The patch adds a new file, global.c. The is changes, but not
the WIN32 files.

session.c is changed to call libssh2_init only if the global variable
libssh2_initialized is zero. The implicit load och ciphers in openssl.c
has been removed.

 From libssh2.h:
  * libssh2_init()
  * Initialize the libssh2 functions. flags can be:
  * LIBSSH2_INIT_ALL: Initialize everything
  * LIBSSH2_INIT_NO_CRYPTO_INIT: Do not initialize the crypto library
  * OPENSSL_add_cipher_algoritms() for OpenSSL
  * Returns 0 if succeeded, or a negative value for error.
LIBSSH2_API int libssh2_init(int flags);
  * libssh2_exit()
  * Exit the libssh2 functions and free's all memory used internal.
LIBSSH2_API void libssh2_exit();


Received on 2010-03-10