www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: [libssh2] #277: libgcrypt and gcry_check_version in a multithreaded application.

[libssh2] #277: libgcrypt and gcry_check_version in a multithreaded application.

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Sun, 06 Oct 2013 00:06:27 -0000

#277: libgcrypt and gcry_check_version in a multithreaded application.
-------------------------------------------------+-------------------------
 Reporter: TMcC | Owner:
     Type: defect | Status: new
 Priority: normal | Milestone: 1.4.3
Component: crypto | Version: 1.4.2
 Keywords: threads, mt, multithreaded, crypto, | Blocked By:
  sigabrt, gcry_check_version, gcrpyt, |
  libgcrypt |
   Blocks: |
-------------------------------------------------+-------------------------
 In a multithreaded application, libssh2_init() ought to call
 gcry_check_version(), or the documentation for libssh2 ought to advise
 that libgcrpyt's gcry_check_version() must be called, before
 libssh2_init() is executed.

 Please see here: http://www.gnupg.org/documentation/manuals/gcrypt-devel
 /Initializing-the-library.html

 Without this call, we get SIGABRTs from gcrpyt.

 In summary, in a multithread application, the sequence of calls should be:

 {{{#!c
  // Enable thread safety for gcrypt.
  int result = gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
  if (!gcry_check_version (GCRYPT_VERSION))
  {
      std::cerr << "libgcrypt version mismatch" << std::endl;
      exit (2);
  }
  libssh2_init();
 }}}

-- 
Ticket URL: <https://trac.libssh2.org/ticket/277>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-10-06

the libssh2 team