Skip to content
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

Merged
merged 8 commits into from
Oct 20, 2014

Conversation

jrossi
Copy link
Member

@jrossi jrossi commented Oct 18, 2014

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.

@@ -0,0 +1,59 @@
#ifdef WIN32
#include "Windows.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe windows.h?

@jrossi
Copy link
Member Author

jrossi commented Oct 19, 2014

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in possible.

@jrossi
Copy link
Member Author

jrossi commented Oct 20, 2014

typo fixed. Building now.

#endif

if (failed) {
ErrorExit("Error in randombytes failed on all possible methods for accessing random data");
Copy link
Member

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:

#377 (comment)

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);
Copy link
Member

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.

@awiddersheim
Copy link
Member

Was just about to merge this but looks like you have to merge master before I can.

@jrossi
Copy link
Member Author

jrossi commented Oct 20, 2014

@awiddersheim fixed the conflicts :) travis will be done in a few minutes.

awiddersheim added a commit that referenced this pull request Oct 20, 2014
seed random with a real random data
@awiddersheim awiddersheim merged commit 52bd182 into ossec:master Oct 20, 2014
@jrossi jrossi deleted the random-we-need-random branch October 21, 2014 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants