Mercurial > dropbear
changeset 355:c61bd8f9e32d debug-unrandom
make sure that random number generator is correct endian
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 09 Aug 2006 16:45:05 +0000 |
parents | 0e38c039a9c8 |
children | 1085ceab122d |
files | options.h random.c |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/options.h Wed Aug 09 16:37:18 2006 +0000 +++ b/options.h Wed Aug 09 16:45:05 2006 +0000 @@ -127,8 +127,8 @@ * but there's an interface via a PAM module - don't bother using it otherwise. * You can't enable both PASSWORD and PAM. */ -#define ENABLE_SVR_PASSWORD_AUTH -/*#define ENABLE_SVR_PAM_AUTH */ +/*#define ENABLE_SVR_PASSWORD_AUTH*/ +#define ENABLE_SVR_PAM_AUTH #define ENABLE_SVR_PUBKEY_AUTH #define ENABLE_CLI_PASSWORD_AUTH
--- a/random.c Wed Aug 09 16:37:18 2006 +0000 +++ b/random.c Wed Aug 09 16:45:05 2006 +0000 @@ -73,6 +73,7 @@ unsigned int copylen; const unsigned int total_len = len; unsigned char* start_buf = buf; + unsigned char counter_buf[4]; if (!donerandinit) { dropbear_exit("seedrandom not done"); @@ -81,7 +82,8 @@ while (len > 0) { sha1_init(&hs); sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); - sha1_process(&hs, (void*)&counter, sizeof(counter)); + STORE32H(counter, counter_buf); + sha1_process(&hs, (void*)counter_buf, sizeof(counter)); sha1_done(&hs, hash); counter++;