[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1275397387.24218.20972.camel@zakaz.uk.xensource.com>
Date: Tue, 01 Jun 2010 14:03:07 +0100
From: Ian Campbell <ijc@...lion.org.uk>
To: Petr Ovtchenkov <ptr@...d-ptr.info>
Cc: linux-kernel@...r.kernel.org
Subject: Re: constant half-byte from /proc/sys/kernel/random/uuid
On Tue, 2010-06-01 at 16:22 +0400, Petr Ovtchenkov wrote:
> Lack of randomness during generating uuid.
[...]
> See on 7th high half-byte: it '4' in
> all cases---4b, 42, 40, 43, 49, 41,
> 4b, 4b, 4e. Checked three comps, with
> similar results. All Linux-generated UUID (boot_id)
> that I see in internet has '4' in this
> half-byte.
This appears to be deliberate. From drivers/char/random.c:
void generate_random_uuid(unsigned char uuid_out[16])
{
get_random_bytes(uuid_out, 16);
/* Set UUID version to 4 --- truly random generation */
uuid_out[6] = (uuid_out[6] & 0x0F) | 0x40;
/* Set the UUID variant to DCE */
uuid_out[8] = (uuid_out[8] & 0x3F) | 0x80;
}
EXPORT_SYMBOL(generate_random_uuid);
Version 4 UUIDs and the format used are described at
http://en.wikipedia.org/wiki/Universally_Unique_Identifier
Ian.
--
Ian Campbell
Current Noise: Jesu - Your Path To Divinity
Build a system that even a fool can use and only a fool will want to use it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists