Mercurial > dropbear
diff options.h @ 149:ed9ca2a9705c
Cleaned up the random code, use /dev/random by default,
and remove the addrandom() function which wasn't used.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 20 Dec 2004 13:11:15 +0000 |
parents | 4562a2f4d690 |
children | b9d3f725e00b |
line wrap: on
line diff
--- a/options.h Sun Dec 19 16:28:08 2004 +0000 +++ b/options.h Mon Dec 20 13:11:15 2004 +0000 @@ -128,19 +128,21 @@ #define ENABLE_CLI_PASSWORD_AUTH #define ENABLE_CLI_PUBKEY_AUTH -/* Random device to use - you must specify _one only_. - * DEV_URANDOM is recommended on hosts with a good /dev/urandom, otherwise use - * PRNGD and run prngd, specifying the socket. This device must be able to - * produce a large amount of random data, so using /dev/random or Entropy - * Gathering Daemon (egd) may result in halting, as it waits for more random - * data */ -#define DROPBEAR_DEV_URANDOM /* use /dev/urandom */ +/* Random device to use - define either DROPBEAR_RANDOM_DEV or + * DROPBEAR_PRNGD_SOCKET. + * DROPBEAR_RANDOM_DEV is recommended on hosts with a good /dev/(u)random, + * otherwise use run prngd (or egd if you want), specifying the socket. + * The device will be queried for a few dozen bytes of seed a couple of times + * per session (or more for very long-lived sessions). */ -/*#undef DROPBEAR_PRNGD */ /* use prngd socket - you must manually set up prngd - to produce output */ -#ifndef DROPBEAR_PRNGD_SOCKET -#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng" -#endif +/* If you are lacking entropy on the system then using /dev/urandom + * will prevent Dropbear from blocking on the device. This could + * however significantly reduce the security of your ssh connections + * if the PRNG state becomes simpler. */ +#define DROPBEAR_RANDOM_DEV "/dev/random" + +/* prngd must be manually set up to produce output */ +/*#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"*/ /* Specify the number of clients we will allow to be connected but * not yet authenticated. After this limit, connections are rejected */ @@ -213,8 +215,6 @@ #define MAX_BANNER_SIZE 2000 /* this is 25*80 chars, any more is foolish */ #define MAX_BANNER_LINES 20 /* How many lines the client will display */ -#define DEV_URANDOM "/dev/urandom" - /* the number of NAME=VALUE pairs to malloc for environ, if we don't have * the clearenv() function */ #define ENV_SIZE 100 @@ -336,6 +336,14 @@ #error "You can't turn on PASSWORD and PAM auth both at once. Fix it in options.h" #endif +#if defined(DROPBEAR_RANDOM_DEV) && defined(DROPBEAR_PRNGD_SOCKET) +#error "You can't turn on DROPBEAR_PRNGD_SOCKET and DROPBEAR_RANDOM_DEV at once" +#endif + +#if !defined(DROPBEAR_RANDOM_DEV) && !defined(DROPBEAR_PRNGD_SOCKET) +#error "You must choose one of DROPBEAR_PRNGD_SOCKET or DROPBEAR_RANDOM_DEV in options.h" +#endif + /* We use dropbear_client and dropbear_server as shortcuts to avoid redundant * code, if we're just compiling as client or server */ #if defined(DROPBEAR_SERVER) && defined(DROPBEAR_CLIENT)