Re: undefined behaviour in add_entropy_words()

2016-02-19 Thread Martin Natano
On Thu, Feb 18, 2016 at 09:11:18PM +0100, Stefan Kempf wrote: > > I think we don't mix declarations and code. > Would this be an option? > > diff --git a/dev/rnd.c b/dev/rnd.c > index 819ce0d..0f57b1b 100644 > --- a/dev/rnd.c > +++ b/dev/rnd.c > @@ -421,7 +421,7 @@ add_entropy_words(const u_int3

Re: undefined behaviour in add_entropy_words()

2016-02-18 Thread Stefan Kempf
Martin Natano wrote: > Hi, > > The add_entropy_words() function performs a right shift by > (32 - entropy_input_rotate) bits, with entropy_input_rotate being an > integer between [0..31]. This can lead to a shift of 32 on a 32 bit > value, which is undefined behaviour in C. The standard says this:

undefined behaviour in add_entropy_words()

2016-01-31 Thread Martin Natano
Hi, The add_entropy_words() function performs a right shift by (32 - entropy_input_rotate) bits, with entropy_input_rotate being an integer between [0..31]. This can lead to a shift of 32 on a 32 bit value, which is undefined behaviour in C. The standard says this: "If the value of the right opera