Bug 1612 - Bad random generator
Summary: Bad random generator
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) All
: high normal
Assignee: Roland Mainz
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-12 15:29 UTC by Søren Sandmann Pedersen
Modified: 2007-11-16 16:53 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Søren Sandmann Pedersen 2004-10-12 15:29:45 UTC
In xc/programs/Xserver/os/auth.c we have this code:

/* A random number generator that is more unpredictable
   than that shipped with some systems.
   This code is taken from the C standard. */

static unsigned long int next = 1;

static int
xdm_rand(void)
{
    next = next * 1103515245 + 12345;
    return (unsigned int)(next/65536) % 32768;
}

static void
xdm_srand(unsigned int seed)
{
    next = seed;
}

void
GenerateRandomData (int len, char *buf)
{
    static int seed;
    int value;
    int i;

    seed += GetTimeInMillis();
    xdm_srand (seed);
    for (i = 0; i < len; i++)
    {
        value = xdm_rand ();
        buf[i] ^= (value & 0xff00) >> 8;
    }

    /* XXX add getrusage, popen("ps -ale") */
}

#endif /* XCSECURITY */

which is not a very good random generator.
Comment 1 Roland Mainz 2005-02-01 11:38:52 UTC
Taking bug - I'll try to hack a patch for this...
Comment 2 Daniel Stone 2007-02-27 01:24:25 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 3 Adam Jackson 2007-11-16 16:53:31 UTC
Fixed in git master.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.