CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2009
    Posts
    2

    Programming socket IOCP with OpenSSL

    Hi all,
    I'm current deverlop a server which use asyn socket (use IOCP), and now i want to add OpenSSL authentication in my socket. But in my socket, methold WSASend() don't like methold SSL_write which I used.
    Do you have any idea for me?
    Thanks in advance!!

  2. #2
    Join Date
    May 2007
    Posts
    11

    Re: Programming socket IOCP with OpenSSL

    http://linux.die.net/man/3/bio_s_bio

    One typical use of BIO pairs is to place TLS/SSL I/O under application control, this can be used when the application wishes to use a non standard transport for TLS/SSL or the normal socket routines are inappropriate.
    Last edited by Grober; December 31st, 2009 at 02:54 AM.

  3. #3
    Join Date
    Dec 2009
    Posts
    2

    Re: Programming socket IOCP with OpenSSL

    Thanks for reply,
    Can you explain about BIO pairs and how to use it with WSASend() and WSARecv()?
    Best regards,

  4. #4
    Join Date
    May 2007
    Posts
    11

    Re: Programming socket IOCP with OpenSSL

    [Referring to the example code from the BIO_s_bio manpage]

    After WSARecv completion make the data available to the SSL engine by using BIO_write(network_bio, ..., ...).

    With BIO_read(network_bio, ..., ...) you can read the data from the engine and send it via WSASend.
    Last edited by Grober; January 6th, 2010 at 11:41 AM.

  5. #5
    Join Date
    Jan 2010
    Posts
    2

    Re: Programming socket IOCP with OpenSSL

    I wrote an article for Windows Developer Magazine back in 2002 which showed how to use OpenSSL BIO pairs to write an SSL adapter for an MFC async socket. The article and code are here: http://www.lenholgate.com/archives/000456.html. This should show you what you need to do to use overlapped IOCP sockets with OpenSSL - in fact this was the test project which I developed whilst working on the ideas that eventually went into our licensed IOCP framework's OpenSSL support (see here (http://www.lenholgate.com/ServerFram...licensing.html), if you're interested in the framework)

  6. #6
    Join Date
    May 2007
    Posts
    11

    Re: Programming socket IOCP with OpenSSL

    Your example shows the usage of memory bio.

  7. #7
    Join Date
    Jan 2010
    Posts
    2

    Re: Programming socket IOCP with OpenSSL

    That's true, either way, it works and the example provides a compilable and working solution to the problem which is equally applicable to the IOCP situation.

    I seem to remember that there was an issue with using a BIO pair at the time; but looking at the man page now it seems that perhaps it was simply that I didn't understand that you needed to free the network bio yourself but that the internal bio was freed for you... It was a long time ago...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured