[U-Boot] [PATCH v4 1/3] lib: add rand() function

Wolfgang Denk wd at denx.de
Fri May 11 23:11:32 CEST 2012


Dear Michael Walle,

please keep the ML on Cc: - thanks.

In message <201205112249.27871.michael at walle.cc> you wrote:
>
> > > > > +static unsigned int y = 2463534242U;
> > > > 
> > > > Hm... can we introduce at least a little entropy somewhere?
> > > 
> > > Mh? A user is supposed to seed via srand().
> > 
> > Then why initialize y at all?
> To have a sane fallback. Maybe i should have written
>  "A user is supposed to seed via srand() if he wan't some 
> entropy."

This is inconsequent.  Either we assume that the user will seed
srand(), then y should not be initialized at all, so it goes to the
BSS segment and does not waste space in the binary image.  Or we want
to deal with cases where the user doesn call srand(), and then we
should provide a bit better than such a static initialization.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.


More information about the U-Boot mailing list