Make Expat build on CloudABI
authorEd Schouten <ed@nuxi.nl>
Sat, 30 Jul 2016 14:42:24 +0000 (16:42 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 30 Jul 2016 14:42:24 +0000 (16:42 +0200)
expat/lib/xmlparse.c

index 0d5dd7bf9152288b9a799066119ee925c79feb87..5f55ef98a7b1568250f48e6619d4d860fc88b97e 100644 (file)
@@ -719,6 +719,11 @@ gather_time_entropy(void)
 static unsigned long
 generate_hash_secret_salt(XML_Parser parser)
 {
+#ifdef __CloudABI__
+  unsigned long entropy;
+  arc4random_buf(&entropy, sizeof(entropy));
+  return entropy;
+#else
   /* Process ID is 0 bits entropy if attacker has local access
    * XML_Parser address is few bits of entropy if attacker has local access */
   const unsigned long entropy =
@@ -730,6 +735,7 @@ generate_hash_secret_salt(XML_Parser parser)
   } else {
     return entropy * (unsigned long)2305843009213693951;
   }
+#endif
 }
 
 static XML_Bool  /* only valid for root parser */