Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Jitter time measurement on Apple platforms (#722)
On Apple platforms, Jitter RNG implementation uses `mach_absolute_time` function to get the current value of the clock. However, this function deals in "tick" units, not in time units. On Intel based Apple platforms 1 tick = 1 ns, which is good enough timer resolution for Jitter. On M1 macbooks 1 tick ~ 41.67 ns. This seems to be a problem for Jitter since it causes frequent failures to produce enough entropy on M1 macbooks. Another potential cause for the issue might be that `mach_absolute_time` clock doesn't increment while they system is asleep. I am not sure what is the definition of "asleep" on M1 macs, how it correlates to performance and efficiency cores and different power saving states, etc. The upstream Jitter RNG repository has recently added support for using the system counter on `aarch64` which seems like way to go for all 64-bit Arm platforms. So this change: - Adds the system counter calls on `aarch64` platforms, - Removes the `__MACH__` special case.
- Loading branch information