X-Git-Url: https://git.saurik.com/apple/securityd.git/blobdiff_plain/d4f30fc98d57b5a0f6b66a02eb965b80ab9cff82..4cd1cad0dea00daa03e1b54fdf2797a02373ad5b:/src/entropy.cpp?ds=inline diff --git a/src/entropy.cpp b/src/entropy.cpp index 83d7d20..c936d8f 100644 --- a/src/entropy.cpp +++ b/src/entropy.cpp @@ -153,21 +153,23 @@ void EntropyManager::collectEntropy() int result; - size_t size = sizeof(mach_timespec_t) * timingsToCollect; - double bytesRemaining = kBytesOfEntropyToCollect; int loopCount = 0; while (bytesRemaining >= 0) { + size_t size = sizeof(mach_timespec_t) * timingsToCollect; + result = sysctl(mib,4, buffer, &size, NULL, 0); if (result == -1) { Syslog::alert("entropy measurement returned no entropy (errno=%d)", errno); + sleep(1); } else if (size == 0) { Syslog::alert("entropy measurement returned no entropy."); + sleep(1); } // remove the non-entropic pieces from the buffer