|
|
da65aa |
From 95bef09f135a70ba1174a0021f441b0bb62a9bec Mon Sep 17 00:00:00 2001
|
|
|
da65aa |
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
|
|
da65aa |
Date: Thu, 4 May 2017 11:05:15 +0200
|
|
|
da65aa |
Subject: [PATCH libXdmcp 2/3] Fix compilation error when arc4random_buf is not
|
|
|
da65aa |
available
|
|
|
da65aa |
|
|
|
da65aa |
Not sure how I missed that, but I did.
|
|
|
da65aa |
|
|
|
da65aa |
Also rename emulate_getrandom_buf() into insecure_getrandom_buf() as
|
|
|
da65aa |
requested in the previous patch reviews.
|
|
|
da65aa |
|
|
|
da65aa |
Last, getbits() expects an unsigned char, so remove the warning.
|
|
|
da65aa |
|
|
|
da65aa |
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
|
|
da65aa |
---
|
|
|
da65aa |
Key.c | 8 ++++----
|
|
|
da65aa |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
da65aa |
|
|
|
da65aa |
diff --git a/Key.c b/Key.c
|
|
|
da65aa |
index 70607d0..d61ad0e 100644
|
|
|
da65aa |
--- a/Key.c
|
|
|
da65aa |
+++ b/Key.c
|
|
|
da65aa |
@@ -65,15 +65,15 @@ getbits (long data, unsigned char *dst)
|
|
|
da65aa |
#ifndef HAVE_ARC4RANDOM_BUF
|
|
|
da65aa |
|
|
|
da65aa |
static void
|
|
|
da65aa |
-emulate_getrandom_buf (char *auth, int len)
|
|
|
da65aa |
+insecure_getrandom_buf (unsigned char *auth, int len)
|
|
|
da65aa |
{
|
|
|
da65aa |
long lowbits, highbits;
|
|
|
da65aa |
|
|
|
da65aa |
srandom ((int)getpid() ^ time((Time_t *)0));
|
|
|
da65aa |
lowbits = random ();
|
|
|
da65aa |
highbits = random ();
|
|
|
da65aa |
- getbits (lowbits, key->data);
|
|
|
da65aa |
- getbits (highbits, key->data + 4);
|
|
|
da65aa |
+ getbits (lowbits, auth);
|
|
|
da65aa |
+ getbits (highbits, auth + 4);
|
|
|
da65aa |
}
|
|
|
da65aa |
|
|
|
da65aa |
static void
|
|
|
da65aa |
@@ -88,7 +88,7 @@ arc4random_buf (void *auth, int len)
|
|
|
da65aa |
return;
|
|
|
da65aa |
#endif /* HAVE_GETENTROPY */
|
|
|
da65aa |
|
|
|
da65aa |
- emulate_getrandom_buf (auth, len);
|
|
|
da65aa |
+ insecure_getrandom_buf (auth, len);
|
|
|
da65aa |
}
|
|
|
da65aa |
|
|
|
da65aa |
#endif /* !defined(HAVE_ARC4RANDOM_BUF) */
|
|
|
da65aa |
--
|
|
|
da65aa |
2.9.3
|
|
|
da65aa |
|