mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 23:47:51 +00:00
Use Bionic arc4random_buf for the older Android API route and retain the existing getentropy initializer from API 28. Register the real function address in the ARM32 interpreter so loaded SplitMix objects can resolve it. Both ABI controls verify API26 compilation and linking against the actual NDK headers and providers, and API35 object equality. Final source checks use native LLVM21; exact final NDK18 and production package-tar validation remain for CI after local VM startup failures.
22 lines
559 B
Diff
22 lines
559 B
Diff
--- a/cbits-unix/init.c
|
|
+++ b/cbits-unix/init.c
|
|
@@ -1,8 +1,17 @@
|
|
#include <stdint.h>
|
|
#include <unistd.h>
|
|
+#if defined(__ANDROID__) && __ANDROID_API__ < 28
|
|
+#include <stdlib.h>
|
|
+#endif
|
|
|
|
-uint64_t splitmix_init() {
|
|
+uint64_t splitmix_init(void) {
|
|
uint64_t result;
|
|
+ /* Bionic exposes getentropy from API 28; arc4random_buf exists earlier. */
|
|
+#if defined(__ANDROID__) && __ANDROID_API__ < 28
|
|
+ arc4random_buf(&result, sizeof(uint64_t));
|
|
+ int r = 0;
|
|
+#else
|
|
int r = getentropy(&result, sizeof(uint64_t));
|
|
+#endif
|
|
return r == 0 ? result : 0xfeed1000;
|
|
}
|