[xmlsec] [Patch] Key / Certificate loading from memory

Joachim Bauch bauch@struktur.de
Thu, 07 Aug 2003 12:37:34 +0200


Hi Aleksey,

On Thu, 07 Aug 2003 02:15:38 -0700, Aleksey Sanin <aleksey@aleksey.com> wrote:
> Thanks for the patch! It looks ok to me and I would've applied it immidiately
> but there is one small thing I would like to improve. Both functions for reading
> keys from file and from memory looks like this:
>
> 1) create BIO (file or memory)
> 2) do a bunch of stuff
>
> I think that the right approach would be to create xmlSecOpenSSLAppKeyLoadBio ()
> function that does 2) and have trivial functions xmlSecOpenSSLAppKeyLoad() and
> xmlSecOpenSSLAppKeyLoadMemory(). There is one minor issue with pkcs12 files
> that do not use BIO now but I think it could be done the same way too. I think that
> this would make code a little bit more simple :) Let me know of you would like to do
> this change. Otherwise I probably can do it tomorrow night.
Yes, I already saw this and am currently working on it, so I can send the
patch to you when I'm done.

> And I am not sure I see the memory leak fix you mentioned. Which function is it in?
The memory leak is in "xmlSecOpenSSLAppKeyCertLoad" of src/openssl/app.c
When the call to "xmlSecOpenSSLKeyDataX509AdoptCert" failes, an error gets
returned, but the "cert" variable doesn't get freed.

Joachim

-- 
Joachim Bauch

struktur AG             Fon.:  +49 (0)711 896656 69
Junghansstr. 5          Fax.:  +49 (0)711 896656 10
D-70469 Stuttgart       eMail: bauch@struktur.de                    solutions for
Germany                 Web:   http://www.struktur.de            digital business

Download icoya OpenContent 1.3 for FREE!    visit http://www.icoya.de/iOC4free <-