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