This compiles on macos for x86_64, at least.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4485 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-10-04 23:20:57 +00:00
parent 6302565942
commit 31af27529e
5 changed files with 69 additions and 17 deletions

View File

@ -44,6 +44,12 @@ JSValue _crypt_gensalt(JSContext* context, JSValueConst this_val, int argc, JSVa
char buffer[16];
#if defined(_WIN32)
ssize_t bytes = SystemFunction036(buffer, sizeof(buffer)) ? sizeof(buffer) : 0;
#elif defined(__APPLE__)
ssize_t bytes = 0;
if (getentropy(buffer, sizeof(buffer)) == 0)
{
bytes = sizeof(buffer);
}
#else
ssize_t bytes = getrandom(buffer, sizeof(buffer), 0);
#endif