diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2013-04-10 10:08:11 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2013-04-12 15:27:32 +1000 |
commit | cf9016f307d5233904f3fad7529a52987044d68e (patch) | |
tree | 1360a444973c72eed6f551c6471961d6ddcaa209 /lib | |
parent | a6fb0c5842bc8adc54103e1dcddd33701f35f14e (diff) |
uuid: use prandom_bytes()
Use prandom_bytes() to generate 16 bytes of pseudo-random bytes.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/uuid.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/uuid.c b/lib/uuid.c index 52a6fe6387de..398821e4dce1 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -25,13 +25,7 @@ static void __uuid_gen_common(__u8 b[16]) { - int i; - u32 r; - - for (i = 0; i < 4; i++) { - r = random32(); - memcpy(b + i * 4, &r, 4); - } + prandom_bytes(b, 16); /* reversion 0b10 */ b[8] = (b[8] & 0x3F) | 0x80; } |