[xmlsec] Why seeding the random generator in Example 1

Hans-Juergen.Heinrich@de.gi-de.com Hans-Juergen.Heinrich@de.gi-de.com
Mon, 8 Jul 2002 13:37:57 +0200


Hi,

Unfortunately, I do not understand why the random generator
of OpenSSL has to be seeded in Example 1 on the xmlsec website.
The code is as follows:
                                                                       =
    =20
 int rnd_seed =3D 0;                                                   =
      =20
                                                                       =
    =20
 =A0=A0=A0 /**                                                         =
          =20
 =A0=A0=A0=A0 * Init OpenSSL:                                          =
            =20
 =A0 =A0 =A0* this is a BAD way to init random numbers                 =
          =20
 =A0 =A0 =A0* generator                                                =
          =20
 =A0=A0=A0=A0 */                                                       =
            =20
 =A0=A0=A0 while (RAND_status() !=3D 1) {                              =
            =20
 =A0=A0=A0 RAND_seed(&rnd_seed, sizeof(rnd_seed));                     =
          =20
 =A0=A0=A0 }                                                           =
          =20
                                                                       =
    =20




Is this really necessary here, or is it just the default way
to initialize OpenSSL? I can't see where the random generator is
used in the example, and I just want to make sure I didn't miss
anything important. If it was not necessary, one wouldn't need to
include the openssl-headerfiles at all.

Thank you for your help
Hans-Juergen

----------------------------------
Dr. Hans-J=FCrgen Heinrich
System engineer, 4TE3
Giesecke & Devrient GmbH, Truderinger Stra=DFe 15, D-81607 M=FCnchen
Phone:  +49 89 4119-2625, FAX:     +49 89 4119-1629
mailto:hans-juergen.heinrich@de.gi-de.com
http://www.gieseckedevrient.com=