Use uuid_generate_random instead of uuid_generate in CoCreateGuid
authorstephentoub <stoub@microsoft.com>
Sat, 14 Nov 2015 14:16:04 +0000 (09:16 -0500)
committerstephentoub <stoub@microsoft.com>
Sat, 14 Nov 2015 14:16:04 +0000 (09:16 -0500)
The PAL implementation of CoCreateGuid is currently using uuid_generate.
This will be based on high-quality randomness if available, otherwise it
falls back to an algorithm that incorporates the local ethernet MAC address
along with the current time and a pseudo-random generator. To avoid potential
privacy issues, this commit switches to using uuid_generate_random, which
instead falls back purely to a pseudo-random generator.

src/pal/src/misc/miscpalapi.cpp

index d225071..15cb741 100644 (file)
@@ -353,10 +353,10 @@ PALAPI
 CoCreateGuid(OUT GUID * pguid)
 {
 #if HAVE_LIBUUID_H
-    uuid_generate(*(uuid_t*)pguid);
+    uuid_generate_random(*(uuid_t*)pguid);
 
-    // Change the byte order of the Data1, 2 and 3, since the uuid_generate generates them
-    // with big endian while GUIDS need to have them in little endian.
+    // Change the byte order of the Data1, 2 and 3, since the uuid_generate_random
+    // generates them with big endian while GUIDS need to have them in little endian.
     pguid->Data1 = SWAP32(pguid->Data1);
     pguid->Data2 = SWAP16(pguid->Data2);
     pguid->Data3 = SWAP16(pguid->Data3);