summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2006-03-25 12:57:44 +0000
committerMatt Johnston <matt@ucc.asn.au>2006-03-25 12:57:44 +0000
commit52617a6786daf9ea769bc18626be1a0c2edf2ac1 (patch)
treed8d5f8da1637f9a2e1919d8b7d6614fb6f89893d
parent85e85c6acfc9eefc119c3d5fc1a47915183a5cc6 (diff)
parente42df7344817c1ac3209c6eacaacae1916bcef24 (diff)
downloaddropbear-52617a6786daf9ea769bc18626be1a0c2edf2ac1.tar.gz
merge of 6ace12c71fc2773210f2f3d374c96622ca54fe48
and 84eb6fedc6df0666f8053b9018bf16635dbfb257
-rw-r--r--CHANGES4
-rw-r--r--random.c4
-rw-r--r--scpmisc.h21
-rw-r--r--svr-main.c1
4 files changed, 28 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 4855f16..5e07ffd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+0.48.1 - Sat 11 March 2006
+
+- Compile fix for scp
+
0.48 - Thurs 9 March 2006
- Check that the circular buffer is properly empty before
diff --git a/random.c b/random.c
index cbbe016..5953a43 100644
--- a/random.c
+++ b/random.c
@@ -31,7 +31,8 @@ static int donerandinit = 0;
/* this is used to generate unique output from the same hashpool */
static uint32_t counter = 0;
-#define MAX_COUNTER 1<<31 /* the max value for the counter, so it won't loop */
+/* the max value for the counter, so it won't integer overflow */
+#define MAX_COUNTER 1<<30
static unsigned char hashpool[SHA1_HASH_SIZE];
@@ -167,7 +168,6 @@ void reseedrandom() {
gettimeofday(&tv, NULL);
hash_state hs;
- unsigned char hash[SHA1_HASH_SIZE];
sha1_init(&hs);
sha1_process(&hs, (void*)hashpool, sizeof(hashpool));
sha1_process(&hs, (void*)&pid, sizeof(pid));
diff --git a/scpmisc.h b/scpmisc.h
index c829347..7d0b326 100644
--- a/scpmisc.h
+++ b/scpmisc.h
@@ -46,3 +46,24 @@ char *xstrdup(const char *);
char *ssh_get_progname(char *);
void fatal(char* fmt,...);
void sanitise_stdfd(void);
+
+/* Required for non-BSD platforms, from OpenSSH's defines.h */
+#ifndef timersub
+#define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
+ } while (0)
+#endif
+
+#ifndef TIMEVAL_TO_TIMESPEC
+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
+ (ts)->tv_sec = (tv)->tv_sec; \
+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \
+}
+#endif
+
diff --git a/svr-main.c b/svr-main.c
index e06eb5e..e00de6b 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -28,6 +28,7 @@
#include "buffer.h"
#include "signkey.h"
#include "runopts.h"
+#include "random.h"
static size_t listensockets(int *sock, size_t sockcount, int *maxfd);
static void sigchld_handler(int dummy);