提交 cedddb00 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

uuid: use prandom_bytes()

Use prandom_bytes() to generate 16 bytes of pseudo-random bytes.
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3ec39abd
...@@ -25,13 +25,7 @@ ...@@ -25,13 +25,7 @@
static void __uuid_gen_common(__u8 b[16]) static void __uuid_gen_common(__u8 b[16])
{ {
int i; prandom_bytes(b, 16);
u32 r;
for (i = 0; i < 4; i++) {
r = random32();
memcpy(b + i * 4, &r, 4);
}
/* reversion 0b10 */ /* reversion 0b10 */
b[8] = (b[8] & 0x3F) | 0x80; b[8] = (b[8] & 0x3F) | 0x80;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册