prng_cmds/init_rng() question/patch

Jon Peatfield J.S.Peatfield at damtp.cam.ac.uk
Mon Mar 12 05:51:36 EST 2001


I have a need to provide ssh client binaries for use elsewhere on
several platforms, some without /dev/random support.  I can't assume
that users will know how to install/run prngd or egd, so I was
planning to rely on the builtin prng code.  However this require the
ssh_prng_cmds file to exist in a fixed location -- which would mean
making binaries which either look for it in . or other similar hacks.

To avoid this I altered entropy.c to include a copy (as a string) of
the ssh_prng_cmds generated by configure and use that if the file
can't be opened -- at a cost of about +2K to the client size..  (I
considered having a command line option to specify the location but
that would mean changes in too many other places).

Having got some working code, it took me some time to spot that
debug/verbose do nothing in init_rng() since it is called before
options processing.  It is also called before giving up any privelage.
Is this right?  Would it be safe to move the call to init_rng() to
later when we have options and have dropped priv?  I don't know which
calls need the rng to have already been initialized.

My current patch possibly isn't the right way to do some of this (like
the generation of the string from the ssh_prng_cmds file or the hack
function I dropped in the place of the fgets() call).
[ I'm not including the patch itself in case there is already a better
solution. ]

-- 
Jon Peatfield,  DAMTP,  Computer Officer,   University of Cambridge
Telephone: +44 1223  3 37852    Mail: J.S.Peatfield at damtp.cam.ac.uk





More information about the openssh-unix-dev mailing list