]>
Commit | Line | Data |
---|---|---|
2056dd30 AM |
1 | From 793c2046de1ac04689d541a5e83513fe8e62578c Mon Sep 17 00:00:00 2001 |
2 | From: Marc Fournier <marc.fournier@camptocamp.com> | |
3 | Date: Thu, 16 Jan 2014 00:30:42 +0100 | |
4 | Subject: [PATCH 08/22] network: comment libgcrypt initalization process | |
5 | ||
6 | --- | |
7 | src/network.c | 9 ++++++++- | |
8 | 1 file changed, 8 insertions(+), 1 deletion(-) | |
9 | ||
10 | diff --git a/src/network.c b/src/network.c | |
11 | index be82c6f..f379a5c 100644 | |
12 | --- a/src/network.c | |
13 | +++ b/src/network.c | |
14 | @@ -500,8 +500,15 @@ static void network_init_gcrypt (void) /* {{{ */ | |
15 | if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P)) | |
16 | return; | |
17 | ||
18 | + /* http://www.gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html | |
19 | + * To ensure thread-safety, it's important to set GCRYCTL_SET_THREAD_CBS | |
20 | + * *before* initalizing Libgcrypt with gcry_check_version(), which itself must | |
21 | + * be called before any other gcry_* function. GCRYCTL_ANY_INITIALIZATION_P | |
22 | + * above doesn't count, as it doesn't implicitly initalize Libgcrypt. | |
23 | + * | |
24 | + * tl;dr: keep all these gry_* statements in this exact order please. */ | |
25 | gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); | |
26 | - gcry_check_version (NULL); /* before calling *almost* any other functions */ | |
27 | + gcry_check_version (NULL); | |
28 | gcry_control (GCRYCTL_INIT_SECMEM, 32768); | |
29 | gcry_control (GCRYCTL_INITIALIZATION_FINISHED); | |
30 | } /* }}} void network_init_gcrypt */ | |
31 | -- | |
32 | 1.9.3 | |
33 |