[PATCH libXdmcp] Fix compilation error when arc4random_buf is not available

Peter Hutterer peter.hutterer at who-t.net
Fri May 5 05:11:50 UTC 2017


On Thu, May 04, 2017 at 11:12:13AM +0200, Benjamin Tissoires wrote:
> Not sure how I missed that, but I did.
> 
> Also rename emulate_getrandom_buf() into insecure_getrandom_buf() as
> requested in the previous patch reviews.
> 
> Last, getbits() expects an unsigned char, so remove the warning.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
> ---
> Obviously, I somehow even didn't compile the previous patch.
> Mea maxima culpa.

remote: Updating patchwork state for https://patchwork.freedesktop.org/project/Xorg/list/
remote: I: patch #154481 updated using rev 6d1aee0310001eca8f6ded9814a2a70b3a774896.
remote: I: 1 patch(es) updated to state Accepted.
To git+ssh://git.freedesktop.org/git/xorg/lib/libXdmcp
   0554324..6d1aee0  master -> maste

thanks

Cheers,
   Peter

>  Key.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Key.c b/Key.c
> index 70607d0..d61ad0e 100644
> --- a/Key.c
> +++ b/Key.c
> @@ -65,15 +65,15 @@ getbits (long data, unsigned char *dst)
>  #ifndef HAVE_ARC4RANDOM_BUF
>  
>  static void
> -emulate_getrandom_buf (char *auth, int len)
> +insecure_getrandom_buf (unsigned char *auth, int len)
>  {
>      long    lowbits, highbits;
>  
>      srandom ((int)getpid() ^ time((Time_t *)0));
>      lowbits = random ();
>      highbits = random ();
> -    getbits (lowbits, key->data);
> -    getbits (highbits, key->data + 4);
> +    getbits (lowbits, auth);
> +    getbits (highbits, auth + 4);
>  }
>  
>  static void
> @@ -88,7 +88,7 @@ arc4random_buf (void *auth, int len)
>  	return;
>  #endif /* HAVE_GETENTROPY */
>  
> -    emulate_getrandom_buf (auth, len);
> +    insecure_getrandom_buf (auth, len);
>  }
>  
>  #endif /* !defined(HAVE_ARC4RANDOM_BUF) */
> -- 
> 2.9.3
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list