1This patch removes calls to getentropy() and BCryptGetRandom() because they 2aren't implemented or supported on certain platforms based on the trybot 3results I saw. I will try upstreaming a configure script flag soon to replace 4this patch file. This patch is safe because it reverts the random number 5generation behavior before a recent libxml upstream patch. 6 7diff --git a/dict.c b/dict.c 8index ccd8b542..6273437e 100644 9--- a/dict.c 10+++ b/dict.c 11@@ -928,13 +928,8 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { 12 #ifdef _WIN32 13 #define WIN32_LEAN_AND_MEAN 14 #include <windows.h> 15- #include <bcrypt.h> 16-#elif HAVE_DECL_GETENTROPY 17- #include <unistd.h> 18- #include <sys/random.h> 19-#else 20- #include <time.h> 21 #endif 22+#include <time.h> 23 24 static xmlMutex xmlRngMutex; 25 26@@ -951,25 +946,6 @@ xmlInitRandom(void) { 27 xmlInitMutex(&xmlRngMutex); 28 29 { 30-#ifdef _WIN32 31- NTSTATUS status; 32- 33- status = BCryptGenRandom(NULL, (unsigned char *) globalRngState, 34- sizeof(globalRngState), 35- BCRYPT_USE_SYSTEM_PREFERRED_RNG); 36- if (!BCRYPT_SUCCESS(status)) 37- xmlAbort("libxml2: BCryptGenRandom failed with error code %lu\n", 38- GetLastError()); 39-#elif HAVE_DECL_GETENTROPY 40- while (1) { 41- if (getentropy(globalRngState, sizeof(globalRngState)) == 0) 42- break; 43- 44- if (errno != EINTR) 45- xmlAbort("libxml2: getentropy failed with error code %d\n", 46- errno); 47- } 48-#else 49 int var; 50 51 globalRngState[0] = 52@@ -978,7 +954,6 @@ xmlInitRandom(void) { 53 globalRngState[1] = 54 HASH_ROL((unsigned) ((size_t) &xmlRngMutex & 0xFFFFFFFF), 16) ^ 55 HASH_ROL((unsigned) ((size_t) &var & 0xFFFFFFFF), 24); 56-#endif 57 } 58 } 59 60