summaryrefslogtreecommitdiff
path: root/lib/random.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-12-12 02:18:59 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-12-12 02:56:01 +0100
commitbd617810e4338294aa0c6b74da81274bae045f10 (patch)
treed938f496564dd1e2f20dc426a9128b74e4c9d8e9 /lib/random.h
parent09ec28b2d701d7b27a1a2171988b98ff08690257 (diff)
downloadgnutls-bd617810e4338294aa0c6b74da81274bae045f10.tar.gz
Optimizations in DH parameter generation.
The larger prime is find first and the big loop needs to find a smaller prime, increasing performance. The _gnutls_rnd() function is now inline and GNUTLS_RND_NONCE doesn't update random generator state.
Diffstat (limited to 'lib/random.h')
-rw-r--r--lib/random.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/random.h b/lib/random.h
index 5f82c2fcec..921f8dc922 100644
--- a/lib/random.h
+++ b/lib/random.h
@@ -27,8 +27,19 @@
#include <crypto-backend.h>
extern int crypto_rnd_prio;
+extern void* gnutls_rnd_ctx;
extern gnutls_crypto_rnd_st _gnutls_rnd_ops;
+inline static int
+_gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len)
+{
+ if (len > 0)
+ {
+ return _gnutls_rnd_ops.rnd (gnutls_rnd_ctx, level, data, len);
+ }
+ return 0;
+}
+
void _gnutls_rnd_deinit (void);
int _gnutls_rnd_init (void);