As mentioned earlier, the Libgcrypt library is thread-safe if you adhere to the following requirements:
gcry_check_versionmust be called before any other function in the library. To achieve this in multi-threaded programs, you must synchronize the memory with respect to other threads that also want to use Libgcrypt. For this, it is sufficient to call
gcry_check_versionbefore creating the other threads using Libgcrypt1.
gpg_strerror, the function
gcry_strerroris not thread safe. You have to use
At least this is true for POSIX threads,
pthread_create is a function that synchronizes memory with
respects to other threads. There are many functions which have this
property, a complete list can be found in POSIX, IEEE Std 1003.1-2003,
Base Definitions, Issue 6, in the definition of the term “Memory
Synchronization”. For other thread packages, more relaxed or more
strict rules may apply.