mirror of https://github.com/aria2/aria2
Initialize libgcrypt.
We relied initialization of libgcrypt on gnutls_global_init(), but recent change in gnutls, which changes default crypto backend from libgcrypt to libnettle, leaves libgcrypt uninitialized if it uses libnettle as backend(and this is likely because libnettle is chosen by default). To fix this issue, we simply initialize libgcrypt on our own.pull/1/head
parent
70eeebfae9
commit
afdbda8f10
|
@ -58,6 +58,9 @@
|
|||
# include <openssl/err.h>
|
||||
# include <openssl/ssl.h>
|
||||
#endif // HAVE_OPENSSL
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
# include <gcrypt.h>
|
||||
#endif // HAVE_LIBGCRYPT
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
# include <gnutls/gnutls.h>
|
||||
#endif // HAVE_LIBGNUTLS
|
||||
|
@ -103,6 +106,13 @@ bool Platform::setUp()
|
|||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
#endif // HAVE_OPENSSL
|
||||
#ifdef HAVE_LIBGCRYPT
|
||||
if(!gcry_check_version(GCRYPT_VERSION)) {
|
||||
throw DL_ABORT_EX("gcry_check_version() failed.");
|
||||
}
|
||||
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
|
||||
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
|
||||
#endif // HAVE_LIBGCRYPT
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
{
|
||||
int r = gnutls_global_init();
|
||||
|
|
Loading…
Reference in New Issue