[PATCH xdm] Missed on arc4random() conversion.

Matthieu Herrb matthieu at herrb.eu
Tue Jan 5 23:14:22 PST 2016


On Tue, Jan 05, 2016 at 02:49:44PM -0800, Alan Coopersmith wrote:
> On 01/ 5/16 12:34 PM, Matthieu Herrb wrote:
> >Signed-off-by: Matthieu Herrb <matthieu at herrb.eu>
> >---
> >  xdm/genauth.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> >
> >diff --git xdm/genauth.c xdm/genauth.c
> >index 5db7315..f50be3b 100644
> >--- xdm/genauth.c
> >+++ xdm/genauth.c
> >@@ -408,15 +408,20 @@ GenerateAuthData (char *auth, int len)
> >      static int	    xdmcpAuthInited;
> >      long	    ldata[2];
> >
> >-# ifdef ITIMER_REAL
> >+# ifndef HAVE_ARC4RANDOM
> >+#  ifdef ITIMER_REAL
> >      struct timeval  now;
> >
> >      X_GETTIMEOFDAY (&now);
> >      ldata[0] = now.tv_usec;
> >      ldata[1] = now.tv_sec;
> >-# else
> >+#  else
> >      ldata[0] = time ((long *) 0);
> >      ldata[1] = getpid ();
> >+#  endif
> >+# else
> >+    ldata[0] = arc4random();
> >+    ldata[1] = arc4random();
> >  # endif
> >
> >      longtochars (ldata[0], data+0);
> >
> 
> Does it matter that arc4random is only providing 32-bits of data into
> a long?

Hmm good question. Since those 2 values are then poured
into a char[8] array by longtochar(), it shouldn't matter.
longtochars seems to to be effectively only using the 32 low bits of
its long parameter.

> 
> -- 
> 	-Alan Coopersmith-              alan.coopersmith at oracle.com
> 	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc

-- 
Matthieu Herrb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20160106/db92a11c/attachment.sig>


More information about the xorg-devel mailing list