]> git.saurik.com Git - apple/xnu.git/blobdiff - libkern/uuid/uuid.c
xnu-4903.221.2.tar.gz
[apple/xnu.git] / libkern / uuid / uuid.c
index ce69ad76640cc10da9b0343b891f3b5e89ec12c1..eec3f494369c8d62978bec8e36a246f6ec4e365a 100644 (file)
@@ -82,13 +82,25 @@ uuid_copy(uuid_t dst, const uuid_t src)
        memcpy(dst, src, sizeof(uuid_t));
 }
 
        memcpy(dst, src, sizeof(uuid_t));
 }
 
+static void
+uuid_random_setflags(uuid_t out)
+{
+       out[6] = (out[6] & 0x0F) | 0x40;
+       out[8] = (out[8] & 0x3F) | 0x80;
+}
+
 void
 uuid_generate_random(uuid_t out)
 {
        read_random(out, sizeof(uuid_t));
 void
 uuid_generate_random(uuid_t out)
 {
        read_random(out, sizeof(uuid_t));
+       uuid_random_setflags(out);
+}
 
 
-       out[6] = (out[6] & 0x0F) | 0x40;
-       out[8] = (out[8] & 0x3F) | 0x80;
+void
+uuid_generate_early_random(uuid_t out)
+{
+       read_frandom(out, sizeof(uuid_t));
+       uuid_random_setflags(out);
 }
 
 void
 }
 
 void