diff options
author | Matt Johnston <matt@ucc.asn.au> | 2006-08-09 16:45:05 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2006-08-09 16:45:05 +0000 |
commit | d404c1f5a9a1e8e2b88c124773ba2368b8f48c24 (patch) | |
tree | 4f4bc6089a009b24c022d30d72165f9d7bf51228 | |
parent | 3f766f251110bcbb329402a6b55b11cceeeb3954 (diff) | |
download | dropbear-d404c1f5a9a1e8e2b88c124773ba2368b8f48c24.tar.gz |
make sure that random number generator is correct endian
-rw-r--r-- | options.h | 4 | ||||
-rw-r--r-- | random.c | 4 |
2 files changed, 5 insertions, 3 deletions
@@ -127,8 +127,8 @@ etc) slower (perhaps by 50%). Recommended for most small systems. */ * 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 @@ -73,6 +73,7 @@ void genrandom(unsigned char* buf, unsigned int len) { 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 @@ void genrandom(unsigned char* buf, unsigned int len) { 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++; |