Konstantin Ivanov wrote:
I am developing a server application which is based on Windows IO Completion ports which basically means that the reads and write to the socket are asynchronous. This also means that I cannot use the SSL_read and SSL_write functions which are tied to the socket fd if I am correct. So I tried to use the BIO_read and BIO_write, but I am having difficulty in using it. Basically what I would like to do is to read the content passed from the client over SSL connection into the buffer, which I can decrypt using, parse, and then issue another read command on the completion port. For send, I would like to write data into an encrypted buffer and then post a send command to the completion port with the pointer to encrypted data. Can someone please comment on how I could implement such functionality as I believe I am suing the BIO_read and BIO_write incorrect (this was the tutorial that I referred to: http://h71000.www7.hp.com/doc/83final/ba554_90007/ch04s03.html) Thanks,
BIOs should be used for overlapped IO. Your BIO layer is responsible for allocating and pinning chunks of memory while the OS has the IO in progress and then getting IO completion signals and unpinning/deallocating that memory.
Like all good programs your BIO should track the total amount of memory in use by a single socket and place arbitrary limits so that the correct soft-error returns can be provided to effect flow-control.
Of course you _CAN_ still use SSL_read() and SSL_write(). Those two functions are for managing clear-text (aka application data) in relation to the SSL communications stream. The API from the point-of-view should work in a useful way even with overlapped IO.
With overlapped IO you create your own BIO layer (which is the buffering layer underneath the OpenSSL library. You then use this instead of the default "BIO socket" implementation. Your BIO is only handling cypher-text data and its job is to effect flow-control, buffering and conveyance of the cypher-text data to the other end of the connection.
If you really want assistance with overlapped IO then I suggest you create a new thread for it.
If you are having major problems with overlapped IO why don't you used regular sockets first get your code working on that. You can upgrade your code to use overlapped IO later but all of the code that handlers clear-text can remain the same (you won't need to re-work it). Overlapped IO is the Windows performance networking solution does your application even need that find of performance ? Are you moving large amounts of bulk-data around ?
Darryl ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org