File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -371,20 +371,13 @@ static size_t read_urandom(void* buf, size_t n)
371
371
}
372
372
373
373
#if defined(__APPLE__ )
374
- #include "TargetConditionals.h"
375
- #endif
376
-
377
- #if defined(__APPLE__ ) && defined(__MAC_10_12 ) && !defined(__IPHONE_OS_VERSION_MIN_REQUIRED )
378
- #include <sys/random.h>
374
+ #include <Security/SecRandom.h>
379
375
#endif
380
376
381
377
static size_t entropy (void * buf , size_t n )
382
378
{
383
- #if defined(__APPLE__ ) && ((defined(__MAC_10_12 ) && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12 ) || TARGET_OS_TV || TARGET_OS_WATCH )
384
- #if TARGET_OS_TV || TARGET_OS_WATCH
385
- extern int getentropy (void * buffer , size_t buflen );
386
- #endif
387
- if (getentropy (buf , n ) == 0 )
379
+ #if defined(__APPLE__ )
380
+ if (SecRandomCopyBytes (kSecRandomDefault , n , (uint8_t * ) buf ) == 0 )
388
381
return n ;
389
382
#elif defined(__linux__ ) && defined(SYS_getrandom )
390
383
if (syscall (SYS_getrandom , buf , n , 0 ) == n )
You can’t perform that action at this time.
0 commit comments