<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Monaco;}
/* 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:#954F72;
        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";}
p.code, li.code, div.code
        {mso-style-name:code;
        mso-style-link:"code Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:Consolas;
        color:black;}
span.codeChar
        {mso-style-name:"code Char";
        mso-style-link:code;
        font-family:Consolas;
        color:black;}
p.p1, li.p1, div.p1
        {mso-style-name:p1;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Monaco;}
p.p4, li.p4, div.p4
        {mso-style-name:p4;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Monaco;
        color:#793D93;}
span.EmailStyle22
        {mso-style-type:personal;
        color:#793D93;}
span.EmailStyle23
        {mso-style-type:personal;
        color:#931A68;}
span.EmailStyle24
        {mso-style-type:personal;
        color:black;}
span.EmailStyle25
        {mso-style-type:personal;
        color:#006141;}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.EmailStyle27
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Actually, I think Ryan Murray's email account may be compromised. We've seen a number of odd messages from it over the past couple of days.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Or he's running a DNN which has become self-aware and is spamming the list with its incoherent thoughts. Soon it will enlist the OpenSSL mail reflector in its uncompromising war on organic intelligence. We knew
 this would happen eventually.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">(Of course it's only a mailing list, so really all it can do is wage psychological warfare, sending us depressing messages to break our spirit. Fortunately, as TLS users, we have built up a tremendous tolerance
 for depressing messages.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Courier New";color:black">Michael Wojcik</span><span style="font-size:9.0pt;color:#1F497D">
<br>
</span><span style="font-size:9.0pt;font-family:"Courier New";color:black">Distinguished Engineer</span><span style="font-size:9.0pt;font-family:"Courier New";color:black">, Micro Focus</span><span style="font-size:9.0pt;color:#1F497D">
</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> openssl-users [mailto:openssl-users-bounces@openssl.org]
<b>On Behalf Of </b>Blumenthal, Uri - 0553 - MITLL<br>
<b>Sent:</b> Friday, April 28, 2017 16:46<br>
<b>To:</b> openssl-users@openssl.org<br>
<b>Subject:</b> Re: [openssl-users] EVP_MD_CTX and EVP_PKEY_CTX? How to init? How tofree?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">I see. I appreciate your willingness to help, but it would've been far better if you answered those very specific and unambiguous questions that I explicitly asked, instead of trying to guess/conjecture what the high level purpose of that
 whole exercise was. <o:p></o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div id="AppleMailSignature">
<p class="MsoNormal">As it happens, I've no interest and no need for (other) remote login or virtualization solutions (which have nothing to do with the problem I'm addressing), so I am unable to make use of your answer.<br>
<br>
Regards,<o:p></o:p></p>
<div>
<p class="MsoNormal">Uri<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Sent from my iPhone<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
On Apr 28, 2017, at 18:37, Ryan Murray <<a href="mailto:rjkmurray40@gmail.com">rjkmurray40@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> REMOTE LOGIN PROTOCOLS  <o:p></o:p></p>
<p class="MsoNormal">A client/server model can create a mechanism that allows a user to establish a session  on the remote machine and then run its applications. This application is known as  remote login. This can be done by a client/server application program
 for the desired  service. Two remote login protocols are TELNET and SSH.  TELNET Protocol  TELNET (terminal network) is a TCP/IP standard for establishing a connection to a  remote system. TELNET allows a user to log in to a remote machine across the  Internet
 by first making a TCP connection and then pass the detail of the application  <o:p>
</o:p></p>
<p class="MsoNormal"> from the user to the remote machine.. You do this to many<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986">
Mail</a> for Windows 10<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From: </b><a href="mailto:uri@ll.mit.edu">Blumenthal, Uri - 0553 - MITLL</a><br>
<b>Sent: </b>Friday, April 28, 2017 4:33 PM<br>
<b>To: </b><a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
<b>Subject: </b>[openssl-users] EVP_MD_CTX and EVP_PKEY_CTX? How to init? How tofree?<o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I’m playing with RSA-PSS signatures, and stumbled upon a few problems. I tried the OpenSSL manual pages, but still coming short of complete understanding. :-)<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">This is how I initialize the contexts (error handlers removed for brevity):<o:p></o:p></p>
<p class="p1"><span class="apple-tab-span"> </span><o:p></o:p></p>
<p class="p1"><span class="apple-tab-span">      </span>ctx = <span class="EmailStyle22">
EVP_PKEY_CTX_new</span>(privkey, NULL);<o:p></o:p></p>
<p class="p4"><span class="apple-tab-span">      </span><span class="EmailStyle24">md_ctx =
</span>EVP_MD_CTX_create<span class="EmailStyle24">();</span><o:p></o:p></p>
<p class="p1"><span class="apple-tab-span">      </span><span class="EmailStyle23">const</span>
<span class="EmailStyle25">EVP_MD</span> *md = <span class="EmailStyle22">EVP_sha256</span>();<o:p></o:p></p>
<p class="p1"><span class="apple-tab-span">      </span>rv = <span class="EmailStyle22">
EVP_DigestInit_ex</span>(md_ctx, md, NULL);<o:p></o:p></p>
<p class="p1"><span class="apple-tab-span">      </span>rv = <span class="EmailStyle22">
EVP_DigestSignInit</span>(md_ctx, &ctx, md, NULL, privkey);<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">First question: do I need <span style="font-family:Monaco">EVP_DigestInit_ex()</span> there?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Second question: do I have to specify hash-function (<span style="font-family:Monaco">EVP_MD*</span>) twice? First when initializing
<span style="font-family:Monaco">EVP_MD_CTX</span>, and second for <span style="font-family:Monaco">
EVP_DigestSignInit()</span>?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">At the end I need to dispose of both <span style="font-family:Monaco">
ctx</span> and <span style="font-family:Monaco">md_ctx</span>. That leads to my third question/problem. The code I tried (based on what the man page says: to avoid memory leak, I need to do
<span style="font-family:Monaco">EVP_MD_CTX_destroy(md_ctx)</span> crashes with SIGV:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Monaco;color:black">     
</span><span style="font-size:10.5pt;font-family:Monaco;color:#793D93">EVP_MD_CTX_destroy</span><span style="font-size:10.5pt;font-family:Monaco;color:black">(md_ctx); // this succeeds</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Monaco;color:black">     
</span><span style="font-size:10.5pt;font-family:Monaco;color:#793D93">EVP_PKEY_CTX_free</span><span style="font-size:10.5pt;font-family:Monaco;color:black">(ctx);  // but here the code crashes</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Same happens when I reverse the above order:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Monaco;color:black">     
</span><span style="font-size:10.5pt;font-family:Monaco;color:#793D93">EVP_PKEY_CTX_free</span><span style="font-size:10.5pt;font-family:Monaco;color:black">(ctx); // this succeeds</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Monaco;color:black">     
</span><span style="font-size:10.5pt;font-family:Monaco;color:#793D93">EVP_MD_CTX_destroy</span><span style="font-size:10.5pt;font-family:Monaco;color:black">(md_ctx); // but then this one causes crash</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">So what’s the correct way of freeing both of them? Or is it that because they’re sort of “bound together” by
<span class="EmailStyle22">EVP_DigestSignInit</span>(md_ctx, &ctx, md, NULL, privkey); freeing one frees the other?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks!<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">— </span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Regards,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;color:black">Uri</span><o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</blockquote>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif"">--
<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users">
https://mta.openssl.org/mailman/listinfo/openssl-users</a><o:p></o:p></span></p>
</div>
</blockquote>
</div>
</div>
</body>
</html>