]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
uuid: use prandom_bytes()
authorAkinobu Mita <akinobu.mita@gmail.com>
Tue, 26 Mar 2013 23:26:06 +0000 (10:26 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 06:26:29 +0000 (17:26 +1100)
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>
lib/uuid.c

index 52a6fe6387de1a3d1204cd57fce8fab6e6e11b23..398821e4dce135d8fbe8d78bbee7bdc884fbd5e5 100644 (file)
 
 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;
 }