aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/random.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cipher/random.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/cipher/random.c b/cipher/random.c
index dbf71478b..3355abf1a 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -31,6 +31,7 @@
#include "util.h"
#include "cipher.h"
#include "ttyio.h"
+#include "i18n.h"
struct cache {
int len;
@@ -51,7 +52,11 @@ quick_random_gen( int onoff )
int last = quick_test;
if( onoff != -1 )
quick_test = onoff;
+ #ifdef HAVE_DEV_RANDOM
return last;
+ #else
+ return 1; /* insecure RNG */
+ #endif
}
@@ -137,9 +142,9 @@ fill_buffer( byte *buffer, size_t length, int level )
tv.tv_usec = 0;
if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) {
if( !warn )
- tty_printf(
+ tty_printf( _(
"\nNot enough random bytes available. Please do some other work to give
-the OS a chance to collect more entropy! (Need %d more bytes)\n", length );
+the OS a chance to collect more entropy! (Need %d more bytes)\n"), length );
warn = 1;
continue;
}
@@ -177,10 +182,10 @@ fill_buffer( byte *buffer, size_t length, int level )
static int initialized=0;
if( !initialized ) {
- log_info("warning: using insecure random number generator!!\n");
- tty_printf("The random number generator is only a kludge to let\n"
+ log_info(_("warning: using insecure random number generator!!\n"));
+ tty_printf(_("The random number generator is only a kludge to let\n"
"it compile - it is in no way a strong RNG!\n\n"
- "DON'T USE ANY DATA GENERATED BY THIS PROGRAM!!\n\n");
+ "DON'T USE ANY DATA GENERATED BY THIS PROGRAM!!\n\n"));
initialized=1;
#ifdef HAVE_RAND
srand(make_timestamp()*getpid());