ntp_random - please check

Eric S. Raymond esr at thyrsus.com
Sat Jul 7 03:48:20 UTC 2018


Hal Murray via devel <devel at ntpsec.org>:
> Would somebody please eyeball these changes.  Thanks.
> 
> -       unsigned char rnd[sizeof(uint32_t)];
> -       RAND_bytes(rnd, sizeof(rnd));
> -       return (int32_t)ntp_be32dec(rnd);
> 
> +       int err;
> +       uint32_t rnd;
> +       err = RAND_bytes((unsigned char *)&rnd, sizeof(rnd));
> +       if (1 != err) {
> +               msyslog(LOG_ERR, "ERR: ntp_random - RAND_bytes failed");
> +         exit(1);
> +       }
> +       return rnd;

That looks reasonable.  However, I am not an expert on crypto and randomness.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.




More information about the devel mailing list