summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2006-08-09 16:45:05 +0000
committerMatt Johnston <matt@ucc.asn.au>2006-08-09 16:45:05 +0000
commitd404c1f5a9a1e8e2b88c124773ba2368b8f48c24 (patch)
tree4f4bc6089a009b24c022d30d72165f9d7bf51228
parent3f766f251110bcbb329402a6b55b11cceeeb3954 (diff)
downloaddropbear-d404c1f5a9a1e8e2b88c124773ba2368b8f48c24.tar.gz
make sure that random number generator is correct endian
-rw-r--r--options.h4
-rw-r--r--random.c4
2 files changed, 5 insertions, 3 deletions
diff --git a/options.h b/options.h
index c079931..dfce7ac 100644
--- a/options.h
+++ b/options.h
@@ -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
diff --git a/random.c b/random.c
index c8c56bb..e5b4bdc 100644
--- a/random.c
+++ b/random.c
@@ -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++;