mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1015547 - Fill |struct nsID| via arc4random_buf if available on Android and BSDs. r=vlad, r=glandium
This commit is contained in:
parent
0374402eeb
commit
0ec208e47f
@ -2928,7 +2928,7 @@ dnl Checks for library functions.
|
||||
dnl ========================================================
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MEMCMP
|
||||
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random)
|
||||
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r arc4random arc4random_buf)
|
||||
|
||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
#include "nsUUIDGenerator.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
extern "C" NS_EXPORT void arc4random_buf(void *, size_t);
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsUUIDGenerator, nsIUUIDGenerator)
|
||||
@ -126,6 +130,9 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId)
|
||||
setstate(mState);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARC4RANDOM_BUF
|
||||
arc4random_buf(aId, sizeof(nsID));
|
||||
#else /* HAVE_ARC4RANDOM_BUF */
|
||||
size_t bytesLeft = sizeof(nsID);
|
||||
while (bytesLeft > 0) {
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
@ -150,6 +157,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId)
|
||||
|
||||
bytesLeft -= toWrite;
|
||||
}
|
||||
#endif /* HAVE_ARC4RANDOM_BUF */
|
||||
|
||||
/* Put in the version */
|
||||
aId->m2 &= 0x0fff;
|
||||
|
Loading…
Reference in New Issue
Block a user