ObjFW  Check-in [9aa85c25b5]

Overview
Comment:Don't assume arc4random_buf if we have arc4random
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9aa85c25b50460e6f0c8a3b8a877dcb61475661447aabf7b6be31d2208b6be12
User & Date: js on 2020-09-27 01:00:55
Other Links: manifest | tags
Context
2020-09-27
01:01
Rename "make tarball" to "make release" check-in: 111d28cc65 user: js tags: trunk
01:00
Don't assume arc4random_buf if we have arc4random check-in: 9aa85c25b5 user: js tags: trunk
00:57
Work around bugs in Apple GCC 4.2.1 check-in: cbc09c6e26 user: js tags: trunk
Changes

Modified configure.ac from [64037d8825] to [3d859a1b4f].

899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
	])
	AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
		AC_SUBST(ENCODINGS_A, "encodings.a")
		AC_SUBST(ENCODINGS_ENCODINGS_A, "encodings/encodings.a")
	])
])

AC_CHECK_FUNCS(arc4random getrandom random, break)

AS_IF([test x"$host_os" != x"morphos"], [
	AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")
])
AC_CHECK_HEADERS_ONCE(dlfcn.h)
case "$host_os" in
	netbsd*)







|







899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
	])
	AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
		AC_SUBST(ENCODINGS_A, "encodings.a")
		AC_SUBST(ENCODINGS_ENCODINGS_A, "encodings/encodings.a")
	])
])

AC_CHECK_FUNCS(arc4random arc4random_buf getrandom random, break)

AS_IF([test x"$host_os" != x"morphos"], [
	AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl")
])
AC_CHECK_HEADERS_ONCE(dlfcn.h)
case "$host_os" in
	netbsd*)

Modified src/OFObject.m from [37d44845c9] to [9fabb2395f].

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
	return ((uint32_t)of_random16() << 16) | of_random16();
#endif
}

uint64_t
of_random64(void)
{
#if defined(HAVE_ARC4RANDOM)
	uint64_t buffer;

	arc4random_buf(&buffer, sizeof(buffer));

	return buffer;
#elif defined(HAVE_GETRANDOM)
	uint64_t buffer;







|







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
	return ((uint32_t)of_random16() << 16) | of_random16();
#endif
}

uint64_t
of_random64(void)
{
#if defined(HAVE_ARC4RANDOM_BUF)
	uint64_t buffer;

	arc4random_buf(&buffer, sizeof(buffer));

	return buffer;
#elif defined(HAVE_GETRANDOM)
	uint64_t buffer;