Greetings.

There is a structure in openssl, named EVP_MD_CTX.
Unfortunately, it is not handled the same way all other structures are -
it's usually not allocated dynamicaly, and there's no 
EVP_MD_CTX_new and EVP_MD_CTX_free functions;

That was probably ok with most people, because they
didn't have to use external hashing modules/devices,
which require additional resources, such as handles to
their hashing contexts. 
The problem is, that EVP_MD_CTX is usually cleared
by memset, if cleared at all.
And this causes resource/memory leaks in case when handles
or pointers are stored in the context;

We solved the problem by adding functions 
EVP_MD_CTX_init and EVP_MD_CTX_cleanup,
which should be called for every EVP_MD_CTX variable
before and after using it, accordingly.
Other way would be to create EVP_MD_CTX_new and 
EVP_MD_CTX_free instead; That would better fit
into openssl style, but would require more changes.

What i would like to ask is, should i post a patch
of this fix, and which method is preferred - 
EVP_MD_CTX * EVP_MD_CTX_new();
or 
int EVP_MD_CTX_init (EVP_MD_CTX *);
--
Gregory S. Chudov, Software Engineer, MDPREI company


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to