[Olsr-dev] [PATCH v1 1/4] main: do not seed the random number generator with the process id

Henning Rogge (spam-protected)
Sat Nov 10 10:09:06 CET 2012


Sorry, this patch makes no sense.

you call srandom() to add some entropy to the random number generator.
You cannot get the entropy from the random number generator itself.

But we could use "time()" for getting entropy.

Henning

On Fri, Nov 9, 2012 at 5:59 PM, Ferry Huberts <(spam-protected)> wrote:
> From: Ferry Huberts <(spam-protected)>
>
> This is entirely too predictable
>
> Signed-off-by: Ferry Huberts <(spam-protected)>
> ---
>  src/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/main.c b/src/main.c
> index 2ba0757..014d2db 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) {
>    olsr_openlog("olsrd");
>
>    /* Using PID as random seed */
> -  srandom(getpid());
> +  srandom(random());
>
>    /* Init widely used statics */
>    memset(&all_zero, 0, sizeof(union olsr_ip_addr));
> --
> 1.7.11.7
>



-- 
Steven Hawkings about cosmic inflation: "An increase of billions of
billions of percent in a tiny fraction of a second. Of course, that
was before the present government."




More information about the Olsr-dev mailing list