about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-07-11 18:51:03 +0320
committerPaul Fariello <paul@fariello.eu>2019-07-11 14:25:42 +0200
commitc22df13d9548ac99ed7a50f462227523ee15d8ed (patch)
tree6e45287bd81a994f89a8eb0a730d1ebf0ae65466 /src
parentb7144d82febae18c235772bf8abae3c7684f3109 (diff)
downloadprofani-tty-c22df13d9548ac99ed7a50f462227523ee15d8ed.tar.gz
Dirty fix libgcrypt memleak
Diffstat (limited to 'src')
-rw-r--r--src/omemo/crypto.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/omemo/crypto.c b/src/omemo/crypto.c
index 81d7c922..5a67c3b1 100644
--- a/src/omemo/crypto.c
+++ b/src/omemo/crypto.c
@@ -55,6 +55,11 @@ omemo_crypto_init(void)
 
     gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
 
+    /* Ask for a first random buffer to ensure CSPRNG is initialized.
+     * Thus we control the memleak produced by gcrypt initialization and we can
+     * suppress it without having false negatives */
+    gcry_free(gcry_random_bytes_secure(1, GCRY_VERY_STRONG_RANDOM));
+
     return 0;
 }