cjs2895> My task is to read a varible length stream of bytes from a socket,
cjs2895> then attempt to accept an SSL connection on the same socket. The
cjs2895> problem is that in reading the leader bytes from the socket, I'm
cjs2895> capturing the first few bytes of the SSL handshake. I think the
[...]
cjs2895> this point. Could someone help clearify what I need to do
cjs2895> to accomplish my task?
An alternative to fiddling with the BIO structure is to use the
MSG_PEEK option with recv(). I've done that to implement a secure
proxy.
Roughly, you do this:
char bigpack[32768];
size_t packlen;
size_t prefixlen;
packlen = recv(sock, bigpack, sizeof bigpack, MSG_PEEK);
/* process data until SSL handshake bytes. Set length of the
pre-SSL bytes in prefixlen */
recv(sock, bigpack, prefixlen, 0);
After this, the next byte to read should be the first SSL byte. Just
hand over the socket to SSL and be happy :-).
--
Richard Levitte \ Spannv�gen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken \ S-168 35 BROMMA \ T: +46-8-26 52 47
Redakteur@Stacken \ SWEDEN \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Member of the OpenSSL development team
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]