-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warning: 'arc4random_addrandom' is deprecated: use arc4random_stir #1631
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but MacOS CI is broken now, and it should be fixed first (#1632)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
b3804b9
to
54f621a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, arc4random_addrandom should never be used. It's deprecated in favor of arc4random_stir.
Can you expand the PR description to explain what you're doing and why, with links to the supposed deprecations (or at least the relevant warning output). The original PR description had something about macOS, but this code is going to effect systems other than macOS, so that's not the only thing that should be considered.
From a quick look at one manpage, i.e https://man.archlinux.org/man/arc4random_stir.3bsd.en, arc4random_addrandom
and arc4random_stir
are similar in function, but not marked as deprecated?
I also see:
It is not necessary for an application to call arc4random_stir() or arc4random_addrandom() before calling other arc4random functions.
Additionally, arc4random_stir() and arc4random_addrandom() may abort the process in the highly unlikely event that the operating system fails to provide entropy.
So it could be considered as unnecessary to call arc4random_stir
as use arc4random_addrandom
, so it's not clear why swapping the usage of one, for the other, here, is an improvement, or the right change to make?
@@ -193,9 +193,11 @@ evutil_secure_rng_get_bytes(void *buf, size_t n) | |||
void | |||
evutil_secure_rng_add_bytes(const char *buf, size_t n) | |||
{ | |||
#if !defined(EVENT__HAVE_ARC4RANDOM) || defined(EVENT__HAVE_ARC4RANDOM_ADDRANDOM) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're removing the use of EVENT__HAVE_ARC4RANDOM_ADDRANDOM
, then why is the check for arc4random_addrandom
being retained in both build systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean to do like that: c7adfa5
Right?
54f621a
to
7534ddb
Compare
7534ddb
to
c7adfa5
Compare
Ideally, arc4random_addrandom should never be used. It's deprecated in favor of arc4random_stir:
https://opensource.apple.com/source/Libc/Libc-1439.40.11/include/stdlib.h.auto.html