In message <[EMAIL PROTECTED]> on Thu, 04 Dec 2003 20:23:07 +0000, "banti modi" 
<[EMAIL PROTECTED]> said:

bantimodi> I am new to openSSL i am trying to generate a random DES
bantimodi> key i get segmentation fault. I m using following code
bantimodi> 
bantimodi> 
bantimodi> int main()
bantimodi> {
bantimodi> int iStatus = RAND_status();
bantimodi> 
bantimodi> if(iStatus != 1)
bantimodi> {
bantimodi>    return 0;
bantimodi> }
bantimodi> //This means that PRNG is seeded
bantimodi> DBS_cblock* pKey;
bantimodi> DES_random_key(pKey);
bantimodi> }
bantimodi> 
bantimodi> here RAND_status() function returns 1 so PRNG is seeded then why 
bantimodi> DES_random_key is throwing an error???

Because pKey is pointing at something unknown.  Before the call to
DES_random_key(), you need to do this:

        pKey = (DES_cblock *)malloc(sizeof(DES_cblock));

This is basic C knowledge.

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.
You don't have to be rich, a $10 donation is appreciated!

-- 
Richard Levitte   \ Tunnlandsvägen 3  \ [EMAIL PROTECTED]
[EMAIL PROTECTED]  \ S-168 36  BROMMA  \ T: +46-8-26 52 47
                    \      SWEDEN       \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis                -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]
  • [no subject] banti modi
    • RE: Pierre Gauthier
    • Richard Levitte - VMS Whacker

Reply via email to