Question regarding use of SSL_get_ex_new_index
This is a multipart message in MIME format.
------=_NextPart_000_006D_01C88DD5.D985BC70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi,
I have an application that creates a bunch of SSL connections during its
life. For each of these connections, I have to store "application data" in
an SSL object (in my case this is SSL_client object). The trouble is that
the memory allocated in the SSL_get_ex_new_index is never freed until the
end of the application. I am tracking this through valgrind and can create a
simple test case if that would help, but I think my problem is simply
misusing the API.
My question is how can I use SSL_get_ex_new_index such that I can free
memory once the SSL connection closes? Should I be re-using the index
returned instead of calling the function multiple times - after all I have a
new SSL_client object each time?
I have tried setting the function pointers in the SSL_get_ex_new_index, but
for some reason the callbacks are never called. Moreover the memory leaked
is not an allocation that I have made and thus am unable to free it even if
they were called. I have made sure that I am calling all the SSL freeing
routines .. SSL_close, SSL_free etc.
Any help will be greatly appreciated. I have read the following man pages to
no avail:
[url]http://www.openssl.org/docs/ssl/SSL_get_ex_new_index.html[/url]
[url]http://www.openssl.org/docs/crypto/RSA_get_ex_new_index.html[/url]
[url]http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html[/url]
The example in the man page SSL_CTX_set_verify is more or less what I am
trying to do.
Thanks for taking the time to read through and looking forward for some
tips.
Regards,
Amit Sharma
------=_NextPart_000_006D_01C88DD5.D985BC70
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:x=3D"urn:schemas-microsoft-com:office:excel" =
xmlns:p=3D"urn:schemas-microsoft-com:office:powerpoint" =
xmlns:a=3D"urn:schemas-microsoft-com:office:access" =
xmlns:dt=3D"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" =
xmlns:s=3D"uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" =
xmlns:rs=3D"urn:schemas-microsoft-com:rowset" xmlns:z=3D"#RowsetSchema" =
xmlns:b=3D"urn:schemas-microsoft-com:office:publisher" =
xmlns:ss=3D"urn:schemas-microsoft-com:office:spreadsheet" =
xmlns:c=3D"urn:schemas-microsoft-com:office:component:spreadsheet" =
xmlns:oa=3D"urn:schemas-microsoft-com:office:activation" =
xmlns:html=3D"http://www.w3.org/TR/REC-html40" =
xmlns:q=3D"http://schemas.xmlsoap.org/soap/envelope/" xmlns:D=3D"DAV:" =
xmlns:x2=3D"http://schemas.microsoft.com/office/excel/2003/xml" =
xmlns:ois=3D"http://schemas.microsoft.com/sharepoint/soap/ois/" =
xmlns:dir=3D"http://schemas.microsoft.com/sharepoint/soap/directory/" =
xmlns:ds=3D"http://www.w3.org/2000/09/xmldsig#" =
xmlns:dsp=3D"http://schemas.microsoft.com/sharepoint/dsp" =
xmlns:udc=3D"http://schemas.microsoft.com/data/udc" =
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" =
xmlns:sub=3D"http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"=
xmlns:ec=3D"http://www.w3.org/2001/04/xmlenc#" =
xmlns:sp=3D"http://schemas.microsoft.com/sharepoint/" =
xmlns:sps=3D"http://schemas.microsoft.com/sharepoint/soap/" =
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" =
xmlns:udcxf=3D"http://schemas.microsoft.com/data/udc/xmlfile" =
xmlns:wf=3D"http://schemas.microsoft.com/sharepoint/soap/workflow/" =
xmlns:mver=3D"http://schemas.openxmlformats.org/markup-compatibility/2006=
" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns:mrels=3D"http://schemas.openxmlformats.org/package/2006/relationshi=
ps" =
xmlns:ex12t=3D"http://schemas.microsoft.com/exchange/services/2006/types"=
=
xmlns:ex12m=3D"http://schemas.microsoft.com/exchange/services/2006/messag=
es" xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
..MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:1893033937;
mso-list-type:hybrid;
mso-list-template-ids:102692846 67698705 67698713 67698715 67698703 =
67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal>Hi,<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>I have an application that creates a bunch of SSL
connections during its life. For each of these connections, I have to =
store “application
data” in an SSL object (in my case this is SSL_client object). =
The
trouble is that the memory allocated in the SSL_get_ex_new_index is =
never freed
until the end of the application. I am tracking this through valgrind =
and can
create a simple test case if that would help, but I think my problem is =
simply
misusing the API.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>My question is how can I use SSL_get_ex_new_index =
such that
I can free memory once the SSL connection closes? Should I be re-using =
the
index returned instead of calling the function multiple times – =
after all
I have a new SSL_client object each time? <o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>I have tried setting the function pointers in the =
SSL_get_ex_new_index,
but for some reason the callbacks are never called. Moreover the memory =
leaked
is not an allocation that I have made and thus am unable to free it even =
if
they were called. I have made sure that I am calling all the SSL freeing
routines .. SSL_close, SSL_free etc.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>Any help will be greatly appreciated. I have read =
the following
man pages to no avail:<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal><a
href=3D"http://www.openssl.org/docs/ssl/SSL_get_ex_new_index.html">http:/=
/www.openssl.org/docs/ssl/SSL_get_ex_new_index.html</a><o:p></o:p></p>
<p class=3DMsoNormal><a
href=3D"http://www.openssl.org/docs/crypto/RSA_get_ex_new_index.html">htt=
p://www.openssl.org/docs/crypto/RSA_get_ex_new_index.html</a><o:p></o:p><=
/p>
<p class=3DMsoNormal><a
href=3D"http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html">[url]http://w=[/url]
ww.openssl.org/docs/ssl/SSL_CTX_set_verify.html</a><o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>The example in the man page SSL_CTX_set_verify is =
more or
less what I am trying to do.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>Thanks for taking the time to read through and =
looking
forward for some tips.<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal>Regards,<o:p></o:p></p>
<p class=3DMsoNormal>Amit Sharma<o:p></o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
<p class=3DMsoNormal><o:p> </o:p></p>
</div>
</body>
</html>
------=_NextPart_000_006D_01C88DD5.D985BC70--
______________________________________________________________________
OpenSSL Project [url]http://www.openssl.org[/url]
User Support Mailing List [email]openssl-users@openssl.org[/email]
Automated List Manager [email]majordomo@openssl.org[/email]