<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Showing the contents of the error queue would help, but it seems
      most likely that what is going on is that I overlooked the fact
      that BIO_new_mem_buf() makes a read-only BIO.  I'm not sure
      offhand that there's a way to get a writeable BIO using
      application-supplied buffers; maybe someone else on the list
      knows.<br>
      <br>
      -Ben<br>
    </tt><br>
    <div class="moz-cite-prefix">On 10/13/2016 05:04 AM, Ajay Garg
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHP4M8UV8k1SbX7cunY+snWBimcO2bJ_2Gxf4-LxuCG9qhp7Sw@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div dir="ltr">
        <div>
          <div>Thanks Ben for the reply.<br>
            <br>
          </div>
          I tried the following, and the code hits the block as
          commented ::<br>
          <br>
          <br>
###########################################################################<br>
          static char inter_bio_buf[1000];<br>
          static char network_bio_buf[1000];<br>
          <br>
          {<br>
                  BIO *inter_bio_buf_bio = NULL, *network_bio_buf_bio =
          NULL;<br>
          <br>
                  inter_bio_buf_bio = BIO_new_mem_buf(inter_bio_buf,
          sizeof(inter_bio_buf));<br>
                  if(inter_bio_buf_bio == NULL)<br>
                  {<br>
        </div>
                    /* Control does not reach here. */<br>
        <div>        }<br>
          <br>
                  network_bio_buf_bio = BIO_new_mem_buf(network_bio_buf,
          sizeof(network_bio_buf));<br>
                  if(network_bio_buf_bio == NULL)<br>
                  {<br>
                      /* Control does not reach here. */<br>
                  }<br>
          <br>
                  if(!BIO_make_bio_pair(inter_bio_buf_bio,
          network_bio_buf_bio))<br>
                  {<br>
                      /* CONTROL REACHES HERE. */<br>
                  }<br>
          }<br>
############################################################################<br>
          <br>
        </div>
        <div>What am I doing wrong?<br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Oct 12, 2016 at 12:59 AM,
          Benjamin Kaduk <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:bkaduk@akamai.com" target="_blank">bkaduk@akamai.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"><span class=""> On
                10/11/2016 02:06 PM, Ajay Garg wrote:<br>
                <blockquote type="cite">
                  <div dir="ltr"><span
                      style="font-family:arial,helvetica,sans-serif">Hi
                      All.<br>
                      <br>
                    </span>
                    <div><span
                        style="font-family:arial,helvetica,sans-serif"><br>
                      </span></div>
                    <div><span
                        style="font-family:arial,helvetica,sans-serif">a)<br>
                      </span></div>
                    <div><span
                        style="font-family:arial,helvetica,sans-serif">In
                        the call,<br>
                      </span>
                      <pre class="m_8947789158244903202gmail-code"><span style="font-family:arial,helvetica,sans-serif">                      int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2);

are internal-buffers malloc'ed for each of "bio1" and "bio2"?
</span></pre>
                      <pre class="m_8947789158244903202gmail-code"><span style="font-family:arial,helvetica,sans-serif">If yes, is there a way to pass buffers from the application-layer?
I ask this, because not all systems possess dynamic-memory allocation (or at least "malloc" is not available on all systems).

</span></pre>
                      <pre class="m_8947789158244903202gmail-code"><span style="font-family:arial,helvetica,sans-serif">b)
Irrespective of the values of "writebuf1" and "writebuf2" in a), I see that everything works perfect.
So, there's got to be some internal-buffer that manages the complete ssl-packet, most probably instantiated via the call

                      BIO* BIO_new(BIO_f_ssl());

</span></pre>
                      <pre class="m_8947789158244903202gmail-code"><span style="font-family:arial,helvetica,sans-serif">Here too, is it possible to pass the buffer from application-layer (because of same reasons as above)?</span>
</pre>
                    </div>
                  </div>
                </blockquote>
                <br>
                <br>
              </span> You should be able to produce the desired effect
              with BIO_new_mem_buf() (twice) and attaching the resulting
              BIOs to each other with BIO_make_bio_pair().<br>
              <br>
              -Ben<br>
            </div>
            <br>
            --<br>
            openssl-users mailing list<br>
            To unsubscribe: <a moz-do-not-send="true"
href="https://urldefense.proofpoint.com/v2/url?u=https-3A__mta.openssl.org_mailman_listinfo_openssl-2Dusers&d=DQMFaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=sssDLkeEEBWNIXmTsdpw8TZ3tAJx-Job4p1unc7rOhM&m=yIux2i-e8M_BBOxWlCVHTS64upD1U_SZKodwVOZEwVk&s=wUc5DIv6EgcKaU921dtXrZxxtZnY6A8gCDQF9Zt-tSs&e="
              rel="noreferrer" target="_blank">https://mta.openssl.org/<wbr>mailman/listinfo/openssl-users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <br>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">Regards,<br>
          Ajay<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    <br>
  </body>
</html>