[PATCH] D44866: GetRandom / OpenBSD, using getentropy to get high quality randomness
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 11:16:18 PDT 2018
vitalybuka added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:1923
// Up to 256 bytes, getrandom will not be interrupted.
- uptr res = internal_syscall(SYSCALL(getrandom), buffer, length,
+ res = internal_syscall(SYSCALL(getrandom), buffer, length,
blocking ? 0 : GRND_NONBLOCK);
----------------
please return this "res" back to the scope
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:1931
}
-#endif // SANITIZER_USE_GETRANDOM
+#elif SANITIZER_USE_GETENTROPY
+ res = getentropy(buffer, length);
----------------
better to put this into the beginning of the function and avoid elif
================
Comment at: lib/sanitizer_common/sanitizer_linux.cc:1944
return false;
- uptr res = internal_read(fd, buffer, length);
+ res = internal_read(fd, buffer, length);
if (internal_iserror(res))
----------------
here you we need res at all, following is readable enough
```
if (internal_iserror(internal_read(fd, buffer, length))
```
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D44866
More information about the llvm-commits
mailing list