Thanks for the example. Yeah, my best idea so far was to look at existing examples, such as bss_mem.c. One question I still have is which of the BIO_CTRL_* commands does my ctrl function need to handle? bss_mem.c handles about a dozen of them, but the example you gave me only handles BIO_CTRL_FLUSH, so is that the only one I'm required to handle?
Phillip On Mon, Apr 12, 2010 at 10:15 AM, Howard Chu <h...@highlandsun.com> wrote: > Phillip Hellewell wrote: > >> Hi all, >> >> How do I implement my own BIO? Do I just create a function that returns a >> BIO_METHOD* with pointers to my custom functions? Is there any >> documentation >> on how to do this? >> >> I searched the mailing list and found that this question has been asked >> before >> but no one ever responds. The lack of documentation and responses leads >> me to >> believe that the BIO interface is not really meant to be used for >> user-defined >> I/O. >> >> 1999: http://marc.info/?l=ssl-users&m=91639275613495&w=2 >> <http://marc.info/?l=ssl-users&m=91639275613495&w=2> >> 2005: http://marc.info/?l=openssl-users&m=110624296809686&w=2 >> <http://marc.info/?l=openssl-users&m=110624296809686&w=2> >> 2008: http://marc.info/?l=openssl-dev&m=122959672906832&w=2 >> <http://marc.info/?l=openssl-dev&m=122959672906832&w=2> >> >> Please, at least will someone respond with one of the following: >> 1. "No, don't even try to do it. You're not supposed to." >> 2. "Yes, you can do it but no one is going to help you. Just look at some >> of >> the files in crypto/bio/ and see if you can figure it out." >> > > Some things are probably too easy to justify the time it takes to respond. > In this case, define a BIO_METHOD struct with your handlers and just use it. > > One example is in OpenLDAP's libldap/tls_o.c. > > > http://www.openldap.org/devel/cvsweb.cgi/~checkout~/libraries/libldap/tls_o.c?rev=1.16<http://www.openldap.org/devel/cvsweb.cgi/%7Echeckout%7E/libraries/libldap/tls_o.c?rev=1.16> > > -- > -- Howard Chu > CTO, Symas Corp. http://www.symas.com > Director, Highland Sun http://highlandsun.com/hyc/ > Chief Architect, OpenLDAP http://www.openldap.org/project/ >