On Sat, Jan 16, 2010 at 12:33:47PM -0500, Adam Grossman wrote:

> These are the steps i am taking:
> 
> SSL_set_fd(ssl_data->ssl_ssl, sock_fd);

No, you do not associate the network socket with the SSL engine,
your app copies data back and forth between the SSL engine network
bio and the socket. SSL knows nothing about the socket.
the network (bio).

> sslbio=SSL_get_rbio(ssl_data->ssl_ssl);
> 
> internalBIO=BIO_new(BIO_s_bio());
> BIO_set_write_buf_size(internalBIO, 1024);

This buffer size will lead to Nagle delays, use a buffer at least as
large as the interface MTU. ALso this is not the *internal* BIO, it
the "network" bio. The "internal" bio is the "sslbio".

> BIO_make_bio_pair(sslbio,internalBIO);

I've always seen code that creates both bios as new, and uses
SSL_set_bio to assign the internal bio to the SSL connection.

> size=read(sock_fd,buffer,128);  // returns as read 128
> size=BIO_write(sslbio,buffer,size); // returns as written 128 

No, you don't write to the ssl bio, you write to the "network" bio
(which you called "internal").

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to