Bug 1516642 - Add a function declaration for arc4random_buf in expat. r=peterv
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 Feb 2019 13:48:36 +0000
changeset 458406 57664c81a1de82de2e2dc34a9a2806fccf2cc5c0
parent 458405 af6a8b058f9a64e344be618ed578979cf0491722
child 458407 4e8f135fc34feb7b3284a71502d745f47aaab989
push id111821
push userdvarga@mozilla.com
push dateSat, 09 Feb 2019 21:55:30 +0000
treeherdermozilla-inbound@aa525133e148 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1516642
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1516642 - Add a function declaration for arc4random_buf in expat. r=peterv The function has been in bionic (Android's libc since the first commit in the upstream repository), but it's not been in stdlib.h until recently. As it happens, we have a similar declaration in xpcom/base/nsUUIDGenerator.cpp. Differential Revision: https://phabricator.services.mozilla.com/D19120
parser/expat/lib/xmlparse.c
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -813,16 +813,23 @@ gather_time_entropy(void)
   return tv.tv_usec;
 #endif
 }
 
 #if defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_LIBBSD)
 # include <bsd/stdlib.h>
 #endif
 
+/* BEGIN MOZILLA CHANGE (not all Android NDK versions have the function
+ * declaration, although the function has been available in bionic forever) */
+#if defined(HAVE_ARC4RANDOM_BUF) && defined(__ANDROID__)
+__attribute__((visibility("default"))) void arc4random_buf(void*, size_t);
+#endif
+/* END MOZILLA CHANGE */
+
 static unsigned long
 ENTROPY_DEBUG(const char * label, unsigned long entropy) {
 /* BEGIN MOZILLA CHANGE (don't getenv every time we set up a hash) */
 #if 0
   const char * const EXPAT_ENTROPY_DEBUG = getenv("EXPAT_ENTROPY_DEBUG");
   if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, "1")) {
     fprintf(stderr, "Entropy: %s --> 0x%0*lx (%lu bytes)\n",
         label,