about summary refs log tree commit diff stats
path: root/src/tidy_tls.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2014-11-30 23:28:13 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2014-11-30 23:28:13 -0500
commita47d5eba571ee53ff331ebd0f20a284bd9b8cdfb (patch)
treecece397aab2928a51d0fa31ce51615e24acc20cf /src/tidy_tls.c
parentb363dfc27473c2ee3c1ccc286115b238030d85f0 (diff)
downloadlynx-snapshots-a47d5eba571ee53ff331ebd0f20a284bd9b8cdfb.tar.gz
snapshot of project "lynx", label v2-8-9dev_1d
Diffstat (limited to 'src/tidy_tls.c')
-rw-r--r--src/tidy_tls.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tidy_tls.c b/src/tidy_tls.c
index e6afeefa..f6dea810 100644
--- a/src/tidy_tls.c
+++ b/src/tidy_tls.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: tidy_tls.c,v 1.22 2014/01/11 17:34:51 tom Exp $
+ * $LynxId: tidy_tls.c,v 1.24 2014/11/30 23:28:13 tom Exp $
  * Copyright 2008-2013,2014 Thomas E. Dickey
  * with fix Copyright 2008 by Thomas Viehmann
  *
@@ -11,7 +11,11 @@
 #include <tidy_tls.h>
 
 #include <gnutls/x509.h>
+#ifdef HAVE_GNUTLS_RND
+#include <gnutls/crypto.h>
+#else
 #include <gcrypt.h>
+#endif
 #include <libtasn1.h>		/* ASN1_SUCCESS,etc */
 #include <string.h>
 
@@ -95,8 +99,15 @@ unsigned long ERR_get_error(void)
  */
 int RAND_bytes(unsigned char *buffer, int num)
 {
+    int rc;
+
+#ifdef HAVE_GNUTLS_RND
+    rc = gnutls_rnd(GNUTLS_RND_KEY, buffer, num);
+#else
     gcry_randomize(buffer, num, GCRY_VERY_STRONG_RANDOM);
-    return 1;
+    rc = 1;
+#endif
+    return rc;
 }
 
 /*