Skip to content

Commit

Permalink
Completely remove RAND_egd support
Browse files Browse the repository at this point in the history
The EGD daemon is completely unmaintained and has not seen a release
since 13 years which is not an acceptable timeframe for cryptographic
software. It is not packaged in any linux distribution I know of
and definitely not in *BSD.

LibreSSL has already dropped support for RAND_egd.
  • Loading branch information
hasufell committed Oct 6, 2015
1 parent 4340205 commit 427a600
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 307 deletions.
2 changes: 1 addition & 1 deletion cf/crypto.m4
Expand Up @@ -118,7 +118,7 @@ if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then
break;
fi
done
AC_CHECK_LIB(crypto, RAND_egd, AC_DEFINE(HAVE_RAND_EGD, 1, [Define if the libcrypto has RAND_egd]))
AC_CHECK_LIB(crypto, OPENSSL_init, [])
CFLAGS="$save_CFLAGS"
LIBS="$save_LIBS"
fi
Expand Down
1 change: 0 additions & 1 deletion lib/hcrypto/Makefile.am
Expand Up @@ -127,7 +127,6 @@ libhcrypto_la_SOURCES = \
md5.h \
pkcs5.c \
pkcs12.c \
rand-egd.c \
rand-fortuna.c \
rand-timer.c \
rand-unix.c \
Expand Down
3 changes: 0 additions & 3 deletions lib/hcrypto/libhcrypto-exports.def
Expand Up @@ -241,9 +241,6 @@ EXPORTS
hc_RAND_add
hc_RAND_bytes
hc_RAND_cleanup
;! hc_RAND_egd
;! hc_RAND_egd_bytes
;! hc_RAND_egd_method
hc_RAND_file_name
;! hc_RAND_fortuna_method
hc_RAND_get_rand_method
Expand Down
260 changes: 0 additions & 260 deletions lib/hcrypto/rand-egd.c

This file was deleted.

14 changes: 0 additions & 14 deletions lib/hcrypto/rand-fortuna.c
Expand Up @@ -485,20 +485,6 @@ fortuna_reseed(void)
add_entropy(&main_state, (void *)buf, sizeof(buf));
entropy_p = 1;
}
#endif
#if defined(HAVE_RAND_EGD)
/*
* Only to get egd entropy if /dev/random or arc4rand failed since
* it can be horribly slow to generate new bits.
*/
if (!entropy_p) {
unsigned char buf[INIT_BYTES];
if ((*hc_rand_egd_method.bytes)(buf, sizeof(buf)) == 1) {
add_entropy(&main_state, buf, sizeof(buf));
entropy_p = 1;
memset(buf, 0, sizeof(buf));
}
}
#endif
/*
* Fall back to gattering data from timer and secret files, this
Expand Down
6 changes: 0 additions & 6 deletions lib/hcrypto/rand.h
Expand Up @@ -56,10 +56,7 @@ typedef struct RAND_METHOD RAND_METHOD;
#define RAND_load_file hc_RAND_load_file
#define RAND_write_file hc_RAND_write_file
#define RAND_status hc_RAND_status
#define RAND_egd hc_RAND_egd
#define RAND_egd_bytes hc_RAND_egd_bytes
#define RAND_fortuna_method hc_RAND_fortuna_method
#define RAND_egd_method hc_RAND_egd_method
#define RAND_unix_method hc_RAND_unix_method
#define RAND_w32crypto_method hc_RAND_w32crypto_method

Expand Down Expand Up @@ -97,13 +94,10 @@ const char *
int RAND_load_file(const char *, size_t);
int RAND_write_file(const char *);
int RAND_status(void);
int RAND_egd(const char *);
int RAND_egd_bytes(const char *, int);


const RAND_METHOD * RAND_fortuna_method(void);
const RAND_METHOD * RAND_unix_method(void);
const RAND_METHOD * RAND_egd_method(void);
const RAND_METHOD * RAND_w32crypto_method(void);

#endif /* _HEIM_RAND_H */
1 change: 0 additions & 1 deletion lib/hcrypto/randi.h
Expand Up @@ -40,7 +40,6 @@

extern const RAND_METHOD hc_rand_fortuna_method;
extern const RAND_METHOD hc_rand_unix_method;
extern const RAND_METHOD hc_rand_egd_method;
extern const RAND_METHOD hc_rand_timer_method;
extern const RAND_METHOD hc_rand_w32crypto_method;

Expand Down
4 changes: 0 additions & 4 deletions lib/hcrypto/test_rand.c
Expand Up @@ -125,10 +125,6 @@ main(int argc, char **argv)
else if (strcasecmp(rand_method, "unix") == 0)
RAND_set_rand_method(RAND_unix_method());
#endif
#if defined(HAVE_RAND_EGD)
else if (strcasecmp(rand_method, "egd") == 0)
RAND_set_rand_method(RAND_egd_method());
#endif
#ifdef WIN32
else if (strcasecmp(rand_method, "w32crypto") == 0)
RAND_set_rand_method(RAND_w32crypto_method());
Expand Down
3 changes: 0 additions & 3 deletions lib/hcrypto/version-script.map
Expand Up @@ -226,9 +226,6 @@ HEIMDAL_CRYPTO_1.0 {
hc_RAND_add;
hc_RAND_bytes;
hc_RAND_cleanup;
hc_RAND_egd;
hc_RAND_egd_bytes;
hc_RAND_egd_method;
hc_RAND_file_name;
hc_RAND_fortuna_method;
hc_RAND_get_rand_method;
Expand Down
14 changes: 0 additions & 14 deletions lib/krb5/crypto-rand.c
Expand Up @@ -67,22 +67,8 @@ seed_something(void)
/* Calling RAND_status() will try to use /dev/urandom if it exists so
we do not have to deal with it. */
if (RAND_status() != 1) {
#if defined(HAVE_RAND_EGD)
krb5_context context;
const char *p;

/* Try using egd */
if (!krb5_init_context(&context)) {
p = krb5_config_get_string(context, NULL, "libdefaults",
"egd_socket", NULL);
if (p != NULL)
RAND_egd_bytes(p, ENTROPY_NEEDED);
krb5_free_context(context);
}
#else
/* TODO: Once a Windows CryptoAPI RAND method is defined, we
can use that and failover to another method. */
#endif
}

if (RAND_status() == 1) {
Expand Down

0 comments on commit 427a600

Please sign in to comment.