-
Notifications
You must be signed in to change notification settings - Fork 1k
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
seed random with a real random data #377
Conversation
@@ -0,0 +1,59 @@ | |||
#ifdef WIN32 | |||
#include "Windows.h" |
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.
maybe windows.h?
I really want to start work on fixing the why we use random and other bits ;) This is the start. @ossec anyone able to review? |
#endif | ||
|
||
if (failed) { | ||
ErrorExit("Error in randombytes failed on all possiable methods for accessing random data"); |
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.
Typo in possible.
typo fixed. Building now. |
#endif | ||
|
||
if (failed) { | ||
ErrorExit("Error in randombytes failed on all possible methods for accessing random data"); |
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.
I agree with @cgzones suggestion here:
Having some more context around what application had the error using __local_name
would be useful here I think.
#endif | ||
|
||
if (failed) { | ||
ErrorExit("%s: Error in randombytes failed on all possible methods for accessing random data", __local_name); |
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.
Better but can we make it the same formatting many of the other error messages get. Here is a random example I found:
https://github.com/ossec/ossec-hids/blob/master/src/shared/file_op.c#L454
ErrorExit("%s: ERROR: Message goes here", __local_name);
Wish this was abstracted a bit better so you didn't have to do this each time.
Was just about to merge this but looks like you have to merge master before I can. |
@awiddersheim fixed the conflicts :) travis will be done in a few minutes. |
seed random with a real random data
The way random was seed was predictable. This does not fix it, but makes it better and standardizes the process across domains. I will be looking to use random bytes more often in the code base.
Randombytes started life: https://github.com/ultramancool/tweetnacl-usable/blob/master/randombytes.c thank you @ultramancool and tweetnacl/djb guys.