Skip to content

Commit

Permalink
uuid: use prandom_bytes()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
mita authored and torvalds committed Apr 30, 2013
1 parent 3ec39ab commit cedddb0
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit cedddb0

Please sign in to comment.