On Tue, Jul 08, 2008, Sanjith Chungath wrote:

> Hi all,
>        We are trying to use openssl 0.9.8g with our application on various
> platforms. we are facing an issue now.
> 
> while creating a keystore as shown in below function (I have included only
> relevant portions of the function) the application got crashed at free()
> (msvcr80.dll).
> 
> what i feel is that it is because of either    ERR_free_strings() or
> ERR_remove_state(0) or EVP_cleanup();.
> 
> Please note that we are calling the below function from inside a loop in
> another function. the crash happens when the below code executes for the
> second time. Also the below functin will be resolved on a .dll which is
> loaded by a single threaded (C) application.
> 

For efficiency reasons you shouldn't call the library startup and shutdown
functions in a loop. They should be called once when the application starts
and once when it closes down.

Library startup functions:


> 
>    CRYPTO_malloc_init();
>    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

Above is not needed unless you check for memory leaks.

>    SSLeay_add_all_algorithms();

Above should be OpenSSL_add_all_algorithms().

>    ERR_load_crypto_strings();
> 
> 

And the library shutdown functions:


>    CRYPTO_cleanup_all_ex_data();
>    ERR_free_strings();
>    ERR_remove_state(0);
>    EVP_cleanup();

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

Reply via email to