]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
uuid: use prandom_bytes()
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 23 Mar 2013 02:32:58 +0000 (13:32 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 26 Mar 2013 05:11:39 +0000 (16:11 +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;
 }