]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
random uuids are marked as such
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 14 Jul 2012 11:30:36 +0000 (13:30 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sat, 14 Jul 2012 11:30:36 +0000 (13:30 +0200)
lib/tpm.c

index 5e35072836fd09b2520fadb9ccec8fb075fd5f9c..956c1b6b71de02483d910cfb1008deee9798305b 100644 (file)
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -608,7 +608,13 @@ static int randomize_uuid(TSS_UUID* uuid)
   ret = _gnutls_rnd (GNUTLS_RND_NONCE, raw_uuid, sizeof(raw_uuid));
   if (ret < 0)
     return gnutls_assert_val(ret);
-    
+   
+  /* mark it as random uuid */
+  raw_uuid[6] &= 0x0f;
+  raw_uuid[6] |= 0x40;
+  raw_uuid[8] &= 0x0f;
+  raw_uuid[8] |= 0x80;
+  
   memcpy(&uuid->ulTimeLow, raw_uuid, 4);
   memcpy(&uuid->usTimeMid, &raw_uuid[4], 2);
   memcpy(&uuid->usTimeHigh, &raw_uuid[6], 2);