1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00
freebsd-ports/www/firefox-esr/files/patch-bug1015547
Beat Gaetzi 0557b9315d - Update Firefox to 30.0
- Update Firefox ESR to 24.6.0
- Update libxul to 24.6.0
- Update NSS to 3.16.1
- Update NSPR to 4.10.6
- Update Thunderbird to 24.6.0
- Convert USE_BZIP2 to USES
- Backport ff31 fix against crashing DEBUG build on newegg.com [1]
- Add a note in UPDATING to not build audio/soundtouch with
  INTEGER_SAMPLES [2]
- Use arc4random_buf(3) to generate UUIDs (version 4)
- Fix debugger detection used by Telemetry and the slow script dialog
- Add STAGE support [3]

PR:		ports/189991 [1]
PR:		ports/189217 [2]
PR:		ports/189488 [2]
Submitted by:	bapt [3]
Sumbitted by:	Jan Beich
Security:	http://www.vuxml.org/freebsd/888a0262-f0d9-11e3-ba0c-b4b52fce4ce8.html
2014-06-11 03:42:55 +00:00

95 lines
2.9 KiB
Plaintext

diff --git configure.in configure.in
index 7bed45f..053de17 100644
--- configure.in
+++ configure.in
@@ -3166,6 +3166,7 @@ AC_CHECK_FUNCS(random strerror lchown fc
AC_CHECK_FUNCS(statvfs64 statvfs statfs64 statfs)
AC_CHECK_FUNCS(flockfile getpagesize)
AC_CHECK_FUNCS(localtime_r strtok_r)
+AC_CHECK_FUNCS(arc4random arc4random_buf)
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
diff --git xpcom/base/nsUUIDGenerator.cpp xpcom/base/nsUUIDGenerator.cpp
index 0687344..ca3ff8b 100644
--- xpcom/base/nsUUIDGenerator.cpp
+++ xpcom/base/nsUUIDGenerator.cpp
@@ -15,6 +15,10 @@
#include "nsUUIDGenerator.h"
+#ifdef ANDROID
+extern "C" NS_EXPORT void arc4random_buf(void *, size_t);
+#endif
+
using namespace mozilla;
NS_IMPL_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator)
@@ -34,7 +38,7 @@ nsUUIDGenerator::Init()
// We're a service, so we're guaranteed that Init() is not going
// to be reentered while we're inside Init().
-#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(ANDROID)
+#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM)
/* initialize random number generator using NSPR random noise */
unsigned int seed;
@@ -67,7 +71,7 @@ nsUUIDGenerator::Init()
return NS_ERROR_FAILURE;
#endif
-#endif /* non XP_WIN and non XP_MACOSX */
+#endif /* non XP_WIN and non XP_MACOSX and non ARC4RANDOM */
return NS_OK;
}
@@ -114,13 +118,16 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id)
* back to it; instead, we use the value returned when we called
* initstate, since older glibc's have broken setstate() return values
*/
-#ifndef ANDROID
+#ifndef HAVE_ARC4RANDOM
setstate(mState);
#endif
+#ifdef HAVE_ARC4RANDOM_BUF
+ arc4random_buf(id, sizeof(nsID));
+#else /* HAVE_ARC4RANDOM_BUF */
size_t bytesLeft = sizeof(nsID);
while (bytesLeft > 0) {
-#ifdef ANDROID
+#ifdef HAVE_ARC4RANDOM
long rval = arc4random();
const size_t mRBytes = 4;
#else
@@ -141,6 +148,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id)
bytesLeft -= toWrite;
}
+#endif /* HAVE_ARC4RANDOM_BUF */
/* Put in the version */
id->m2 &= 0x0fff;
@@ -150,7 +158,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id)
id->m3[0] &= 0x3f;
id->m3[0] |= 0x80;
-#ifndef ANDROID
+#ifndef HAVE_ARC4RANDOM
/* Restore the previous RNG state */
setstate(mSavedState);
#endif
diff --git xpcom/base/nsUUIDGenerator.h xpcom/base/nsUUIDGenerator.h
index 6a24212..68ed6f2 100644
--- xpcom/base/nsUUIDGenerator.h
+++ xpcom/base/nsUUIDGenerator.h
@@ -27,7 +27,7 @@ private:
protected:
mozilla::Mutex mLock;
-#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(ANDROID)
+#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM)
char mState[128];
char *mSavedState;
uint8_t mRBytes;