Use Rand_Seed on windows?

2007-09-03 Thread Martin Salo
Hello Mailinglist,

in the OpenSSL documentation is written that I should initialize with 
RAND_seed() before using RSA_public_encrypt() and RSA_generate_key_ex(). But I 
havent found any good examples that show how to do this. (For Windows)

I found this example in the test folder over and over again. But it seems that 
this is only a dummy. 
static const char rnd_seed[] = string to make the random number generator 
think it has entropy;
RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */


What do you think if I use rand() from cstdlib.h to create a char* string and 
put it into RAND_seed():

const int SeedLen=100;
char RandSeed[SeedLen];
srand((unsigned)time(NULL));
for (int i=0; iSeedLen; i++)
RandSeed[i] = rand() % 256;

Or is there a better way to set rand_seed? I cannot bother a user with key 
input or else.
In some test applications I havent seen any rand_seed calls. So maybe it is not 
so important?


Regards

Martin
-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Use Rand_Seed on windows?

2007-09-03 Thread Dr. Stephen Henson
On Mon, Sep 03, 2007, Martin Salo wrote:

 Hello Mailinglist,
 
 in the OpenSSL documentation is written that I should initialize with
 RAND_seed() before using RSA_public_encrypt() and RSA_generate_key_ex(). But
 I havent found any good examples that show how to do this. (For Windows)
 

OpenSSL now uses several sources of entropy automatically on Windows so you
shouldn't need to do this yourself.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Use Rand_Seed on windows?

2007-09-03 Thread Martin Salo
Ok, thanks a lot :)


 Original-Nachricht 
 Datum: Mon, 3 Sep 2007 15:02:49 +0200
 Von: Dr. Stephen Henson [EMAIL PROTECTED]
 An: openssl-users@openssl.org
 Betreff: Re: Use Rand_Seed on windows?

 On Mon, Sep 03, 2007, Martin Salo wrote:
 
  Hello Mailinglist,
  
  in the OpenSSL documentation is written that I should initialize with
  RAND_seed() before using RSA_public_encrypt() and RSA_generate_key_ex().
 But
  I havent found any good examples that show how to do this. (For Windows)
  
 
 OpenSSL now uses several sources of entropy automatically on Windows so
 you
 shouldn't need to do this yourself.
 
 Steve.
 --
 Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
 OpenSSL project core developer and freelance consultant.
 Funding needed! Details on homepage.
 Homepage: http://www.drh-consultancy.demon.co.uk
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]