[vino] Fixed a warning in libgcrypt initialization



commit e2740a819f4f5d3ebd2f8609b10408bf439fe1ec
Author: Tomasz Torcz <zdzichu irc pl>
Date:   Sun Sep 6 10:47:37 2009 -0300

    Fixed a warning in libgcrypt initialization

 server/libvncserver/vncauth.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/server/libvncserver/vncauth.c b/server/libvncserver/vncauth.c
index a482bdd..6551a1a 100644
--- a/server/libvncserver/vncauth.c
+++ b/server/libvncserver/vncauth.c
@@ -45,6 +45,16 @@ void
 vncRandomBytes(unsigned char *bytes)
 {
 #ifdef HAVE_GCRYPT
+    static rfbBool gcrypt_init = FALSE;
+
+    if (!gcrypt_init) {
+      if (!gcry_check_version(NULL)) /* version mismatch */
+        exit(1);
+      gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
+      gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
+      gcrypt_init = TRUE;
+    }
+
     gcry_randomize(bytes, CHALLENGESIZE, GCRY_STRONG_RANDOM);
 #else
     int i;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]