diff random.c @ 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 e66eec4dcba7
children
line wrap: on
line diff
--- 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++;