Setting the update in my init() revealed other problems but I think I can work 
around them.

In EVP_MD_CTX_copy_ex() it copies the entire source EVP_MD_CTX to destination 
with this line: memcpy(out,in,sizeof *out);
Then it later calls out->digest->copy(out,in);
When It gets to my copy() callback both source and destination have the same 
md_data pointer.
So I am going to have to assume that the destination md_data pointer is 
actually garbage and ignore it.

It's going to take me some time to modify all my engine's digest 
implementations and fully test this.
--
Robert Dugal            Senior Software Developer
Certicom Corp.          A Subsidiary of Research In Motion
[email protected]
direct        905.501.3848
fax             905.507.4230
www.certicom.com


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Dr. Stephen Henson
Sent: Thursday, November 25, 2010 12:24 PM
To: [email protected]
Subject: Re: memory leak in HMAC_Final() when using my ENGINE

On Thu, Nov 25, 2010, Robert Dugal wrote:

> Doesn't work. Causes a segfault in EVP_DigestUpdate() because the ctx->update 
> pointer is NULL.
> This is because without type->ctx_size being nonzero the update method is not 
> set in EVP_DigestInit_ex().
> See this code in EVP_DigestInit_ex()
>

Can you initialise it in your init() callback?

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to