Initial macOS support (x86_64 with Rosetta 2)

This commit is contained in:
2025-11-08 01:45:47 -07:00
parent f56bd8e2a7
commit cc0a887302
33 changed files with 1281 additions and 4186 deletions

View File

@@ -92,12 +92,15 @@ BOOL WINAPI CryptGenRandom(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer) {
return FALSE;
}
#ifdef __APPLE__
arc4random_buf(pbBuffer, dwLen);
#else
ssize_t ret = getrandom(pbBuffer, dwLen, 0);
if (ret < 0 || static_cast<DWORD>(ret) != dwLen) {
kernel32::setLastError(ERROR_NOT_SUPPORTED);
return FALSE;
}
#endif
return TRUE;
}